Commit 682a1200 authored by hybrid's avatar hybrid

Replaced transformBox by transformBoxEx to avoid major malfunction of the...

Replaced transformBox by transformBoxEx to avoid major malfunction of the transformations when the transformation includes rotations.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1511 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 9e354df0
......@@ -158,7 +158,7 @@ namespace scene
virtual const core::aabbox3d<f32> getTransformedBoundingBox() const
{
core::aabbox3d<f32> box = getBoundingBox();
AbsoluteTransformation.transformBox(box);
AbsoluteTransformation.transformBoxEx(box);
return box;
}
......
......@@ -186,12 +186,12 @@ namespace core
void transformPlane( const core::plane3d<f32> &in, core::plane3d<f32> &out) const;
//! Transforms a axis aligned bounding box
/** The result box of this operation may not be very accurate. For
accurate results, use transformBoxEx() */
/** The result box of this operation may not be accurate at all. For
correct results, use transformBoxEx() */
void transformBox(core::aabbox3d<f32>& box) const;
//! Transforms a axis aligned bounding box more accurately than transformBox()
/** The result box of this operation should by quite accurate, but this operation
//! Transforms a axis aligned bounding box
/** The result box of this operation should by accurate, but this operation
is slower than transformBox(). */
void transformBoxEx(core::aabbox3d<f32>& box) const;
......
......@@ -108,7 +108,6 @@ void COctTreeTriangleSelector::constructOctTree(SOctTreeNode* node)
}
//! Gets all triangles which lie within a specific bounding box.
void COctTreeTriangleSelector::getTriangles(core::triangle3df* triangles,
s32 arraySize, s32& outTriangleCount,
......@@ -122,7 +121,7 @@ void COctTreeTriangleSelector::getTriangles(core::triangle3df* triangles,
{
mat = SceneNode->getAbsoluteTransformation();
mat.makeInverse();
mat.transformBox(invbox);
mat.transformBoxEx(invbox);
}
mat.makeIdentity();
......
......@@ -433,8 +433,7 @@ void CParticleSystemSceneNode::doParticleSystem(u32 time)
}
}
f32 m = ParticleSize.Width > ParticleSize.Height ? ParticleSize.Width : ParticleSize.Height;
m *= 0.5f;
const f32 m = (ParticleSize.Width > ParticleSize.Height ? ParticleSize.Width : ParticleSize.Height) * 0.5f;
Buffer->BoundingBox.MaxEdge.X += m;
Buffer->BoundingBox.MaxEdge.Y += m;
Buffer->BoundingBox.MaxEdge.Z += m;
......@@ -445,9 +444,8 @@ void CParticleSystemSceneNode::doParticleSystem(u32 time)
if (ParticlesAreGlobal)
{
core::matrix4 absinv = AbsoluteTransformation;
absinv.makeInverse();
absinv.transformBox(Buffer->BoundingBox);
core::matrix4 absinv( AbsoluteTransformation, core::matrix4::EM4CONST_INVERSE );
absinv.transformBoxEx(Buffer->BoundingBox);
}
}
......
......@@ -1069,7 +1069,7 @@ bool CSceneManager::isCulled(const ISceneNode* node)
case scene::EAC_BOX:
{
core::aabbox3d<f32> tbox = node->getBoundingBox();
node->getAbsoluteTransformation().transformBox(tbox);
node->getAbsoluteTransformation().transformBoxEx(tbox);
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return !(tbox.intersectsWithBox(cam->getViewFrustum()->getBoundingBox() ));
}
......
......@@ -310,13 +310,12 @@ void CBillboardTextSceneNode::OnRegisterSceneNode()
// make bounding box
for (i=0; i< Mesh->getMeshBufferCount() ; ++i)
((SMeshBuffer*)Mesh->getMeshBuffer(i))->recalculateBoundingBox();
Mesh->getMeshBuffer(i)->recalculateBoundingBox();
Mesh->recalculateBoundingBox();
BBox = Mesh->getBoundingBox();
core::matrix4 mat = getAbsoluteTransformation();
mat.makeInverse();
mat.transformBox(BBox);
core::matrix4 mat( getAbsoluteTransformation(), core::matrix4::EM4CONST_INVERSE );
mat.transformBoxEx(BBox);
SceneManager->registerNodeForRendering(this, ESNRP_TRANSPARENT);
ISceneNode::OnRegisterSceneNode();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment