diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-24 02:12:40 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-24 02:12:40 +0300 |
commit | b20f6e27ff24f60bfa39b2311be3cc2f4130ac09 (patch) | |
tree | cb528d7c2d3cfe9d983a17cea3866a695f1c1e43 /source/gameengine/Ketsji | |
parent | f162428bd244687116c5a51edc64b1b49c634154 (diff) |
Commit patch #8724:
This patch modifies the BL_ConvertMesh method from the data conversion module in order to reduce the number of polygon
material objects that are created.
Normally, there should be only one material object for each material bucket(the group of meshes that are rendered together
with a single material). However, the number of materials that are created right now in the converter is much higher
and eats a lot of memory in scenes with large polygon counts. This patch deletes those material objects(KX_BlenderMaterial)
that are used only temporarily in the converter(and are now deleted only when the converter is destroyed, at the end
of the game).
For a cube that's subdivided 7 times(90+ k polygons) I get 200 MB usage in the game engine in 2.45 and 44 MB with a
svn build with this patch applied if the "Use Blender Materials" option is activated in the Game menu.
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 2d86e23f5ce..b2557a69527 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -1212,9 +1212,9 @@ void KX_Scene::UpdateParents(double curtime) -RAS_MaterialBucket* KX_Scene::FindBucket(class RAS_IPolyMaterial* polymat) +RAS_MaterialBucket* KX_Scene::FindBucket(class RAS_IPolyMaterial* polymat, bool &bucketCreated) { - return m_bucketmanager->RAS_BucketManagerFindBucket(polymat); + return m_bucketmanager->RAS_BucketManagerFindBucket(polymat, bucketCreated); } diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h index 58120d49dc4..b5de483e8f0 100644 --- a/source/gameengine/Ketsji/KX_Scene.h +++ b/source/gameengine/Ketsji/KX_Scene.h @@ -286,7 +286,7 @@ public: ~KX_Scene(); RAS_BucketManager* GetBucketManager(); - RAS_MaterialBucket* FindBucket(RAS_IPolyMaterial* polymat); + RAS_MaterialBucket* FindBucket(RAS_IPolyMaterial* polymat, bool &bucketCreated); void RenderBuckets(const MT_Transform& cameratransform, RAS_IRasterizer* rasty, RAS_IRenderTools* rendertools); |