BGE: Fix for [#34382] "Vertex position doesn't update when set through Python and "Cast Buffer Shadows" is disabled" reported by V.R. (rolle).

The BucketManager was assuming that all modified meshes were rendered when a render pass completed. However, materials that did not cast buffer shadows did not render during the shadow rendering step, and thus were never updated.
This commit is contained in:
Mitchell Stokes 2013-05-10 05:13:16 +00:00
parent fffab3993d
commit 073d3ba5f7

@ -238,13 +238,21 @@ void RAS_BucketManager::Renderbuckets(
BucketList::iterator bit;
list<RAS_MeshSlot>::iterator mit;
for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit) {
// RAS_MaterialBucket *bucket = *bit; /* UNUSED */
/* This (and the similar lines of code for the alpha buckets) is kind of a hacky fix for #34382. If we're
* drawing shadows and the material doesn't cast shadows, then the mesh is still modified, so we don't want to
* set MeshModified to false yet. This will happen correctly in the main render pass.
*/
if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && !(*bit)->GetPolyMaterial()->CastsShadows())
continue;
for (mit = (*bit)->msBegin(); mit != (*bit)->msEnd(); ++mit) {
mit->m_mesh->SetMeshModified(false);
}
}
for (bit = m_AlphaBuckets.begin(); bit != m_AlphaBuckets.end(); ++bit) {
// RAS_MaterialBucket* bucket = *bit; /* UNUSED */
if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && !(*bit)->GetPolyMaterial()->CastsShadows())
continue;
for (mit = (*bit)->msBegin(); mit != (*bit)->msEnd(); ++mit) {
mit->m_mesh->SetMeshModified(false);
}