Ejemplo n.º 1
0
// If the environment is interactive, a global will be defined. Otherwise, a global will be
// defined only if it is not already defined. One will be returned if the global can't be defined.
int_t EnvironmentDefine(FObject env, FObject symid, FObject val)
{
    FAssert(EnvironmentP(env));
    FAssert(SymbolP(symid) || IdentifierP(symid));

    if (IdentifierP(symid))
        symid = AsIdentifier(symid)->Symbol;

    FObject gl = EnvironmentBind(env, symid);

    FAssert(GlobalP(gl));

    if (AsEnvironment(env)->Interactive == FalseObject)
    {
        if (AsGlobal(gl)->State != GlobalUndefined)
            return(1);
    }
    else if (AsGlobal(gl)->State == GlobalImported
            || AsGlobal(gl)->State == GlobalImportedModified)
    {
        FAssert(BoxP(AsGlobal(gl)->Box));

//        AsGlobal(gl)->Box = MakeBox(NoValueObject);
        Modify(FGlobal, gl, Box, MakeBox(NoValueObject));
    }

    FAssert(BoxP(AsGlobal(gl)->Box));

    SetBox(AsGlobal(gl)->Box, val);
//    AsGlobal(gl)->State = GlobalDefined;
    Modify(FGlobal, gl, State, GlobalDefined);

    return(0);
}
Ejemplo n.º 2
0
void
ConeDistanceManipulator::UpdateShapes(Point3& origin, Point3& direction,
                                   float dist, float angle, bool useCube)
{
    ClearPolyShapes();
    // Create the circle at the base of the cone

    PolyShape shape;

//    AddCubeShape(shape, Point3(0.0f, 0.0f, -dist), mGizmoScale);
//    AppendPolyShape(&shape);
    Mesh* pMesh;
    Point3 center(0.0f, 0.0f, -dist);
    if (useCube)
        pMesh = MakeBox(center, mGizmoScale, mGizmoScale, mGizmoScale, 1, 1, 1);
    else
        pMesh = MakeSphere(center, mGizmoScale, 10);

    AppendMesh(pMesh, ManipulatorGizmo::kGizmoScaleToViewport, GetUnselectedColor());

    // Store the definitions away
    mOrigin = origin;
    mDirection = direction;
    mAngle = angle;
    mDistance = dist;
}
Ejemplo n.º 3
0
Archivo: main.cpp Proyecto: CCJY/coliru
int main()
{
    Polygon base = MakeBox(0,0,10,10); //Base polygon
    std::vector<Polygon> polys;
    std::vector<double>  vals;
    //Set up some random input
    for(int i=0;i<3;i++){
        int xmin=rand()%10;
        int xmax=xmin+rand()%10;
        int ymin=rand()%10;
        int ymax=ymin+rand()%10;
        polys.push_back(MakeBox(xmin,ymin,xmax,ymax));
        vals.push_back(rand()%100);
    }
    std::cout<<GetValue(base,polys,vals)<<std::endl;
}
Ejemplo n.º 4
0
/* ------------------------
* メイン関数
------------------------ */
int main(int argc, char *argv[])
{
    /* txtデータ読み込み */
    LoadTxt("route.txt", routeX, routeY, routeZ, &lineRoute);
    LoadTxt("obstacle.txt", obstX, obstY, obstZ, &lineObst);
    /* ODEの初期化 */
    dInitODE();
    /* 描画関数の設定 */
    setDrawStuff();
    /* ワールド, スペース, 接触点グループの生成 */
    world = dWorldCreate();
    space = dHashSpaceCreate(0);
    contactgroup = dJointGroupCreate(0);
    /* 地面, 重力の生成 */
    ground = dCreatePlane(space,0,0,1,0);
    dWorldSetGravity(world, 0.0, 0.0, -9.8);
    /* CFM, ERPの設定 */
    dWorldSetCFM(world,1e-3);
    dWorldSetERP(world,0.8);
    /* 全方向移動ロボットの生成 */
    t1 = clock();
    MakeBox();
    MakeOmni();
    /* シミュレーションループ */
    dsSimulationLoop(argc,argv,640,480,&fn);
    /* 接触点グループ, スペース, ワールドの破壊, ODEの終了 */
    dJointGroupDestroy(contactgroup);
    dSpaceDestroy(space);
    dWorldDestroy(world);
    dCloseODE();
    return 0;
}
Ejemplo n.º 5
0
void Graphics::Initialize()
{
  MakeBox();
  LoadShaders();
  GetTexture("./image.png");
  GetTexture("./image2.png");
  GetTexture("./image3.png");
}
Ejemplo n.º 6
0
static FObject MakeGlobal(FObject nam, FObject mod, FObject ctv)
{
    FAssert(sizeof(FGlobal) == sizeof(GlobalFieldsC) + sizeof(FRecord));
    FAssert(SymbolP(nam));

    FGlobal * gl = (FGlobal *) MakeRecord(R.GlobalRecordType);
    gl->Box = MakeBox(NoValueObject);
    gl->Name = nam;
    gl->Module = mod;
    gl->State = GlobalUndefined;
    gl->Interactive = ctv;

    return(gl);
}
Ejemplo n.º 7
0
void Stage2::Flag1()
{
	for(int i = 0; i<10; i++)
	{
		MakeEnemy(Index_Enemy1, 5000 + 150*i);

	}
	MakeItem(ItemIndex::ItemGrenade,6000);
	MakeItem(ItemIndex::ItemBomb,6500);
	
	for(int i = 0; i<3; i++)
	{
		MakeBox(BoxIndex::Box_ConBox, i * 2300);
	}

}
Ejemplo n.º 8
0
/**
 * Volumeバッファ作成
 * @param model  Volumeモデル
 * @retval true  作成成功
 * @retval false 作成失敗
 */
