Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2009-05-19 10:48:36 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2009-05-19 10:48:36 +0400
commit5bd4b25dd1997672e4487f7dcba76e4b74ce814f (patch)
tree06dbd201f9d1d9444d86681753d9c9bdd2a123e5 /source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
parentdef33757e303255bfd9c17eb716a02d49df58062 (diff)
BGE bug #18762 fixed: softbody. An incompatibility between the soft body deformer and other types of deformer was causing the soft body to disappear in the game. This was the case when the soft body had an armature or simply vertex groups.
Diffstat (limited to 'source/gameengine/Rasterizer/RAS_MaterialBucket.cpp')
-rw-r--r--source/gameengine/Rasterizer/RAS_MaterialBucket.cpp66
1 files changed, 43 insertions, 23 deletions
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
index 841264465cf..8e90c9a1c08 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
@@ -284,35 +284,55 @@ void RAS_MeshSlot::AddPolygonVertex(int offset)
void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer)
{
if (deformer && m_pDeformer != deformer) {
- // we create local copy of RAS_DisplayArray when we have a deformer:
- // this way we can avoid conflict between the vertex cache of duplicates
RAS_DisplayArrayList::iterator it;
- for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
- if (deformer->UseVertexArray()) {
- // the deformer makes use of vertex array, make sure we have our local copy
- if ((*it)->m_users > 1) {
- // only need to copy if there are other users
- // note that this is the usual case as vertex arrays are held by the material base slot
- RAS_DisplayArray *newarray = new RAS_DisplayArray(*(*it));
- newarray->m_users = 1;
- (*it)->m_users--;
- *it = newarray;
- }
- } else {
- // the deformer is not using vertex array (Modifier), release them
+ if (deformer->ShareVertexArray()) {
+ // this deformer uses the base vertex array, first release the current ones
+ for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
(*it)->m_users--;
if((*it)->m_users == 0)
delete *it;
}
- }
- if (!deformer->UseVertexArray()) {
m_displayArrays.clear();
- m_startarray = 0;
- m_startvertex = 0;
- m_startindex = 0;
- m_endarray = 0;
- m_endvertex = 0;
- m_endindex = 0;
+ // then hook to the base ones
+ RAS_MeshMaterial *mmat = m_mesh->GetMeshMaterial(m_bucket->GetPolyMaterial());
+ if (mmat && mmat->m_baseslot) {
+ m_displayArrays = mmat->m_baseslot->m_displayArrays;
+ for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
+ (*it)->m_users++;
+ }
+ }
+ }
+ else {
+ // no sharing
+ // we create local copy of RAS_DisplayArray when we have a deformer:
+ // this way we can avoid conflict between the vertex cache of duplicates
+ for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
+ if (deformer->UseVertexArray()) {
+ // the deformer makes use of vertex array, make sure we have our local copy
+ if ((*it)->m_users > 1) {
+ // only need to copy if there are other users
+ // note that this is the usual case as vertex arrays are held by the material base slot
+ RAS_DisplayArray *newarray = new RAS_DisplayArray(*(*it));
+ newarray->m_users = 1;
+ (*it)->m_users--;
+ *it = newarray;
+ }
+ } else {
+ // the deformer is not using vertex array (Modifier), release them
+ (*it)->m_users--;
+ if((*it)->m_users == 0)
+ delete *it;
+ }
+ }
+ if (!deformer->UseVertexArray()) {
+ m_displayArrays.clear();
+ m_startarray = 0;
+ m_startvertex = 0;
+ m_startindex = 0;
+ m_endarray = 0;
+ m_endvertex = 0;
+ m_endindex = 0;
+ }
}
}
m_pDeformer = deformer;