From ead4a3d938971c364f43de99461b457696bf9a80 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 4 Dec 2015 15:59:10 +0200 Subject: [PATCH] Immediately add renderables to the cache in SimpleScene::add --- source/simplescene.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/simplescene.cpp b/source/simplescene.cpp index 4ccc714b..b8c90517 100644 --- a/source/simplescene.cpp +++ b/source/simplescene.cpp @@ -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) -- 2.43.0