mirror of
https://github.com/open-goal/jak-project
synced 2026-05-26 23:47:57 -04:00
108 lines
3.2 KiB
Common Lisp
Vendored
Generated
108 lines
3.2 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type matrix
|
|
(deftype matrix (structure)
|
|
"A 4x4 matrix, stored in row-major order.
|
|
some, but not all, functions assume that a matrix is an affine transform.
|
|
others assume that the rotation has no scale or shear (and that its inverse is its transpose)."
|
|
((data float 16)
|
|
(vector vector 4 :inline :overlay-at (-> data 0))
|
|
(quad uint128 4 :overlay-at (-> data 0))
|
|
(trans vector :inline :overlay-at (-> data 12))
|
|
)
|
|
(:methods
|
|
(transform-vectors! (_type_ (inline-array vector) (inline-array vector) int) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type matrix
|
|
;; INFO: this function exists in multiple non-identical object files
|
|
(defmethod inspect ((this matrix))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'matrix)
|
|
(format #t "~1Tdata[16] @ #x~X~%" (-> this vector))
|
|
(format #t "~1Tvector[4] @ #x~X~%" (-> this vector))
|
|
(format #t "~1Tquad[4] @ #x~X~%" (-> this vector))
|
|
(format #t "~1Ttrans: #<vector @ #x~X>~%" (-> this trans))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type matrix3
|
|
(deftype matrix3 (structure)
|
|
"A 3x3 matrix, stored in row-major order.
|
|
NOTE: the rows each have an extra 4-bytes of padding,
|
|
so this is really a 3x4 matrix.
|
|
This type is rarely used."
|
|
((data float 12)
|
|
(vector vector 3 :inline :overlay-at (-> data 0))
|
|
(quad uint128 3 :overlay-at (-> data 0))
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type matrix3
|
|
;; INFO: this function exists in multiple non-identical object files
|
|
(defmethod inspect ((this matrix3))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'matrix3)
|
|
(format #t "~1Tdata[12] @ #x~X~%" (-> this vector))
|
|
(format #t "~1Tvector[3] @ #x~X~%" (-> this vector))
|
|
(format #t "~1Tquad[3] @ #x~X~%" (-> this vector))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type matrix4h
|
|
(deftype matrix4h (structure)
|
|
"A matrix stored using 16-bit integers.
|
|
Note that these usually have different scaling for the 4th row which
|
|
contains the translation in an affine transform.
|
|
So you generally should not unpack these to floats without knowing where they came from
|
|
and how they were originally packed (for example, in tie/shrub)."
|
|
((data int16 16)
|
|
(vector4h vector4h 4 :inline :overlay-at (-> data 0))
|
|
(long int64 4 :overlay-at (-> data 0))
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type matrix4h
|
|
(defmethod inspect ((this matrix4h))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'matrix4h)
|
|
(format #t "~1Tdata[16] @ #x~X~%" (-> this data))
|
|
(format #t "~1Tvector4h[4] @ #x~X~%" (-> this data))
|
|
(format #t "~1Tlong[4] @ #x~X~%" (-> this data))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for function matrix-copy!
|
|
;; INFO: Used lq/sq
|
|
(defun matrix-copy! ((arg0 matrix) (arg1 matrix))
|
|
"Copy arg1 to arg0"
|
|
(let ((v1-0 (-> arg1 quad 0))
|
|
(a2-0 (-> arg1 quad 1))
|
|
(a3-0 (-> arg1 quad 2))
|
|
(a1-1 (-> arg1 trans quad))
|
|
)
|
|
(set! (-> arg0 quad 0) v1-0)
|
|
(set! (-> arg0 quad 1) a2-0)
|
|
(set! (-> arg0 quad 2) a3-0)
|
|
(set! (-> arg0 trans quad) a1-1)
|
|
)
|
|
arg0
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
0
|