Can often copy instead of multiply matrix in CTriangleSelector

If we already know we start with an identity matrix (which is usually the case) then copy will do.
Also unifying code to create matrix of different CTriangleSelector::getTriangles functions


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6578 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2023-12-13 15:05:08 +00:00
parent 66d189ce63
commit 70b2e3a255
2 changed files with 16 additions and 6 deletions

View File

@ -272,11 +272,17 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
if (cnt > (u32)arraySize) if (cnt > (u32)arraySize)
cnt = (u32)arraySize; cnt = (u32)arraySize;
core::matrix4 mat; core::matrix4 mat(core::matrix4::EM4CONST_NOTHING);
if (transform) if (transform)
{
mat = *transform; mat = *transform;
if (SceneNode&&useNodeTransform) if (SceneNode && useNodeTransform)
mat *= SceneNode->getAbsoluteTransformation(); mat *= SceneNode->getAbsoluteTransformation();
}
else if (SceneNode && useNodeTransform)
mat = SceneNode->getAbsoluteTransformation();
else
mat.makeIdentity();
for (u32 i=0; i<cnt; ++i) for (u32 i=0; i<cnt; ++i)
{ {
@ -338,11 +344,15 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles,
core::matrix4 mat(core::matrix4::EM4CONST_NOTHING); core::matrix4 mat(core::matrix4::EM4CONST_NOTHING);
if (transform) if (transform)
{
mat = *transform; mat = *transform;
if (SceneNode && useNodeTransform)
mat *= SceneNode->getAbsoluteTransformation();
}
else if (SceneNode && useNodeTransform)
mat = SceneNode->getAbsoluteTransformation();
else else
mat.makeIdentity(); mat.makeIdentity();
if (SceneNode && useNodeTransform)
mat *= SceneNode->getAbsoluteTransformation();
core::aabbox3df tBox(box); core::aabbox3df tBox(box);
core::matrix4 invMat(core::matrix4::EM4CONST_NOTHING); core::matrix4 invMat(core::matrix4::EM4CONST_NOTHING);

View File

@ -1,4 +1,4 @@
Tests finished. 72 tests of 72 passed. Tests finished. 72 tests of 72 passed.
Compiled as DEBUG Compiled as DEBUG
Test suite pass at GMT Wed Dec 13 14:06:37 2023 Test suite pass at GMT Wed Dec 13 15:00:54 2023