summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/math/matrix.scm18
1 files changed, 13 insertions, 5 deletions
diff --git a/chickadee/math/matrix.scm b/chickadee/math/matrix.scm
index 1d59674..b257069 100644
--- a/chickadee/math/matrix.scm
+++ b/chickadee/math/matrix.scm
@@ -297,11 +297,19 @@ clipping plane NEAR and FAR."
0 0 (/ (* 2 far near) (- near far)) 0)))
(define (matrix4-translate! matrix v)
- (init-matrix4 matrix
- 1.0 0.0 0.0 0.0
- 0.0 1.0 0.0 0.0
- 0.0 0.0 1.0 0.0
- (vec2-x v) (vec2-y v) 0.0 1.0))
+ (cond
+ ((vec2? v)
+ (init-matrix4 matrix
+ 1.0 0.0 0.0 0.0
+ 0.0 1.0 0.0 0.0
+ 0.0 0.0 1.0 0.0
+ (vec2-x v) (vec2-y v) 0.0 1.0))
+ ((vec3? v)
+ (init-matrix4 matrix
+ 1.0 0.0 0.0 0.0
+ 0.0 1.0 0.0 0.0
+ 0.0 0.0 1.0 0.0
+ (vec3-x v) (vec3-y v) (vec3-z v) 1.0))))
(define (matrix4-translate v)
(let ((matrix (make-null-matrix4)))