diff options
author | David Thompson <dthompson@vistahigherlearning.com> | 2022-10-24 17:29:55 -0400 |
---|---|---|
committer | David Thompson <dthompson@vistahigherlearning.com> | 2022-10-24 17:29:55 -0400 |
commit | 09ca74f15f987f2214dd567fc54a7a8d4f01295a (patch) | |
tree | 5534ea3bbca9f02940dff28f4b6f95ef65a2ad08 | |
parent | 3c29d6e7f6215330a420c560a1689ddb3d42c8c1 (diff) |
node-2d: Improve speed of root node world matrix calculation.
-rw-r--r-- | catbird/node-2d.scm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/catbird/node-2d.scm b/catbird/node-2d.scm index 47749cc..a7fcda8 100644 --- a/catbird/node-2d.scm +++ b/catbird/node-2d.scm @@ -152,11 +152,12 @@ (define (refresh-world-matrix node world) (let ((p (parent node)) (local (local-matrix node))) + ;; If the parent isn't a 2D node, then we consider this to be a + ;; root node, which means the world matrix is the same as the + ;; local matrix. (if (is-a? p <node-2d>) - (matrix4-mult! world local (world-matrix (parent node))) - (begin - (matrix4-identity! world) - (matrix4-mult! world world local))) + (matrix4-mult! world local (world-matrix p)) + (matrix4-copy! local world)) world)) (define (refresh-inverse-world-matrix node inverse) |