From 09ca74f15f987f2214dd567fc54a7a8d4f01295a Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 24 Oct 2022 17:29:55 -0400 Subject: node-2d: Improve speed of root node world matrix calculation. --- catbird/node-2d.scm | 9 +++++---- 1 file 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 ) - (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) -- cgit v1.2.3