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.
|
|
|
|
(deftype trsqv (trsq)
|
|
|
|
((pause-adjust-distance float :offset 4) ;; todo meters
|
|
|
|
(nav-radius float :offset 8) ;; todo meters
|
|
|
|
(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)
|
|
|
|
)
|
|
|
|
:method-count-assert 28
|
|
|
|
:size-assert #x8c
|
|
|
|
:flag-assert #x1c0000008c
|
|
|
|
(:methods
|
2021-05-15 10:38:14 -04:00
|
|
|
(dummy-9 () none 9)
|
|
|
|
(dummy-10 () none 10)
|
|
|
|
(dummy-11 () none 11)
|
|
|
|
(dummy-12 () none 12)
|
|
|
|
(dummy-13 () none 13)
|
|
|
|
(dummy-14 () none 14)
|
|
|
|
(dummy-15 () none 15)
|
|
|
|
(dummy-16 () none 16)
|
|
|
|
(dummy-17 () none 17)
|
|
|
|
(dummy-18 () none 18)
|
|
|
|
(dummy-19 () none 19)
|
|
|
|
(dummy-20 () none 20)
|
|
|
|
(dummy-21 () none 21)
|
|
|
|
(y-angle (_type_) float 22)
|
|
|
|
(global-y-angle-to-point (_type_ vector) float 23)
|
|
|
|
(relative-y-angle-to-point (_type_ vector) float 24)
|
|
|
|
(dummy-25 () none 25)
|
|
|
|
(dummy-26 () none 26)
|
|
|
|
(get-quaternion (_type_) quaternion 27)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(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)
|
|
|
|
)
|
|
|
|
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
|
|
|
|
(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)
|
|
|
|
)
|
|
|
|
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
|
|
|
|
|
|
|
|
(deg-diff
|
|
|
|
(y-angle obj)
|
|
|
|
(vector-y-angle (vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans)))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|