Esempio n. 1
0
//*************************************************************************************************************
void Render(float alpha, float elapsedtime)
{
	static float time = 0;

	D3DXMATRIX viewproj;

	D3DXMatrixMultiply(&viewproj, &view, &proj);
	D3DXMatrixScaling(&world, 0.1f, 0.1f, 0.1f);

	time += elapsedtime;

	device->Clear(0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0xff6694ed, 1.0f, 0);
	device->SetTransform(D3DTS_WORLD, &world);
	device->SetTransform(D3DTS_VIEW, &view);
	device->SetTransform(D3DTS_PROJECTION, &proj);

	mesh.Update(elapsedtime, &world);

	effect->SetMatrix("matViewProj", &viewproj);

	if( SUCCEEDED(device->BeginScene()) )
	{
		mesh.Draw();
		device->EndScene();
	}
	
	device->Present(NULL, NULL, NULL, NULL);
}
Esempio n. 2
0
void Scene::Update(float timeElapsed)
{
    TIME_PROFILE("Scene::Update");
    
    uint64 time = SystemTimer::Instance()->AbsoluteMS();
    
    
	updatableSystem->UpdatePreTransform();

    transformSystem->Process();

	updatableSystem->UpdatePostTransform();

	if(RenderManager::Instance()->GetOptions()->IsOptionEnabled(RenderOptions::UPDATE_LODS))
	{
		lodSystem->SetCamera(currentCamera);
		lodSystem->Process();
	}
	

	switchSystem->Process();
    
//	entityManager->Flush();
	int32 size;
	
	size = (int32)animations.size();
	for (int32 animationIndex = 0; animationIndex < size; ++animationIndex)
	{
		SceneNodeAnimationList * anim = animations[animationIndex];
		anim->Update(timeElapsed);
	}
	

	referenceNodeSuffixChanged = false;

	if(RenderManager::Instance()->GetOptions()->IsOptionEnabled(RenderOptions::UPDATE_ANIMATED_MESHES))
	{
		size = (int32)animatedMeshes.size();
		for (int32 animatedMeshIndex = 0; animatedMeshIndex < size; ++animatedMeshIndex)
		{
			AnimatedMesh * mesh = animatedMeshes[animatedMeshIndex];
			mesh->Update(timeElapsed);
		}
	}

	//if(imposterManager)
	//{
	//	imposterManager->Update(timeElapsed);
	//}
    
    updateTime = SystemTimer::Instance()->AbsoluteMS() - time;
}