From 073d3ba5f7a5ef8f8255f90ae8b2e24a7114cb1c Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Fri, 10 May 2013 05:13:16 +0000 Subject: [PATCH] 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. --- source/gameengine/Rasterizer/RAS_BucketManager.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp index af8c855f3b0..7d1190bef5c 100644 --- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp +++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp @@ -238,13 +238,21 @@ void RAS_BucketManager::Renderbuckets( BucketList::iterator bit; list::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); }