2020-10-26 21:08:24 -04:00
|
|
|
;;-*-Lisp-*-
|
2020-09-04 14:44:23 -04:00
|
|
|
(in-package goal)
|
|
|
|
|
|
|
|
;; name: transformq-h.gc
|
|
|
|
;; name in dgo: transformq-h
|
|
|
|
;; dgos: GAME, ENGINE
|
|
|
|
|
2021-02-13 11:32:52 -05:00
|
|
|
;; transforms, but using quaternions to represent rotations.
|
|
|
|
|
|
|
|
(deftype transformq (transform)
|
|
|
|
;; this overlays the rot field of transform.
|
|
|
|
((quat quaternion :inline :offset 16)
|
|
|
|
)
|
|
|
|
:method-count-assert 9
|
|
|
|
:size-assert #x30
|
|
|
|
:flag-assert #x900000030
|
|
|
|
)
|
|
|
|
|
|
|
|
(deftype trsq (trs)
|
|
|
|
;; this overlays the rot field of trs.
|
|
|
|
((quat quaternion :inline :offset 32)
|
|
|
|
)
|
|
|
|
:method-count-assert 9
|
|
|
|
:size-assert #x40
|
|
|
|
:flag-assert #x900000040
|
|
|
|
)
|
|
|
|
|
|
|
|
;; Representing a translate/rotate/scale with a quaternion and a velocity.
|
2021-05-16 12:43:50 -04:00
|
|
|
;; definition of type trsqv
|
2021-02-13 11:32:52 -05:00
|
|
|
(deftype trsqv (trsq)
|
2021-05-16 12:43:50 -04:00
|
|
|
((pause-adjust-distance float :offset 4)
|
|
|
|
(nav-radius float :offset 8)
|
|
|
|
(transv vector :inline :offset-assert 64)
|
|
|
|
(rotv vector :inline :offset-assert 80)
|
|
|
|
(scalev vector :inline :offset-assert 96)
|
|
|
|
(dir-targ quaternion :inline :offset-assert 112)
|
|
|
|
(angle-change-time uint64 :offset-assert 128)
|
|
|
|
(old-y-angle-diff float :offset-assert 136)
|
2021-02-13 11:32:52 -05:00
|
|
|
)
|
|
|
|
:method-count-assert 28
|
|
|
|
:size-assert #x8c
|
|
|
|
:flag-assert #x1c0000008c
|
|
|
|
(:methods
|
2021-05-16 12:43:50 -04:00
|
|
|
(TODO-RENAME-9 (_type_ vector float int) quaternion 9)
|
|
|
|
(TODO-RENAME-10 (_type_ vector) quaternion 10)
|
|
|
|
(TODO-RENAME-11 (_type_ vector float int) quaternion 11)
|
|
|
|
(TODO-RENAME-12 (_type_ vector) quaternion 12)
|
|
|
|
(TODO-RENAME-13 (_type_ float float int) quaternion 13)
|
|
|
|
(TODO-RENAME-14 (_type_ float) quaternion 14)
|
|
|
|
(TODO-RENAME-15 (_type_ float) quaternion 15)
|
|
|
|
(TODO-RENAME-VECTOR-DOT-16 (_type_ float) quaternion 16)
|
|
|
|
(TODO-RENAME-17 (_type_ quaternion float float) quaternion 17)
|
|
|
|
(set-quaternion!-18 (_type_ quaternion) quaternion 18)
|
|
|
|
(TODO-RENAME-19 (_type_ vector) quaternion 19)
|
|
|
|
(TODO-RENAME-20 (_type_ vector) quaternion 20)
|
|
|
|
(rot->dir-targ!-21 (_type_) quaternion 21)
|
|
|
|
(y-angle (_type_) float 22)
|
|
|
|
(global-y-angle-to-point (_type_ vector) float 23)
|
|
|
|
(relative-y-angle-to-point (_type_ vector) float 24)
|
|
|
|
(TODO-VECTOR-MATH-ISSUES-25 (_type_) float 25)
|
|
|
|
(dummy-26 () none 26)
|
|
|
|
(get-quaternion (_type_) quaternion 27)
|
|
|
|
)
|
2021-05-15 10:38:14 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod global-y-angle-to-point trsqv ((obj trsqv) (arg0 vector))
|
|
|
|
"Get the angle from the position of this trsqv to the point arg0."
|
|
|
|
(rlet ((vf0 :class vf)
|
|
|
|
(vf4 :class vf)
|
|
|
|
(vf5 :class vf)
|
|
|
|
(vf6 :class vf)
|
|
|
|
)
|
2021-05-16 13:49:24 -04:00
|
|
|
(init-vf0-vector)
|
2021-05-15 10:38:14 -04:00
|
|
|
(vector-y-angle
|
|
|
|
(vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans))
|
|
|
|
)
|
2021-02-13 11:32:52 -05:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2021-05-15 10:38:14 -04:00
|
|
|
(defmethod relative-y-angle-to-point trsqv ((obj trsqv) (arg0 vector))
|
|
|
|
"Get the y angle between here and arg0, starting at whatever angle we're currently at."
|
|
|
|
(rlet ((vf0 :class vf)
|
|
|
|
(vf4 :class vf)
|
|
|
|
(vf5 :class vf)
|
|
|
|
(vf6 :class vf)
|
|
|
|
)
|
2021-05-16 13:49:24 -04:00
|
|
|
(init-vf0-vector)
|
2021-05-15 10:38:14 -04:00
|
|
|
|
|
|
|
(deg-diff
|
|
|
|
(y-angle obj)
|
|
|
|
(vector-y-angle (vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans)))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|