diff --git a/engine.lisp b/engine.lisp index a3fd68e..dda8dca 100644 --- a/engine.lisp +++ b/engine.lisp @@ -80,7 +80,8 @@ (defparameter *rear-thruster-vertices* (make-thruster-vertices '( (0.0 0.5 0.0) (-2.0 -0.5 0.0) (2.0 -0.5 0.0) (0.0 0.0 0.0)) - '( (0.0 0.5 0.0) (-2.0 -0.5 0.0) (2.0 -0.5 0.0) (0.0 0.0 1.5)) + (transform-points (translate-triangle (rotate-triangle *3pyramid-points* (make-rotation-matrix 0 0 0)) (vector 0 0 0.5)) '(4 1 1.5)) + ; '( (0.0 0.5 0.0) (-2.0 -0.5 0.0) (2.0 -0.5 0.0) (0.0 0.0 1.5)) 2)) ; '((0.0 0.5 0.0) (-2.0 -0.5 0.0) (2.0 -0.5 0.0) ; ; z goes from 0 to 1 in 2 seconds diff --git a/math.lisp b/math.lisp index 6f77bfe..a824f26 100644 --- a/math.lisp +++ b/math.lisp @@ -64,11 +64,11 @@ (make-array (length points) :initial-contents (loop for v across points collecting (scale-vector v a)))) ; scale poitns by v (x y z) -(defun transform-points (points x y z) +(defun transform-points (points xyz) (make-array (length points) :initial-contents (loop for v across points collecting (make-array 3 :initial-contents - (list (* (aref v 0) x) (* (aref v 1) y) (* (aref v 2) z)))))) + (list (* (aref v 0) (first xyz)) (* (aref v 1) (second xyz)) (* (aref v 2) (third xyz))))))) ; returns a vector with all elemts scaled to biggest 1 which is scaled to 1 ; e.x. (scale-vector (8 4 2)) -> (1 .5 .25) diff --git a/model.lisp b/model.lisp index 555699a..c41cfc4 100644 --- a/model.lisp +++ b/model.lisp @@ -55,11 +55,11 @@ (3 5 1) (2 5 4) (1 5 2) (4 5 3))))) ; point up along +z (defparameter *3pyramid-points* - '((0.0 0.5 -0.5) (-0.5 -0.5 -0.5) (0.5 -0.5 -0.5) (0.0 0.0 0.5))) + (make-2d-array 4 3 '((0.0 0.5 -0.5) (-0.5 -0.5 -0.5) (0.5 -0.5 -0.5) (0.0 0.0 0.5)))) ; point up along +z, flat facing +y (into) (defparameter *3pyramid-flat-points* - '((0.0 -0.5 -0.5) (0.0 0.5 0.5) (-0.5 -0.5 0.5) (0.5 -0.5 0.5))) + (make-2d-array 4 3 '((0.0 -0.5 -0.5) (0.0 0.5 0.5) (-0.5 -0.5 0.5) (0.5 -0.5 0.5)))) (defparameter *colors* (make-hash-table :test 'equal)) (setf (gethash "red" *colors*) '(255 0 0)) @@ -108,8 +108,8 @@ (defparameter *ship-model* (make-model-3pyramid ;*3pyramid-flat-points* (transform-points - (rotate-triangle (make-2d-array 4 3 *3pyramid-flat-points*) (make-rotation-matrix 0 0 0)) - 4 1 3) + (rotate-triangle *3pyramid-flat-points* (make-rotation-matrix 0 0 0)) + '(4 1 3)) :face-colors '((196 196 196) (196 196 196) (196 196 196) (32 32 32)))) ;(defparameter *ship-model*