Fix particles being animated twice in stereo render, see #43

This commit is contained in:
kaetemi 2013-07-04 00:42:06 +02:00
parent 834f478700
commit 5fc257141c
3 changed files with 17 additions and 4 deletions

View file

@ -827,6 +827,7 @@ private:
// common vb for water display
CVertexBuffer _WaterVB;
bool _RequestParticlesAnimate;
};

View file

@ -191,6 +191,8 @@ CScene::CScene(bool bSmallScene) : LightTrav(bSmallScene)
_WaterEnvMap = NULL;
_GlobalSystemTime= 0.0;
_RequestParticlesAnimate = false;
}
// ***************************************************************************
void CScene::release()
@ -381,6 +383,9 @@ void CScene::endPartRender()
drv->activeVertexProgram(NULL);
drv->activePixelProgram(NULL);
// Ensure nothing animates on subsequent renders
_EllapsedTime = 0.f;
/*
uint64 total = PSStatsRegisterPSModelObserver +
PSStatsRemovePSModelObserver +
@ -617,7 +622,11 @@ void CScene::renderPart(UScene::TRenderPart rp, bool doHrcPass)
// loadBalance
LoadBalancingTrav.traverse();
//
_ParticleSystemManager.processAnimate(_EllapsedTime); // deals with permanently animated particle systems
if (_RequestParticlesAnimate)
{
_ParticleSystemManager.processAnimate(_EllapsedTime); // deals with permanently animated particle systems
_RequestParticlesAnimate = false;
}
// Light
LightTrav.traverse();
}
@ -863,6 +872,9 @@ void CScene::animate( TGlobalAnimationTime atTime )
// Rendered part are invalidate
_RenderedPart = UScene::RenderNothing;
// Particles are animated later due to dependencies
_RequestParticlesAnimate = true;
}

View file

@ -219,7 +219,8 @@ void releaseSky()
// -- -- random note: update and render makes more sense than animate and update
void animateSky(double dt)
{
if (!StereoDisplay) Clouds->anim(dt);
if (!StereoHMD) Clouds->anim(dt);
SkyScene->animate(AnimationTime);
}
// this is actually render
@ -232,7 +233,6 @@ void updateSky()
skyCameraMatrix.setPos(CVector::Null);
SkyCamera.setMatrix(skyCameraMatrix);
SkyScene->animate(AnimationTime);
SkyScene->render();
// Must clear ZBuffer For incoming rendering.
Driver->clearZBuffer();