Example #1
0
void EditorScene::Update(float32 timeElapsed)
{    
    UpdateCameraLight();

	Scene::Update(timeElapsed);

	CheckNodes(this);
	UpdateBullet(this);

	collisionWorld->updateAabbs();
}
Example #2
0
int main(int argc, char *argv[])

{
	int w,h;
	Rect gb;

	HNN=MakeHashTable();
	HEL=MakeHashTable();
	HLI=MakeHashTable();
	HVC=MakeHashTable();
	CM=MakeQueueTable();

	SetOptions(argc,argv);

	ReadFiles(argc,argv);

	CheckNodes(HNN,HEL,HLI,HVC);
	if( OpCheck )
		CheckMore(HNN,HEL,HLI);

	InitMinMax(&gb);
	GetNodeMinMax(HNN,&gb);
	GetNodeMinMax(HVC,&gb);
	SetMinMax(&gb);

	printf("Min/Max values : %f %f %f %f\n",
		gb.low.x,gb.low.y,gb.high.x,gb.high.y);
	printf("Center values  : %f %f \n",
		(gb.low.x+gb.high.x)/2.,(gb.low.y+gb.high.y)/2.);

	GbAll = GbPlo = gb;

	QGraphInit();
	QNewPen(PlotCol);

	SetColors(OpCol);
	QWindowMaxXY(&w,&h);
	ResizeWindow(w,h);
	ScaleFactor(HVC);

	MakeGridMenu();

/*	MouseInit();	*/
	QInitEvent();

	LoopForInput();

	QGraphClose();

	WriteFiles();

	return 0;
}
Example #3
0
void EditorScene::CheckNodes(Entity * curr)
{
	if(NULL != curr)
	{
		bool newDebugComp = false;
		DebugRenderComponent *dbgComp = NULL;

		BaseObject *bulletObject = NULL;
		BulletComponent * bulletComponent = (BulletComponent*)curr->GetComponent(Component::BULLET_COMPONENT);

		if(NULL != bulletComponent)
		{
			bulletObject = bulletComponent->GetBulletObject();
		}

		// create debug render component for all nodes
		dbgComp = (DebugRenderComponent *) curr->GetComponent(Component::DEBUG_RENDER_COMPONENT);
		if(NULL == dbgComp)
		{
			dbgComp = new DebugRenderComponent();
			newDebugComp = true;
			curr->AddComponent(dbgComp);
		}

		// check other debug settings

		// is camera?
		CameraComponent *camComp = (CameraComponent *) curr->GetComponent(Component::CAMERA_COMPONENT);
		if(NULL != camComp)
		{
			// set flags to show it
			if(newDebugComp)
			{
				dbgComp->SetDebugFlags(dbgComp->GetDebugFlags() | DebugRenderComponent::DEBUG_DRAW_CAMERA);
			}

			// create bullet object for camera (allow selecting it)
			/*
			if(NULL == bulletComponent)
			{
				bulletComponent = (BulletComponent*) curr->GetOrCreateComponent(Component::BULLET_COMPONENT);
				bulletComponent->SetBulletObject(new BulletObject(this, collisionWorld, camComp->GetCamera(), camComp->GetCamera()->GetMatrix()));
			}
			*/
		}

		// is light?
		if(NULL != curr->GetComponent(Component::LIGHT_COMPONENT))
		{
			if(newDebugComp)
			{
				dbgComp->SetDebugFlags(dbgComp->GetDebugFlags() | DebugRenderComponent::DEBUG_DRAW_LIGHT_NODE);
			}

			if(NULL == bulletComponent || NULL == bulletObject)
			{
				BulletObject *bObj = new BulletObject(this, collisionWorld, curr, AABBox3(Vector3(), 2.5f), curr->GetWorldTransform());
				bulletComponent = (BulletComponent*) curr->GetOrCreateComponent(Component::BULLET_COMPONENT);
				bulletComponent->SetBulletObject(bObj);
				SafeRelease(bObj);
			}
		}

		// is user node
		if(NULL != curr->GetComponent(Component::USER_COMPONENT))
		{
			if(newDebugComp)
			{
				dbgComp->SetDebugFlags(dbgComp->GetDebugFlags() | DebugRenderComponent::DEBUG_DRAW_USERNODE);
			}

			if(NULL == bulletComponent || NULL == bulletObject)
			{
				BulletObject *bObj = new BulletObject(this, collisionWorld, curr, AABBox3(Vector3(), 2.5f), curr->GetWorldTransform());
				bulletComponent = (BulletComponent*) curr->GetOrCreateComponent(Component::BULLET_COMPONENT);
				bulletComponent->SetBulletObject(bObj);
				SafeRelease(bObj);
			}
		}

		// is render object?
		RenderComponent * renderComponent = (RenderComponent*) curr->GetComponent(Component::RENDER_COMPONENT);
		if(NULL != renderComponent)
		{
			RenderObject *rObj = renderComponent->GetRenderObject();

			if(NULL != rObj && rObj->GetType() != RenderObject::TYPE_LANDSCAPE && curr->IsLodMain(0))
			{
				if(NULL == bulletComponent || NULL == bulletObject)
				{
					BulletObject *bObj = new BulletObject(this, collisionWorld, curr, curr->GetWorldTransform());
					bulletComponent = (BulletComponent*) curr->GetOrCreateComponent(Component::BULLET_COMPONENT);
					bulletComponent->SetBulletObject(bObj);
					SafeRelease(bObj);
				}
			}
		}
	}

	int size = curr->GetChildrenCount();
	for (int i = 0; i < size; i++)
	{
		CheckNodes(curr->GetChild(i));
	}
}
Example #4
0
bool
ValueNode::Add(ValueNode&& node) const
{
	// TODO: Use %emplace.
	return CheckNodes().insert(std::move(node)).second;
}
Example #5
0
bool
ValueNode::Add(const ValueNode& node) const
{
	return CheckNodes().insert(node).second;
}