From 70b2e3a255273129e300d1edf306a8a2db843553 Mon Sep 17 00:00:00 2001 From: cutealien Date: Wed, 13 Dec 2023 15:05:08 +0000 Subject: [PATCH] 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 --- source/Irrlicht/CTriangleSelector.cpp | 20 +++++++++++++++----- tests/tests-last-passed-at.txt | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/source/Irrlicht/CTriangleSelector.cpp b/source/Irrlicht/CTriangleSelector.cpp index d02f2572..0cf500a4 100644 --- a/source/Irrlicht/CTriangleSelector.cpp +++ b/source/Irrlicht/CTriangleSelector.cpp @@ -272,11 +272,17 @@ void CTriangleSelector::getTriangles(core::triangle3df* triangles, if (cnt > (u32)arraySize) cnt = (u32)arraySize; - core::matrix4 mat; + core::matrix4 mat(core::matrix4::EM4CONST_NOTHING); if (transform) + { mat = *transform; - if (SceneNode&&useNodeTransform) - mat *= SceneNode->getAbsoluteTransformation(); + if (SceneNode && useNodeTransform) + mat *= SceneNode->getAbsoluteTransformation(); + } + else if (SceneNode && useNodeTransform) + mat = SceneNode->getAbsoluteTransformation(); + else + mat.makeIdentity(); for (u32 i=0; igetAbsoluteTransformation(); + } + else if (SceneNode && useNodeTransform) + mat = SceneNode->getAbsoluteTransformation(); else mat.makeIdentity(); - if (SceneNode && useNodeTransform) - mat *= SceneNode->getAbsoluteTransformation(); core::aabbox3df tBox(box); core::matrix4 invMat(core::matrix4::EM4CONST_NOTHING); diff --git a/tests/tests-last-passed-at.txt b/tests/tests-last-passed-at.txt index ee7e9c09..661557bc 100644 --- a/tests/tests-last-passed-at.txt +++ b/tests/tests-last-passed-at.txt @@ -1,4 +1,4 @@ Tests finished. 72 tests of 72 passed. 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