mirror of
https://github.com/minetest/irrlicht.git
synced 2025-06-29 23:00:34 +02:00
Bugfix: CTriangleSelector::getTriangles with bbox no longer ignores transform matrix
So far it only used the inverse of the node transformation to calculate the box used to check Which gave wrong results as soon as one tried to pass an additional matrix transformation Wasn't ever used internally or by examples in Irrlicht, so I guess no one ever noticed (also in some cases this still worked accidentally). git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6577 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@ -337,20 +337,6 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
|
||||
update();
|
||||
|
||||
core::matrix4 mat(core::matrix4::EM4CONST_NOTHING);
|
||||
core::aabbox3df tBox(box);
|
||||
|
||||
if (SceneNode && useNodeTransform)
|
||||
{
|
||||
if ( SceneNode->getAbsoluteTransformation().getInverse(mat) )
|
||||
mat.transformBoxEx(tBox);
|
||||
else
|
||||
{
|
||||
// TODO: else is not yet handled optimally.
|
||||
// If a node has an axis scaled to 0 we return all triangles without any check
|
||||
return getTriangles(triangles, arraySize, outTriangleCount,
|
||||
transform, useNodeTransform, outTriangleInfo );
|
||||
}
|
||||
}
|
||||
if (transform)
|
||||
mat = *transform;
|
||||
else
|
||||
@ -358,6 +344,20 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
|
||||
if (SceneNode && useNodeTransform)
|
||||
mat *= SceneNode->getAbsoluteTransformation();
|
||||
|
||||
core::aabbox3df tBox(box);
|
||||
core::matrix4 invMat(core::matrix4::EM4CONST_NOTHING);
|
||||
if ( mat.getInverse(invMat) )
|
||||
{
|
||||
invMat.transformBoxEx(tBox);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: else is not yet handled optimally.
|
||||
// If a node has an axis scaled to 0 we return all triangles without any check
|
||||
return getTriangles(triangles, arraySize, outTriangleCount,
|
||||
transform, useNodeTransform, outTriangleInfo );
|
||||
}
|
||||
|
||||
outTriangleCount = 0;
|
||||
|
||||
if (!tBox.intersectsWithBox(BoundingBox))
|
||||
|
Reference in New Issue
Block a user