;;-*-Lisp-*- (in-package goal) ;; name: transformq-h.gc ;; name in dgo: transformq-h ;; dgos: GAME, ENGINE ;; 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. ;; definition of type trsqv (deftype trsqv (trsq) ((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) ) :method-count-assert 28 :size-assert #x8c :flag-assert #x1c0000008c (:methods (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) ) ) (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) ) (init-vf0-vector) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans)) ) ) ) (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) ) (init-vf0-vector) (deg-diff (y-angle obj) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) arg0 (-> obj trans))) ) ) )