summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2017-01-10 19:40:16 -0500
committerDavid Thompson <dthompson2@worcester.edu>2017-01-10 19:43:01 -0500
commit6e03a586d8f61cc3cd44a8f9e6d3cbcdd18cbb4e (patch)
tree6c3c80f8ced825654d6d8289866ed9ee8513a234
parent1d1b0c6f528e5eb4e00f25394bf7e9fbbbdb05ef (diff)
math: matrix: Update to use new vector library.
-rw-r--r--chickadee/math/matrix.scm34
1 files changed, 12 insertions, 22 deletions
diff --git a/chickadee/math/matrix.scm b/chickadee/math/matrix.scm
index be307ab..5c5fdaa 100644
--- a/chickadee/math/matrix.scm
+++ b/chickadee/math/matrix.scm
@@ -250,34 +250,24 @@ column-major format."
for the vertical clipping plane LEFT and RIGHT, the horizontal
clipping plane TOP and BOTTOM, and the depth clipping plane NEAR and
FAR."
- (make-matrix4 (/ 2 (- right left)) 0 0 0
- 0 (/ 2 (- top bottom)) 0 0
- 0 0 (/ 2 (- far near)) 0
+ (make-matrix4 (/ 2 (- right left)) 0.0 0.0 0.0
+ 0.0 (/ 2 (- top bottom)) 0.0 0.0
+ 0.0 0.0 (/ 2 (- far near)) 0.0
(- (/ (+ right left) (- right left)))
(- (/ (+ top bottom) (- top bottom)))
(- (/ (+ far near) (- far near)))
- 1))
+ 1.0))
-(define (matrix4-translate! matrix v)
- (cond
- ((vector2? v)
- (init-matrix4 matrix
- 1 0 0 0
- 0 1 0 0
- 0 0 1 0
- (vx v) (vy v) 0 1))
- ((vector3? v)
- (init-matrix4 matrix
- 1 0 0 0
- 0 1 0 0
- 0 0 1 0
- (vx v) (vy v) (vz v) 1))
- (else
- (error "invalid translation vector" v))))
+(define (matrix4-translate! matrix x y)
+ (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
+ x y 0.0 1.0))
-(define (matrix4-translate v)
+(define (matrix4-translate x y)
(let ((matrix (make-null-matrix4)))
- (matrix4-translate! matrix v)
+ (matrix4-translate! matrix x y)
matrix))
(define (matrix4-scale! matrix s)