porting thruster model to new primitive generation code

This commit is contained in:
Dan Ballard 2012-06-19 23:28:11 -07:00
parent 086ef7f600
commit a29f16e697
3 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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)

View File

@ -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*