mirror of
https://github.com/open-goal/jak-project
synced 2026-06-27 19:02:59 -04:00
236 lines
6.5 KiB
Common Lisp
Vendored
Generated
236 lines
6.5 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type curve
|
|
(deftype curve (structure)
|
|
((cverts (inline-array vector))
|
|
(num-cverts int32)
|
|
(knots (pointer float))
|
|
(num-knots int32)
|
|
(length float)
|
|
)
|
|
:allow-misaligned
|
|
)
|
|
|
|
;; definition for method 3 of type curve
|
|
(defmethod inspect ((this curve))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'curve)
|
|
(format #t "~1Tcverts: #x~X~%" (-> this cverts))
|
|
(format #t "~1Tnum-cverts: ~D~%" (-> this num-cverts))
|
|
(format #t "~1Tknots: #x~X~%" (-> this knots))
|
|
(format #t "~1Tnum-knots: ~D~%" (-> this num-knots))
|
|
(format #t "~1Tlength: ~f~%" (-> this length))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type line-intersection-val
|
|
(deftype line-intersection-val (structure)
|
|
((tt0 float)
|
|
(tt1 float)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type line-intersection-val
|
|
(defmethod inspect ((this line-intersection-val))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'line-intersection-val)
|
|
(format #t "~1Ttt0: ~f~%" (-> this tt0))
|
|
(format #t "~1Ttt1: ~f~%" (-> this tt1))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type border-plane
|
|
(deftype border-plane (basic)
|
|
((name symbol)
|
|
(action basic)
|
|
(slot int8)
|
|
(trans vector :inline)
|
|
(normal vector :inline)
|
|
)
|
|
(:methods
|
|
(debug-draw (_type_) int)
|
|
(point-past-plane? (_type_ vector) symbol)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type border-plane
|
|
(defmethod inspect ((this border-plane))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~1Tname: ~A~%" (-> this name))
|
|
(format #t "~1Taction: ~A~%" (-> this action))
|
|
(format #t "~1Tslot: ~D~%" (-> this slot))
|
|
(format #t "~1Ttrans: ~`vector`P~%" (-> this trans))
|
|
(format #t "~1Tnormal: ~`vector`P~%" (-> this normal))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type lissajous
|
|
(deftype lissajous (structure)
|
|
"A curve where the x and y position are set by two different sinusoids.
|
|
This stores the parameters and state for evaluating this curve."
|
|
((x-mag float)
|
|
(y-mag float)
|
|
(theta float)
|
|
(wx float)
|
|
(wy float)
|
|
(period-shift float)
|
|
(theta-rate float)
|
|
)
|
|
:pack-me
|
|
(:methods
|
|
(evaluate! (_type_ vector) vector)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type lissajous
|
|
(defmethod inspect ((this lissajous))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'lissajous)
|
|
(format #t "~1Tx-mag: ~f~%" (-> this x-mag))
|
|
(format #t "~1Ty-mag: ~f~%" (-> this y-mag))
|
|
(format #t "~1Ttheta: ~f~%" (-> this theta))
|
|
(format #t "~1Twx: ~f~%" (-> this wx))
|
|
(format #t "~1Twy: ~f~%" (-> this wy))
|
|
(format #t "~1Tperiod-shift: ~f~%" (-> this period-shift))
|
|
(format #t "~1Ttheta-rate: ~f~%" (-> this theta-rate))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type lissajous-interp
|
|
(deftype lissajous-interp (structure)
|
|
"Handles interpolating between two different lissajous parameters, and also
|
|
stepping forward the dynamics."
|
|
((current lissajous :inline)
|
|
(dest lissajous :inline)
|
|
(rate lissajous :inline)
|
|
)
|
|
(:methods
|
|
(evaluate! (_type_ vector) vector)
|
|
(update! (_type_) float)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type lissajous-interp
|
|
(defmethod inspect ((this lissajous-interp))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'lissajous-interp)
|
|
(format #t "~1Tcurrent: #<lissajous @ #x~X>~%" (-> this current))
|
|
(format #t "~1Tdest: #<lissajous @ #x~X>~%" (-> this dest))
|
|
(format #t "~1Trate: #<lissajous @ #x~X>~%" (-> this rate))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type ellipsoid
|
|
(deftype ellipsoid (vector)
|
|
((width float :overlay-at (-> data 0))
|
|
(height float :overlay-at (-> data 1))
|
|
(length float :overlay-at (-> data 2))
|
|
(h float :overlay-at (-> data 1))
|
|
(l float :overlay-at (-> data 2))
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type ellipsoid
|
|
;; INFO: Used lq/sq
|
|
(defmethod inspect ((this ellipsoid))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'ellipsoid)
|
|
(format #t "~1Tdata[4] @ #x~X~%" (-> this data))
|
|
(format #t "~1Tx: ~f~%" (-> this x))
|
|
(format #t "~1Ty: ~f~%" (-> this y))
|
|
(format #t "~1Tz: ~f~%" (-> this z))
|
|
(format #t "~1Tw: ~f~%" (-> this w))
|
|
(format #t "~1Tquad: ~D~%" (-> this quad))
|
|
(format #t "~1Theight: ~f~%" (-> this y))
|
|
(format #t "~1Twidth: ~f~%" (-> this x))
|
|
(format #t "~1Tlength: ~f~%" (-> this z))
|
|
(format #t "~1Th: ~f~%" (-> this y))
|
|
(format #t "~1Tw: ~f~%" (-> this w))
|
|
(format #t "~1Tl: ~f~%" (-> this z))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for function point-in-ellipsoid?
|
|
(defun point-in-ellipsoid? ((arg0 ellipsoid) (arg1 vector))
|
|
(let ((v1-1 (vector*! (new 'stack-no-clear 'vector) arg1 arg1)))
|
|
(+ (/ (-> v1-1 x) (square (-> arg0 w)))
|
|
(/ (-> v1-1 y) (square (-> arg0 y)))
|
|
(/ (-> v1-1 z) (square (-> arg0 z)))
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function ellipsoid-random-point-on!
|
|
(defun ellipsoid-random-point-on! ((arg0 ellipsoid) (arg1 vector))
|
|
(let ((s5-0 (new 'stack-no-clear 'vector))
|
|
(s4-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(let* ((s2-0 sincos-rad!)
|
|
(s1-0 s5-0)
|
|
(f30-0 -3.1415925)
|
|
(f28-0 6.283185)
|
|
(v1-3 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
|
|
(v1-4 (the-as number (logior #x3f800000 v1-3)))
|
|
)
|
|
(s2-0 s1-0 (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-4)))))
|
|
)
|
|
(let* ((s2-1 sincos-rad!)
|
|
(s1-1 s4-0)
|
|
(f30-1 -1.5707963)
|
|
(f28-1 3.1415925)
|
|
(v1-9 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
|
|
(v1-10 (the-as number (logior #x3f800000 v1-9)))
|
|
)
|
|
(s2-1 s1-1 (+ f30-1 (* f28-1 (+ -1.0 (the-as float v1-10)))))
|
|
)
|
|
(set! (-> arg1 x) (* (-> arg0 w) (-> s4-0 y) (-> s5-0 x)))
|
|
(set! (-> arg1 y) (* (-> arg0 y) (-> s4-0 x)))
|
|
(set! (-> arg1 z) (* (-> arg0 z) (-> s4-0 y) (-> s5-0 y)))
|
|
)
|
|
arg1
|
|
)
|
|
|
|
;; definition for function ellipsoid-normal-at!
|
|
(defun ellipsoid-normal-at! ((arg0 ellipsoid) (arg1 vector) (arg2 vector))
|
|
(let ((v0-0 arg1))
|
|
(set! (-> v0-0 x) (/ (-> arg2 x) (square (-> arg0 w))))
|
|
(set! (-> v0-0 y) (/ (-> arg2 y) (square (-> arg0 y))))
|
|
(set! (-> v0-0 z) (/ (-> arg2 z) (square (-> arg0 z))))
|
|
(set! (-> v0-0 w) 1.0)
|
|
v0-0
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
0
|
|
|
|
|
|
|
|
|