1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-06 17:15:39 +00:00

Calculate bounding volumes when preloading model instance

This commit is contained in:
Andrei Kortunov 2019-03-09 13:12:54 +04:00
parent c20e69ef24
commit b214c54b3a

View file

@ -531,6 +531,8 @@ namespace Resource
if (mIncrementalCompileOperation) if (mIncrementalCompileOperation)
mIncrementalCompileOperation->add(loaded); mIncrementalCompileOperation->add(loaded);
else
loaded->getBound();
mCache->addEntryToObjectCache(normalized, loaded); mCache->addEntryToObjectCache(normalized, loaded);
return loaded; return loaded;
@ -543,6 +545,12 @@ namespace Resource
mVFS->normalizeFilename(normalized); mVFS->normalizeFilename(normalized);
osg::ref_ptr<osg::Node> node = createInstance(normalized); osg::ref_ptr<osg::Node> 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()); mInstanceCache->addEntryToObjectCache(normalized, node.get());
return node; return node;
} }