Bugfix: SMesh::recalculateBoundingBox() does now ignore empty boundingboxes of meshbuffers instead of adding them.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5345 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2016-10-20 14:01:41 +00:00
parent da90582a2b
commit 28d2756b27
2 changed files with 19 additions and 5 deletions

View File

@ -1,6 +1,7 @@
--------------------------
Changes in 1.9 (not yet released)
- Bugfix: SMesh::recalculateBoundingBox() does now ignore empty boundingboxes of meshbuffers instead of adding them.
- IIrrXMLReader::getAttributeValueAsInt and IIrrXMLReader::getAttributeValueAsFloat can now return a custom default-value when the attribute is not found.
- core::string::split now handles ignoreEmptyTokens=false correct. Thanks @manni63 for bugreport: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=51551&p=299375#p299375
- Bugfix: Previously when some material had a texture matrix and another didn't those materials were still considered identical. Which had prevented correct switching between materials with and without texture matrices.

View File

@ -83,13 +83,26 @@ namespace scene
//! recalculates the bounding box
void recalculateBoundingBox()
{
if (MeshBuffers.size())
bool hasMeshBufferBBox = false;
for (u32 i=0; i<MeshBuffers.size(); ++i)
{
BoundingBox = MeshBuffers[0]->getBoundingBox();
for (u32 i=1; i<MeshBuffers.size(); ++i)
BoundingBox.addInternalBox(MeshBuffers[i]->getBoundingBox());
const core::aabbox3df& bb = MeshBuffers[i]->getBoundingBox();
if ( !bb.isEmpty() )
{
if ( !hasMeshBufferBBox )
{
hasMeshBufferBBox = true;
BoundingBox = bb;
}
else
{
BoundingBox.addInternalBox(bb);
}
}
}
else
if ( !hasMeshBufferBBox )
BoundingBox.reset(0.0f, 0.0f, 0.0f);
}