From b214c54b3a9f9ee5a45ec13004f99732283d553f Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sat, 9 Mar 2019 13:12:54 +0400 Subject: [PATCH] Calculate bounding volumes when preloading model instance --- components/resource/scenemanager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index d371a8ce4c..61a40ee4b3 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -531,6 +531,8 @@ namespace Resource if (mIncrementalCompileOperation) mIncrementalCompileOperation->add(loaded); + else + loaded->getBound(); mCache->addEntryToObjectCache(normalized, loaded); return loaded; @@ -543,6 +545,12 @@ namespace Resource mVFS->normalizeFilename(normalized); osg::ref_ptr node = createInstance(normalized); + + // Note: osg::clone() does not calculate bound volumes. + // Do it immediately, otherwise we will need to update them for all objects + // during first update traversal, what may lead to stuttering during cell transitions + node->getBound(); + mInstanceCache->addEntryToObjectCache(normalized, node.get()); return node; }