diff options
author | David Thompson <dthompson2@worcester.edu> | 2021-05-05 20:19:05 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2021-05-05 20:19:05 -0400 |
commit | 14eebd305e1d04203070329f73f71e7556ce039d (patch) | |
tree | 2356000600a926cf79f832da26156acd221efed7 | |
parent | d04b3a83883dc4313addd8171c194524873ffe05 (diff) |
math: matrix: Add vec3 support to matrix4-scale!
-rw-r--r-- | chickadee/math/matrix.scm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/chickadee/math/matrix.scm b/chickadee/math/matrix.scm index 0f1e523..dfc3cc1 100644 --- a/chickadee/math/matrix.scm +++ b/chickadee/math/matrix.scm @@ -567,11 +567,20 @@ clipping plane NEAR and FAR." matrix)) (define (matrix4-scale! matrix s) - (init-matrix4 matrix - s 0.0 0.0 0.0 - 0.0 s 0.0 0.0 - 0.0 0.0 s 0.0 - 0.0 0.0 0.0 1.0)) + (if (vec3? s) + (let ((x (vec3-x s)) + (y (vec3-y s)) + (z (vec3-z s))) + (init-matrix4 matrix + x 0.0 0.0 0.0 + 0.0 y 0.0 0.0 + 0.0 0.0 z 0.0 + 0.0 0.0 0.0 1.0)) + (init-matrix4 matrix + s 0.0 0.0 0.0 + 0.0 s 0.0 0.0 + 0.0 0.0 s 0.0 + 0.0 0.0 0.0 1.0))) (define (matrix4-scale s) (let ((matrix (make-null-matrix4))) |