bool SparseVolumeBuffer::Create(const SparseVolumeModel* model)
{
    bool r = true;
    if (!model) {
        fprintf(stderr,"Failed to create volume\n");
        return false;
    }

    m_model = (SparseVolumeModel*)(model);

    // load shader
    const std::string& shadername = model->GetShader();
    printf("%s\n", shadername.c_str());
    r &= loadShaderSrc(shadername.c_str());
    if (!r) {
        fprintf(stderr,"[Error]Not set shader\n");
        return false;
    }

    // make VolumeData
    BufferSparseVolumeData* volume = model->GetSparseVolume();
    if(!volume) {
        fprintf(stderr,"[Error] BufferSparseVolumeData is NULL\n");
        return false;
    }

    if(volume->VolumeBlocks().size() > 0) {
        float sw = volume->Width();
        float sh = volume->Height();
        float sd = volume->Depth();
        r = CreateSparseTexture3D(volume, model->GetClampToEdgeS(), model->GetClampToEdgeT(), model->GetClampToEdgeR());
        MakeBox(sw,sh,sd);
    } else {
        fprintf(stderr,"[Error] Not load buffer\n");
    }

    cacheTextures(model);

    return r;
}
Ejemplo n.º 9
0
void System::CreateObjects(int x, int y, int z, double posX, double posY, double posZ, bool rnd,int type){

	mNumCurrentSpheres+=x*y*z;
	ChSharedBodyPtr mrigidBody;
	for (int xx=0; xx<x; xx++){
		for (int yy=0; yy<y; yy++){
			for (int zz=0; zz<z; zz++){
				ChVector<> mParticlePos((xx-(x-1)/2.0)+posX,(yy)+posY,(zz-(z-1)/2.0)+posZ);
				ChQuaternion<> quat=ChQuaternion<>(1,0,0,0);;
				if(rnd){
					mParticlePos.x+=(rand()%1000)/4000.f;
					mParticlePos.y+=(rand()%1000)/4000.f;
					mParticlePos.z+=(rand()%1000)/4000.f;
					quat.Q_from_NasaAngles(ChVector<>((rand()%4000)/1000.0f,(rand()%4000)/1000.f,(rand()%4000)/1000.f));
				}
				mrigidBody = ChSharedBodyPtr(new ChBodyGPU);
				if(type==0){MakeSphere(mrigidBody, mSphereRadius, mSphereMass, mParticlePos, mMu, mMu, mSphereRestitution, true);}
				if(type==1){MakeBox(mrigidBody, ChVector<>(mSphereRadius,mSphereRadius,mSphereRadius), mSphereMass, mParticlePos,quat, mMu, mMu, mSphereRestitution,mNumCurrentObjects,mNumCurrentObjects,true, false);}
				if(type==2){MakeEllipsoid(mrigidBody, ChVector<>(mSphereRadius*2,mSphereRadius,mSphereRadius*2), mSphereMass, mParticlePos,quat, mMu, mMu, mSphereRestitution, true);}
				mNumCurrentObjects++;
			}
		}
	}
}
Ejemplo n.º 10
0
Archivo: hud.cpp Proyecto: TSM-Dev/nh30
void hud::DrawESP()
{
	surface->SetFont(ui::font_hud);
	surface->SetTextColor(0xff, 0xff, 0xff, 0xff);

	Entity *lp  = LocalPlayer();
	int  maxent = globals->maxclients();

	for (int i = 1; i <= ents->GetMaxEntities(); ++i)
	{
		Entity *ent = ents->GetEntity(i);

		if (ent == nullptr || ent == lp)
			continue;

		if (ent->IsDormant())
			continue;

		if (1 && i <= maxent)
		{
			if (!ent->IsAlive())
				continue;

			int x0, y0, x1, y1;

			if (!MakeBox(ent, x0, y0, x1, y1))
			 	continue;

			surface->SetColor(0x00, 0x00, 0x00, 0x7f);
			surface->DrawOutlinedRect(x0 - 1, y0 - 1, x1 + 1, y1 + 1);
			surface->DrawOutlinedRect(x0 + 1, y0 + 1, x1 - 1, y1 - 1);

			if (1) // menu.ESP.health
			 	surface->DrawFilledRect(x0 - 4, y0 - 1, x0 - 1, y1 + 1);

#if defined(L4D) || defined(L4D2)
			switch (ent->GetTeam())
			{
				case 2:
				case 4:
					surface->SetColor(0x46, 0x78, 0xff, 0xff);
				break;

				case 3:
					surface->SetColor(0x96, 0x00, 0xe1, 0xff);
				break;
			}
#else
			switch (ent->GetTeam())
			{
				case TEAM_RED:
					surface->SetColor(0xff, 0x64, 0x64, 0xff);
				break;

				case TEAM_BLU:
					surface->SetColor(0x46, 0x78, 0xff, 0xff);
				break;
			}
#endif

			surface->DrawOutlinedRect(x0, y0, x1, y1);

			if (1) // menu.ESP.health
			{
				if (ent->GetHealth() <= ent->GetMaxHealth())
				{
					if (ent->GetHealth() <= (ent->GetMaxHealth() / 4))
						surface->SetColor(0xff, 0x00, 0x00, 0xff);
					else
						surface->SetColor(0x00, 0xff, 0x00, 0xff);
				}

				surface->DrawFilledRect(x0 - 3, y1 - Min<int>(y1 - y0, (float)(y1 - y0) * ((float)ent->GetHealth() / (float)ent->GetMaxHealth()) + 0.5f), x0 - 1, y1);
			}

			if (1) // menu.ESP.name
			{
				player_info info;
				engine->GetPlayerInfo(i, info);

				int length = 0;
				const wchar_t *text = tounicode(info.name, length);

				int tw, th;
				surface->GetTextSize(ui::font_hud, text, tw, th);

				surface->SetTextPos((x0 + x1 - tw) / 2, y0 - th);
				surface->DrawText(text, length, 0);
			}

			if (1) // menu.ESP.weapon
			{
				Entity *weapon = ent->GetActiveWeapon();

				if (weapon)
				{
					const char *classname = weapon->GetClass();
#ifndef GMOD
					if (qstrlen(classname) > 6)
					{
						classname += 6;
					}
#endif

					int length = 0;
					const wchar_t *text = util::MakeReadable(classname, length);

					int tw, th;
					surface->GetTextSize(ui::font_hud, text, tw, th);

					surface->SetTextPos((x0 + x1 - tw) / 2, y1 + 1);
					surface->DrawText(text, length, 0);
				}
			}

			continue;
		}

		if (1)
		{
#if defined(L4D) || defined(L4D2)
			if (streq(ent->GetNetworkClass()->name, "Infected"))
			{
				if (!ent->NPC_IsAlive())
					continue;

				int x0, y0, x1, y1;

				if (!MakeBox(ent, x0, y0, x1, y1))
					continue;

				surface->SetColor(0x00, 0x00, 0x00, 0x7f);
				surface->DrawOutlinedRect(x0 - 1, y0 - 1, x1 + 1, y1 + 1);
				surface->DrawOutlinedRect(x0 + 1, y0 + 1, x1 - 1, y1 - 1);

				surface->SetColor(0xc8, 0xff, 0x00, 0xff);
				surface->DrawOutlinedRect(x0, y0, x1, y1);


				int tw, th;

				if (ReadPtr<bool>(ent, m_mobRush))
				{
					surface->GetTextSize(ui::font_hud, L"Mob rush", tw, th);

					surface->SetTextPos((x0 + x1 - tw) / 2, y1 + 1);
					surface->DrawText(L"Mob rush", 8, 0);
				}
				else
				{
					surface->GetTextSize(ui::font_hud, L"Common", tw, th);

					surface->SetTextPos((x0 + x1 - tw) / 2, y1 + 1);
					surface->DrawText(L"Common", 6, 0);
				}

				continue;
			}

			if (streq(ent->GetNetworkClass()->name, "Witch"))
			{
				if (!ent->NPC_IsAlive())
					continue;

				int x0, y0, x1, y1;

				if (!MakeBox(ent, x0, y0, x1, y1))
					continue;

				surface->SetColor(0x00, 0x00, 0x00, 0x7f);
				surface->DrawOutlinedRect(x0 - 1, y0 - 1, x1 + 1, y1 + 1);
				surface->DrawOutlinedRect(x0 + 1, y0 + 1, x1 - 1, y1 - 1);

				surface->SetColor(0x96, 0x00, 0xe1, 0xff);
				surface->DrawOutlinedRect(x0, y0, x1, y1);

				int tw, th;

				surface->GetTextSize(ui::font_hud, L"Witch", tw, th);

				surface->SetTextPos((x0 + x1 - tw) / 2, y1 + 1);
				surface->DrawText(L"Witch", 5, 0);

				continue;
			}
#endif
		}
	}
}
Ejemplo n.º 11
0
	void Page::DisplaySlice(OutputDev *pOut, double dHorizDPI, double dVertDPI, int nRotate, bool bUseMediaBox, bool bCrop, int nSliceX, int nSliceY, int nSliceW, int nSliceH, bool bPrinting, Catalog *pCatalog, bool(*abortCheckCbk)(void *pData), void *abortCheckCbkData)
	{
		if (!pOut->CheckPageSlice(this, dHorizDPI, dVertDPI, nRotate, bUseMediaBox, bCrop, nSliceX, nSliceY, nSliceW, nSliceH, bPrinting, pCatalog, abortCheckCbk, abortCheckCbkData))
		{
			return;
		}

		nRotate += GetRotate();
		if (nRotate >= 360)
		{
			nRotate -= 360;
		}
		else if (nRotate < 0)
		{
			nRotate += 360;
		}

		PDFRectangle oBox;
		MakeBox(dHorizDPI, dVertDPI, nRotate, bUseMediaBox, pOut->UpSideDown(), nSliceX, nSliceY, nSliceW, nSliceH, &oBox, &bCrop);
		PDFRectangle *pCropBox = GetCropBox();

		Graphics *pGraphics = new Graphics(m_pGlobalParams, m_pXref, pOut, m_nNumber, m_pAttrs->GetResourceDict(), dHorizDPI, dVertDPI, &oBox, bCrop ? pCropBox : (PDFRectangle *)NULL, nRotate, abortCheckCbk, abortCheckCbkData);
		if (pGraphics)
		{
			Object oTemp;
			m_oContents.Fetch(m_pXref, &oTemp);
			if (!oTemp.IsNull())
			{
				pGraphics->SaveGState();
				pGraphics->Display(&oTemp);
				pGraphics->RestoreGState();
			}
			oTemp.Free();

			Annots *pAnnotList = new Annots(m_pGlobalParams, m_pXref, pCatalog, GetAnnots(&oTemp));
			oTemp.Free();
			if (pAnnotList)
			{
				Dict *pAcroForm = pCatalog->GetAcroForm()->IsDict() ? pCatalog->GetAcroForm()->GetDict() : NULL;
				if (pAcroForm)
				{
					if (pAcroForm->Search("NeedAppearances", &oTemp))
					{
						if (oTemp.IsBool() && oTemp.GetBool())
						{
							pAnnotList->GenerateAppearances(pAcroForm);
						}
					}
					oTemp.Free();
				}
				if (pAnnotList->GetAnnotsCount() > 0)
				{
					for (int nIndex = 0; nIndex < pAnnotList->GetAnnotsCount(); ++nIndex)
					{
						pAnnotList->GetAnnot(nIndex)->Draw(pGraphics, bPrinting);
					}
					pOut->Dump();
				}
				delete pAnnotList;
			}
			delete pGraphics;
		}
	}