From 14eebd305e1d04203070329f73f71e7556ce039d Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 5 May 2021 20:19:05 -0400 Subject: math: matrix: Add vec3 support to matrix4-scale! --- chickadee/math/matrix.scm | 19 ++++++++++++++----- 1 file 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))) -- cgit v1.2.3