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>2008-03-24 02:12:40 +0300
committerBenoit Bolsee <benoit.bolsee@online.be>2008-03-24 02:12:40 +0300
commitb20f6e27ff24f60bfa39b2311be3cc2f4130ac09 (patch)
treecb528d7c2d3cfe9d983a17cea3866a695f1c1e43 /source/gameengine/Rasterizer
parentf162428bd244687116c5a51edc64b1b49c634154 (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/Rasterizer')
-rw-r--r--source/gameengine/Rasterizer/RAS_BucketManager.cpp4
-rw-r--r--source/gameengine/Rasterizer/RAS_BucketManager.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
index 999a79546a1..9c28aedd994 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
@@ -156,8 +156,9 @@ void RAS_BucketManager::Renderbuckets(
RAS_MaterialBucket::EndFrame();
}
-RAS_MaterialBucket* RAS_BucketManager::RAS_BucketManagerFindBucket(RAS_IPolyMaterial * material)
+RAS_MaterialBucket* RAS_BucketManager::RAS_BucketManagerFindBucket(RAS_IPolyMaterial * material, bool &bucketCreated)
{
+ bucketCreated = false;
BucketList::iterator it;
for (it = m_MaterialBuckets.begin(); it != m_MaterialBuckets.end(); it++)
{
@@ -172,6 +173,7 @@ RAS_MaterialBucket* RAS_BucketManager::RAS_BucketManagerFindBucket(RAS_IPolyMate
}
RAS_MaterialBucket *bucket = new RAS_MaterialBucket(material);
+ bucketCreated = true;
if (bucket->IsTransparant())
m_AlphaBuckets.push_back(bucket);
else
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.h b/source/gameengine/Rasterizer/RAS_BucketManager.h
index 59144f1e175..11633f555ea 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.h
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.h
@@ -61,7 +61,7 @@ public:
RAS_IRasterizer* rasty,
class RAS_IRenderTools* rendertools);
- RAS_MaterialBucket* RAS_BucketManagerFindBucket(RAS_IPolyMaterial * material);
+ RAS_MaterialBucket* RAS_BucketManagerFindBucket(RAS_IPolyMaterial * material, bool &bucketCreated);
private: