From 6e03a586d8f61cc3cd44a8f9e6d3cbcdd18cbb4e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 10 Jan 2017 19:40:16 -0500 Subject: math: matrix: Update to use new vector library. --- chickadee/math/matrix.scm | 34 ++++++++++++---------------------- 1 file 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) -- cgit v1.2.3