]> git.tdb.fi Git - libs/gl.git/blobdiff - source/simplescene.cpp
Remove dynamic allocation from VertexFormat
[libs/gl.git] / source / simplescene.cpp
index 4ccc714b79d7eefbe898a43677c0284a81e0a2ff..b8c90517082ece5db4e1159d6f25dfaf8aef7c7e 100644 (file)
@@ -6,8 +6,9 @@ namespace GL {
 
 void SimpleScene::add(const Renderable &r)
 {
-       renderables.insert(&r);
-       cache.clear();
+       // Add to cache as well if the cache is valid
+       if(renderables.insert(&r).second && !cache.empty())
+               cache.push_back(&r);
 }
 
 void SimpleScene::remove(const Renderable &r)