1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-27 21:35:24 +00:00

Workaround for meshes without any vertices

This commit is contained in:
Chris Robinson 2013-02-28 13:54:53 -08:00
parent 2786cc67f6
commit eaa6813917

View File

@ -844,9 +844,12 @@ class NIFMeshLoader : Ogre::ManualResourceLoader
// Set the bounding box first // Set the bounding box first
BoundsFinder bounds; BoundsFinder bounds;
bounds.add(&srcVerts[0][0], srcVerts.size()); bounds.add(&srcVerts[0][0], srcVerts.size());
// No idea why this offset is needed. It works fine without it if the if(!bounds.isValid())
// vertices weren't transformed first, but otherwise it fails later on {
// when the object is being inserted into the scene. float v[3] = { 0.0f, 0.0f, 0.0f };
bounds.add(&v[0], 1);
}
mesh->_setBounds(Ogre::AxisAlignedBox(bounds.minX()-0.5f, bounds.minY()-0.5f, bounds.minZ()-0.5f, mesh->_setBounds(Ogre::AxisAlignedBox(bounds.minX()-0.5f, bounds.minY()-0.5f, bounds.minZ()-0.5f,
bounds.maxX()+0.5f, bounds.maxY()+0.5f, bounds.maxZ()+0.5f)); bounds.maxX()+0.5f, bounds.maxY()+0.5f, bounds.maxZ()+0.5f));
mesh->_setBoundingSphereRadius(bounds.getRadius()); mesh->_setBoundingSphereRadius(bounds.getRadius());