2020-10-26 21:08:24 -04:00
|
|
|
;;-*-Lisp-*-
|
2020-09-04 14:44:23 -04:00
|
|
|
(in-package goal)
|
|
|
|
|
|
|
|
;; name: mspace-h.gc
|
|
|
|
;; name in dgo: mspace-h
|
|
|
|
;; dgos: GAME, ENGINE
|
|
|
|
|
2021-07-11 16:35:25 -04:00
|
|
|
;; mspace is the skeleton-based animation system.
|
|
|
|
|
2021-02-26 22:22:54 -05:00
|
|
|
(deftype joint (basic)
|
|
|
|
((name basic :offset-assert 4)
|
|
|
|
(number int32 :offset-assert 8)
|
|
|
|
(parent joint :offset-assert 12)
|
|
|
|
(bind-pose matrix :inline :offset-assert 16)
|
|
|
|
)
|
|
|
|
:method-count-assert 9
|
|
|
|
:size-assert #x50
|
|
|
|
:flag-assert #x900000050
|
|
|
|
)
|
|
|
|
|
|
|
|
(deftype bone-cache (structure)
|
|
|
|
((bone-matrix uint32 :offset-assert 0)
|
|
|
|
(parent-matrix uint32 :offset-assert 4)
|
|
|
|
(dummy uint32 :offset-assert 8)
|
|
|
|
(frame uint32 :offset-assert 12)
|
|
|
|
)
|
|
|
|
:method-count-assert 9
|
|
|
|
:size-assert #x10
|
|
|
|
:flag-assert #x900000010
|
|
|
|
)
|
|
|
|
|
|
|
|
(deftype bone (structure)
|
|
|
|
((transform matrix :inline :offset-assert 0)
|
|
|
|
(position vector :inline :offset 48) ;; overlays the matrix
|
|
|
|
(scale vector :inline :offset-assert 64)
|
|
|
|
(cache bone-cache :inline :offset-assert 80)
|
|
|
|
)
|
|
|
|
:method-count-assert 9
|
|
|
|
:size-assert #x60
|
|
|
|
:flag-assert #x900000060
|
|
|
|
)
|
|
|
|
|
|
|
|
(deftype skeleton (inline-array-class)
|
2021-07-11 16:35:25 -04:00
|
|
|
((bones bone :inline :dynamic))
|
2021-02-26 22:22:54 -05:00
|
|
|
:method-count-assert 9
|
|
|
|
:size-assert #x10
|
|
|
|
:flag-assert #x900000010
|
|
|
|
)
|
|
|
|
(set! (-> skeleton heap-base) 96)
|
|
|
|
|
|
|
|
(deftype cspace (structure)
|
2021-06-14 23:45:21 -04:00
|
|
|
((parent cspace :offset-assert 0)
|
|
|
|
(joint joint :offset-assert 4)
|
|
|
|
(joint-num int16 :offset-assert 8)
|
|
|
|
(geo basic :offset-assert 12)
|
|
|
|
(bone bone :offset-assert 16)
|
|
|
|
(param0 function :offset-assert 20)
|
|
|
|
(param1 basic :offset-assert 24)
|
|
|
|
(param2 basic :offset-assert 28)
|
2021-02-26 22:22:54 -05:00
|
|
|
)
|
|
|
|
:method-count-assert 10
|
|
|
|
:size-assert #x20
|
|
|
|
:flag-assert #xa00000020
|
|
|
|
;; params are loaded with signed loads.
|
|
|
|
(:methods
|
2021-06-14 23:45:21 -04:00
|
|
|
(new (symbol type basic) _type_ 0)
|
|
|
|
(dummy-9 (_type_ basic) _type_ 9)
|
2021-02-26 22:22:54 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(deftype cspace-array (inline-array-class)
|
2021-06-05 16:58:32 -04:00
|
|
|
((data cspace :inline :dynamic :offset-assert 16))
|
2021-02-26 22:22:54 -05:00
|
|
|
:method-count-assert 9
|
|
|
|
:size-assert #x10
|
|
|
|
:flag-assert #x900000010
|
|
|
|
)
|
|
|
|
(set! (-> cspace-array heap-base) 32)
|
|
|
|
|
|
|
|
|
|
|
|
(defmethod print cspace ((obj cspace))
|
|
|
|
"Print a cspace, with the attached joint"
|
|
|
|
(format #t "#<cspace ~S @ #x~X>"
|
|
|
|
(if (-> obj joint)
|
|
|
|
(-> obj joint name)
|
|
|
|
"nojoint")
|
|
|
|
obj
|
|
|
|
)
|
|
|
|
obj
|
|
|
|
)
|
|
|
|
|
|
|
|
|