summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)