Skip to content

Commit

Permalink
UPBGE: Remove m_isShadowDone in KX_Scene.
Browse files Browse the repository at this point in the history
This variable was planned originally to reduce shadow update.
In the code the images render are done before the screen render, but the
shadow is set to not done before the screen render. So this variable is
only for multiple images render then as the screen render will always
regenerate shadows.

This will works only if we now that there's no modifications between two
images render, but is not the case as it's the user from python with
function "image.refresh()" which call the image render. We don't know
if a user moved an object between two call to "refresh()" and in this
case the m_isShadowDone will introduce a bug by not generating shadows
properly in the second image render.
  • Loading branch information
panzergame committed Jul 4, 2016
1 parent a884631 commit 45493ef
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 15 deletions.
5 changes: 0 additions & 5 deletions source/gameengine/Ketsji/KX_KetsjiEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,6 @@ bool KX_KetsjiEngine::NextFrame()
}

m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true);

// invalidates the shadow buffer from previous render/ImageRender because the scene has changed
scene->SetShadowDone(false);
}

m_logger->StartLog(tc_network, m_kxsystem->GetTimeInSeconds(), true);
Expand Down Expand Up @@ -1029,8 +1026,6 @@ void KX_KetsjiEngine::RenderShadowBuffers(KX_Scene *scene)
cam->Release();
}
}
/* remember that we have a valid shadow buffer for that scene */
scene->SetShadowDone(true);
}

// update graphics
Expand Down
1 change: 0 additions & 1 deletion source/gameengine/Ketsji/KX_Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ KX_Scene::KX_Scene(SCA_IInputDevice *inputDevice,
m_activity_culling = false;
m_suspend = false;
m_isclearingZbuffer = true;
m_isShadowDone = false;
m_tempObjectList = new CListValue();
m_objectlist = new CListValue();
m_parentlist = new CListValue();
Expand Down
7 changes: 0 additions & 7 deletions source/gameengine/Ketsji/KX_Scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,6 @@ class KX_Scene : public CValue, public SCA_IScene
*/
bool m_isclearingZbuffer;

/**
* Does the shadow buffer needs calculing
*/
bool m_isShadowDone;

/**
* The name of the scene
*/
Expand Down Expand Up @@ -569,8 +564,6 @@ class KX_Scene : public CValue, public SCA_IScene
bool IsSuspended();
bool IsClearingZBuffer();
void EnableZBufferClearing(bool isclearingZbuffer);
bool IsShadowDone() { return m_isShadowDone; }
void SetShadowDone(bool b) { m_isShadowDone = b; }
// use of DBVT tree for camera culling
void SetDbvtCulling(bool b) { m_dbvt_culling = b; }
bool GetDbvtCulling() { return m_dbvt_culling; }
Expand Down
3 changes: 1 addition & 2 deletions source/gameengine/VideoTexture/ImageRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ bool ImageRender::Render()
return false;
}

if (!m_scene->IsShadowDone())
m_engine->RenderShadowBuffers(m_scene);
m_engine->RenderShadowBuffers(m_scene);

if (m_mirror)
{
Expand Down

0 comments on commit 45493ef

Please sign in to comment.