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-14 17:47:08 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2009-05-14 17:47:08 +0400
commitd95a10999052ad308599cb0fbbe7ed4f59870c9c (patch)
treec8ab32463f7e774319e35ab23855743dd0dea341 /source/gameengine/Converter/BL_SkinDeformer.cpp
parent003534513645576215092b79f1aa46e85c89e3bd (diff)
BGE modifier: generate correct physic shape, share static derived mesh, share display list.
This commit completes the support for modifiers in the BGE. - The physic shape is generated according to the derived mesh. This is true for all types of shapes and all types of objects except soft body. - Optimization for static derived mesh (mesh with modifiers but no armature and no shape keys). Replicas will share the derived mesh and the display list: less memory and faster rendering. With this optimization, the static derived mesh will render as fast as if the modifiers were applied. Known Limits: - Sharing of mesh and display list is only possible between in-game replicas or dupligroup. If you want to instantiate multiple objects with modifiers, use dupligroup to ensure best memory and GPU utilization. - rayCast() will interact with the derived mesh as follow: Hit position and hit normal are the real values according to the derived mesh but the KX_PolyProxy object refers to the original mesh. You should use it only to retrieve the material. - Dynamic derived mesh have very poor performance: They use direct openGL calls for rendering (no support for display list and vertex array) and they dont't share the derived mesh memory. Always apply modifiers on dynamic mesh for best performance. - Time dependent modifiers are not supported. - Modifiers are not supported for Bullet soft body.
Diffstat (limited to 'source/gameengine/Converter/BL_SkinDeformer.cpp')
-rw-r--r--source/gameengine/Converter/BL_SkinDeformer.cpp45
1 files changed, 27 insertions, 18 deletions
diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp
index e92c3b29543..a13f78e1b27 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.cpp
+++ b/source/gameengine/Converter/BL_SkinDeformer.cpp
@@ -127,24 +127,26 @@ bool BL_SkinDeformer::Apply(RAS_IPolyMaterial *mat)
if (!Update())
return false;
- // the vertex cache is unique to this deformer, no need to update it
- // if it wasn't updated! We must update all the materials at once
- // because we will not get here again for the other material
- nmat = m_pMeshObject->NumMaterials();
- for (imat=0; imat<nmat; imat++) {
- mmat = m_pMeshObject->GetMeshMaterial(imat);
- if(!mmat->m_slots[(void*)m_gameobj])
- continue;
-
- slot = *mmat->m_slots[(void*)m_gameobj];
-
- // for each array
- for(slot->begin(it); !slot->end(it); slot->next(it)) {
- // for each vertex
- // copy the untransformed data from the original mvert
- for(i=it.startvertex; i<it.endvertex; i++) {
- RAS_TexVert& v = it.vertex[i];
- v.SetXYZ(m_transverts[v.getOrigIndex()]);
+ if (m_transverts) {
+ // the vertex cache is unique to this deformer, no need to update it
+ // if it wasn't updated! We must update all the materials at once
+ // because we will not get here again for the other material
+ nmat = m_pMeshObject->NumMaterials();
+ for (imat=0; imat<nmat; imat++) {
+ mmat = m_pMeshObject->GetMeshMaterial(imat);
+ if(!mmat->m_slots[(void*)m_gameobj])
+ continue;
+
+ slot = *mmat->m_slots[(void*)m_gameobj];
+
+ // for each array
+ for(slot->begin(it); !slot->end(it); slot->next(it)) {
+ // for each vertex
+ // copy the untransformed data from the original mvert
+ for(i=it.startvertex; i<it.endvertex; i++) {
+ RAS_TexVert& v = it.vertex[i];
+ v.SetXYZ(m_transverts[v.getOrigIndex()]);
+ }
}
}
}
@@ -161,6 +163,13 @@ RAS_Deformer *BL_SkinDeformer::GetReplica()
return result;
}
+void BL_SkinDeformer::ProcessReplica()
+{
+ BL_MeshDeformer::ProcessReplica();
+ m_lastArmaUpdate = -1;
+ m_releaseobject = false;
+}
+
//void where_is_pose (Object *ob);
//void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3], int numVerts, int deformflag);
bool BL_SkinDeformer::Update(void)