[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20173] trunk/blender/source/gameengine: BGE performance: allow to create display list on meshes with modifiers but without armature and shape keys .
Benoit Bolsee
benoit.bolsee at online.be
Tue May 12 21:48:18 CEST 2009
Revision: 20173
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20173
Author: ben2610
Date: 2009-05-12 21:48:18 +0200 (Tue, 12 May 2009)
Log Message:
-----------
BGE performance: allow to create display list on meshes with modifiers but without armature and shape keys. These modified meshes are static and can be put safely in a display list. As the rendering of modifiers is done in direct openGL call, it results is a bit performance boost.
Modified Paths:
--------------
trunk/blender/source/gameengine/Converter/BL_MeshDeformer.h
trunk/blender/source/gameengine/Converter/BL_ShapeDeformer.cpp
trunk/blender/source/gameengine/Converter/BL_SkinDeformer.cpp
trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
trunk/blender/source/gameengine/Rasterizer/RAS_Deformer.h
trunk/blender/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
Modified: trunk/blender/source/gameengine/Converter/BL_MeshDeformer.h
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_MeshDeformer.h 2009-05-12 19:28:49 UTC (rev 20172)
+++ trunk/blender/source/gameengine/Converter/BL_MeshDeformer.h 2009-05-12 19:48:18 UTC (rev 20173)
@@ -66,7 +66,7 @@
virtual bool Update(void){ return false; };
virtual bool UpdateBuckets(void){ return false; };
virtual RAS_Deformer* GetReplica(){return NULL;};
- virtual void ProcessReplica() { };
+ virtual void ProcessReplica() {m_bDynamic=false;};
struct Mesh* GetMesh() { return m_bmesh; };
// virtual void InitDeform(double time){};
Modified: trunk/blender/source/gameengine/Converter/BL_ShapeDeformer.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_ShapeDeformer.cpp 2009-05-12 19:28:49 UTC (rev 20172)
+++ trunk/blender/source/gameengine/Converter/BL_ShapeDeformer.cpp 2009-05-12 19:48:18 UTC (rev 20173)
@@ -121,7 +121,7 @@
ForceUpdate();
m_armobj->RestorePose();
-
+ m_bDynamic = true;
return true;
}
return false;
@@ -144,8 +144,10 @@
/* we will blend the key directly in mvert array: it is used by armature as the start position */
/* m_bmesh->key can be NULL in case of Modifier deformer */
- if (m_bmesh->key)
+ if (m_bmesh->key) {
do_rel_key(0, m_bmesh->totvert, m_bmesh->totvert, (char *)m_bmesh->mvert->co, m_bmesh->key, 0);
+ m_bDynamic = true;
+ }
// Don't release the weight array as in Blender, it will most likely be reusable on next frame
// The weight array are ultimately deleted when the skin mesh is destroyed
Modified: trunk/blender/source/gameengine/Converter/BL_SkinDeformer.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_SkinDeformer.cpp 2009-05-12 19:28:49 UTC (rev 20172)
+++ trunk/blender/source/gameengine/Converter/BL_SkinDeformer.cpp 2009-05-12 19:48:18 UTC (rev 20173)
@@ -201,7 +201,8 @@
m_lastArmaUpdate=m_armobj->GetLastFrame();
m_armobj->RestorePose();
-
+ /* dynamic vertex, cannot use display list */
+ m_bDynamic = true;
/* indicate that the m_transverts and normals are up to date */
return true;
}
Modified: trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp 2009-05-12 19:28:49 UTC (rev 20172)
+++ trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp 2009-05-12 19:48:18 UTC (rev 20173)
@@ -757,6 +757,7 @@
virtual bool Update(void)
{
//printf("update\n");
+ m_bDynamic = true;
return true;//??
}
virtual bool UpdateBuckets(void)
@@ -775,6 +776,7 @@
virtual void ProcessReplica()
{
// we have two pointers to deal with but we cannot do it now, will be done in Relink
+ m_bDynamic = false;
}
virtual bool SkipVertexTransform()
{
Modified: trunk/blender/source/gameengine/Rasterizer/RAS_Deformer.h
===================================================================
--- trunk/blender/source/gameengine/Rasterizer/RAS_Deformer.h 2009-05-12 19:28:49 UTC (rev 20172)
+++ trunk/blender/source/gameengine/Rasterizer/RAS_Deformer.h 2009-05-12 19:48:18 UTC (rev 20173)
@@ -39,7 +39,7 @@
class RAS_Deformer
{
public:
- RAS_Deformer(){};
+ RAS_Deformer() : m_pMesh(0), m_bDynamic(false) {};
virtual ~RAS_Deformer(){};
virtual void Relink(GEN_Map<class GEN_HashedPtr, void*>*map)=0;
virtual bool Apply(class RAS_IPolyMaterial *polymat)=0;
@@ -55,8 +55,14 @@
{
return true;
}
+ // true when deformer produces varying vertex (shape or armature)
+ bool IsDynamic()
+ {
+ return m_bDynamic;
+ }
protected:
class RAS_MeshObject *m_pMesh;
+ bool m_bDynamic;
};
#endif
Modified: trunk/blender/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
===================================================================
--- trunk/blender/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp 2009-05-12 19:28:49 UTC (rev 20172)
+++ trunk/blender/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp 2009-05-12 19:48:18 UTC (rev 20173)
@@ -597,7 +597,7 @@
// then it won't have texture coordinates for actual drawing. also
// for zsort we can't make a display list, since the polygon order
// changes all the time.
- if(ms.m_pDeformer)
+ if(ms.m_pDeformer && ms.m_pDeformer->IsDynamic())
ms.m_bDisplayList = false;
else if(!ms.m_DisplayList && rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW)
ms.m_bDisplayList = false;
More information about the Bf-blender-cvs
mailing list