mirror of
https://github.com/open-goal/jak-project
synced 2026-07-09 06:53:45 -04:00
a3e004f475
Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
935 lines
34 KiB
Common Lisp
935 lines
34 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: manipulator.gc
|
|
;; name in dgo: manipulator
|
|
;; dgos: ENGINE, GAME
|
|
|
|
;; +++manipulator-action
|
|
(defenum manipulator-action
|
|
:type uint32
|
|
(manip-action0 0)
|
|
(manip-action1 1)
|
|
(manip-action2 2)
|
|
(manip-action3 3)
|
|
(manip-action4 4)
|
|
(manip-action5 5)
|
|
(manip-action6 6)
|
|
(manip-action7 7)
|
|
)
|
|
;; ---manipulator-action
|
|
|
|
|
|
;; +++manipulator-mode
|
|
(defenum manipulator-mode
|
|
:type uint32
|
|
(manip-mode0 0)
|
|
(manip-mode1 1)
|
|
)
|
|
;; ---manipulator-mode
|
|
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
;; this file is debug only
|
|
(declare-file (debug))
|
|
|
|
(deftype manipulator (structure)
|
|
((action manipulator-action)
|
|
(mode manipulator-mode)
|
|
(dragging? symbol)
|
|
(position vector :inline)
|
|
(speed vector :inline)
|
|
(drag-ref-position vector :inline)
|
|
(mouse-ref-position vector :inline)
|
|
(mat matrix :inline)
|
|
(rotate-ref int32)
|
|
(angles euler-angles :inline)
|
|
)
|
|
(:methods
|
|
(set-mode (_type_ manipulator-mode) none)
|
|
(manipulator-method-10 (_type_ vector vector) none)
|
|
(manipulator-method-11 (_type_) none)
|
|
(drag-update! (_type_ vector) none)
|
|
(manipulator-method-13 (_type_ vector vector) none)
|
|
(stop-dragging! (_type_) none)
|
|
)
|
|
)
|
|
|
|
|
|
(defun draw-axis ((arg0 vector) (arg1 vector) (arg2 float) (arg3 float) (arg4 rgba))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let ((s1-0 (new 'stack-no-clear 'vector)))
|
|
(cond
|
|
((< (fabs (vector-dot arg1 *x-vector*)) 0.5)
|
|
(vector-cross! s1-0 *x-vector* arg1)
|
|
)
|
|
((< (fabs (vector-dot arg1 *y-vector*)) 0.5)
|
|
(vector-cross! s1-0 *y-vector* arg1)
|
|
)
|
|
(else
|
|
(vector-cross! s1-0 *z-vector* arg1)
|
|
)
|
|
)
|
|
(vector-cross! s1-0 s1-0 arg1)
|
|
(vector-normalize! s1-0 1.0)
|
|
(let ((s0-0 (new 'stack-no-clear 'vector)))
|
|
(let ((v1-10 arg0))
|
|
(let ((a0-8 arg1))
|
|
(let ((a1-10 arg2))
|
|
(.mov vf7 a1-10)
|
|
)
|
|
(.lvf vf5 (&-> a0-8 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-10 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> s0-0 quad) vf6)
|
|
(let ((sv-160 0))
|
|
(while (< sv-160 8)
|
|
(let ((sv-176 add-debug-flat-triangle-noclip)
|
|
(sv-192 #t)
|
|
(sv-208 794)
|
|
(sv-224 (new 'stack-no-clear 'vector))
|
|
)
|
|
(let ((v1-16 s0-0))
|
|
(let ((a0-9 arg1))
|
|
(let ((a1-11 arg3))
|
|
(.mov vf7 a1-11)
|
|
)
|
|
(.lvf vf5 (&-> a0-9 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-16 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> sv-224 quad) vf6)
|
|
(let ((sv-256 (new 'stack-no-clear 'vector)))
|
|
(let ((sv-240 s0-0))
|
|
(let* ((a2-3
|
|
(quaternion-vector-angle! (new 'stack-no-clear 'quaternion) arg1 (* 182.04445 (the float (* 45 sv-160))))
|
|
)
|
|
(v1-22 (vector-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 a2-3))
|
|
)
|
|
(let ((a0-13 (/ arg3 4)))
|
|
(.mov vf7 a0-13)
|
|
)
|
|
(.lvf vf5 (&-> v1-22 quad))
|
|
)
|
|
(.lvf vf4 (&-> sv-240 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> sv-256 quad) vf6)
|
|
(let ((sv-288 (new 'stack-no-clear 'vector)))
|
|
(let ((sv-272 s0-0))
|
|
(let* ((a2-7 (quaternion-vector-angle!
|
|
(new 'stack-no-clear 'quaternion)
|
|
arg1
|
|
(* 182.04445 (the float (* 45 (+ sv-160 1))))
|
|
)
|
|
)
|
|
(v1-29 (vector-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 a2-7))
|
|
)
|
|
(let ((a0-17 (/ arg3 4)))
|
|
(.mov vf7 a0-17)
|
|
)
|
|
(.lvf vf5 (&-> v1-29 quad))
|
|
)
|
|
(.lvf vf4 (&-> sv-272 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> sv-288 quad) vf6)
|
|
(sv-176 (the-as vector sv-192) (the-as vector sv-208) sv-224 sv-256 sv-288)
|
|
)
|
|
)
|
|
)
|
|
(+! sv-160 1)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(add-debug-vector #t (bucket-id bucket794) arg0 arg1 arg2 arg4)
|
|
)
|
|
)
|
|
|
|
(defmethod set-mode ((this manipulator) (arg0 manipulator-mode))
|
|
(set! (-> this mode) arg0)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod manipulator-method-10 ((this manipulator) (arg0 vector) (arg1 vector))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(let* ((sv-16 (-> this position))
|
|
(sv-20 0.0)
|
|
(sv-48 (vector-normalize!
|
|
(vector-! (new 'stack-no-clear 'vector) (-> (view-get-active-math-camera) trans) (-> this position))
|
|
1.0
|
|
)
|
|
)
|
|
(sv-52 (< (fabs (vector-dot sv-48 (-> this mat rvec))) 0.9))
|
|
(sv-56 (< (fabs (vector-dot sv-48 (-> this mat uvec))) 0.9))
|
|
(sv-60 (< (fabs (vector-dot sv-48 (-> this mat fvec))) 0.9))
|
|
(sv-64 (the-as float #x7f800000))
|
|
)
|
|
(set! sv-20 (* 0.15 (vector-vector-distance (-> (view-get-active-math-camera) trans) sv-16)))
|
|
(set! (-> this action) (manipulator-action manip-action0))
|
|
(let ((s4-2 (new 'stack-no-clear 'vector)))
|
|
0.0
|
|
(let ((s3-3 (vector-! (new 'stack-no-clear 'vector) arg1 arg0)))
|
|
(let ((f0-16 (ray-sphere-intersect arg0 s3-3 sv-16 (* 0.2 (the-as float sv-20)))))
|
|
(when (and (< 0.0 f0-16) (>= sv-64 f0-16))
|
|
(set! sv-64 f0-16)
|
|
(set! (-> this action) (manipulator-action manip-action7))
|
|
)
|
|
)
|
|
(when (= (-> this action) (manipulator-action manip-action0))
|
|
(when (and sv-52 sv-56)
|
|
(let ((t9-5 ray-sphere-intersect)
|
|
(a0-8 arg0)
|
|
(a1-4 s3-3)
|
|
(a2-2 (new 'stack-no-clear 'vector))
|
|
)
|
|
(let ((v1-27 sv-16))
|
|
(let ((a3-1 (new 'stack-no-clear 'vector)))
|
|
(let ((t0-0 (-> this mat))
|
|
(t1-0 (-> this mat uvec))
|
|
)
|
|
(.lvf vf4 (&-> t0-0 rvec quad))
|
|
(.lvf vf5 (&-> t1-0 quad))
|
|
)
|
|
(.mov.vf.w vf6 vf0)
|
|
(.add.vf.xyz vf6 vf4 vf5)
|
|
(.svf (&-> a3-1 quad) vf6)
|
|
(let ((t0-1 (the-as float sv-20)))
|
|
(.mov vf7 t0-1)
|
|
)
|
|
(.lvf vf5 (&-> a3-1 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-27 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a2-2 quad) vf6)
|
|
(let ((f0-20 (t9-5 a0-8 a1-4 a2-2 (* 0.3 (the-as float sv-20)))))
|
|
(when (and (< 0.0 f0-20) (>= sv-64 f0-20))
|
|
(set! sv-64 f0-20)
|
|
(set! (-> this action) (manipulator-action manip-action4))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (and sv-52 sv-60)
|
|
(let ((t9-6 ray-sphere-intersect)
|
|
(a0-9 arg0)
|
|
(a1-5 s3-3)
|
|
(a2-3 (new 'stack-no-clear 'vector))
|
|
)
|
|
(let ((v1-36 sv-16))
|
|
(let ((a3-3 (new 'stack-no-clear 'vector)))
|
|
(let ((t0-2 (-> this mat))
|
|
(t1-1 (-> this mat fvec))
|
|
)
|
|
(.lvf vf4 (&-> t0-2 rvec quad))
|
|
(.lvf vf5 (&-> t1-1 quad))
|
|
)
|
|
(.mov.vf.w vf6 vf0)
|
|
(.add.vf.xyz vf6 vf4 vf5)
|
|
(.svf (&-> a3-3 quad) vf6)
|
|
(let ((t0-3 (the-as float sv-20)))
|
|
(.mov vf7 t0-3)
|
|
)
|
|
(.lvf vf5 (&-> a3-3 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-36 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a2-3 quad) vf6)
|
|
(let ((f0-24 (t9-6 a0-9 a1-5 a2-3 (* 0.3 (the-as float sv-20)))))
|
|
(when (and (< 0.0 f0-24) (>= sv-64 f0-24))
|
|
(set! sv-64 f0-24)
|
|
(set! (-> this action) (manipulator-action manip-action5))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (and sv-56 sv-60)
|
|
(let ((t9-7 ray-sphere-intersect)
|
|
(a0-10 arg0)
|
|
(a1-6 s3-3)
|
|
(a2-4 (new 'stack-no-clear 'vector))
|
|
)
|
|
(let ((v1-45 sv-16))
|
|
(let ((a3-5 (new 'stack-no-clear 'vector)))
|
|
(let ((t0-4 (-> this mat uvec))
|
|
(t1-2 (-> this mat fvec))
|
|
)
|
|
(.lvf vf4 (&-> t0-4 quad))
|
|
(.lvf vf5 (&-> t1-2 quad))
|
|
)
|
|
(.mov.vf.w vf6 vf0)
|
|
(.add.vf.xyz vf6 vf4 vf5)
|
|
(.svf (&-> a3-5 quad) vf6)
|
|
(let ((t0-5 (the-as float sv-20)))
|
|
(.mov vf7 t0-5)
|
|
)
|
|
(.lvf vf5 (&-> a3-5 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-45 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a2-4 quad) vf6)
|
|
(let ((f0-28 (t9-7 a0-10 a1-6 a2-4 (* 0.3 (the-as float sv-20)))))
|
|
(when (and (< 0.0 f0-28) (>= sv-64 f0-28))
|
|
(set! sv-64 f0-28)
|
|
(set! (-> this action) (manipulator-action manip-action6))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when sv-52
|
|
(let ((f0-33 (ray-cylinder-intersect
|
|
arg0
|
|
s3-3
|
|
sv-16
|
|
(-> this mat rvec)
|
|
(* 0.1 (the-as float sv-20))
|
|
(* 1.3 (the-as float sv-20))
|
|
s4-2
|
|
)
|
|
)
|
|
)
|
|
(when (and (< 0.0 f0-33) (>= sv-64 f0-33))
|
|
(set! sv-64 f0-33)
|
|
(set! (-> this action) (manipulator-action manip-action1))
|
|
)
|
|
)
|
|
)
|
|
(when sv-56
|
|
(let ((f0-38 (ray-cylinder-intersect
|
|
arg0
|
|
s3-3
|
|
sv-16
|
|
(-> this mat uvec)
|
|
(* 0.1 (the-as float sv-20))
|
|
(* 1.3 (the-as float sv-20))
|
|
s4-2
|
|
)
|
|
)
|
|
)
|
|
(when (and (< 0.0 f0-38) (>= sv-64 f0-38))
|
|
(set! sv-64 f0-38)
|
|
(set! (-> this action) (manipulator-action manip-action2))
|
|
)
|
|
)
|
|
)
|
|
(when sv-60
|
|
(let ((f0-43 (ray-cylinder-intersect
|
|
arg0
|
|
s3-3
|
|
sv-16
|
|
(-> this mat fvec)
|
|
(* 0.1 (the-as float sv-20))
|
|
(* 1.3 (the-as float sv-20))
|
|
s4-2
|
|
)
|
|
)
|
|
)
|
|
(when (and (< 0.0 f0-43) (>= sv-64 f0-43))
|
|
(set! sv-64 f0-43)
|
|
(set! (-> this action) (manipulator-action manip-action3))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod manipulator-method-11 ((this manipulator))
|
|
(local-vars (sv-432 rgba))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(format *stdcon* "~M ~M ~M~%" (-> this position x) (-> this position y) (-> this position z))
|
|
(let ((s5-0 (-> this position)))
|
|
0.0
|
|
(let* ((v0-2 (vector-normalize!
|
|
(vector-! (new 'stack-no-clear 'vector) (-> (view-get-active-math-camera) trans) (-> this position))
|
|
1.0
|
|
)
|
|
)
|
|
(s4-1 (< (fabs (vector-dot v0-2 (-> this mat rvec))) 0.9))
|
|
(s3-2 (< (fabs (vector-dot v0-2 (-> this mat uvec))) 0.9))
|
|
(s2-0 (< (fabs (vector-dot v0-2 (-> this mat fvec))) 0.9))
|
|
(f30-1 (* 0.15 (vector-vector-distance (-> (view-get-active-math-camera) trans) s5-0)))
|
|
)
|
|
(if s4-1
|
|
(draw-axis
|
|
s5-0
|
|
(-> this mat rvec)
|
|
f30-1
|
|
(/ f30-1 4)
|
|
(if (= (-> this action) (manipulator-action manip-action1))
|
|
*color-yellow*
|
|
*color-red*
|
|
)
|
|
)
|
|
)
|
|
(if s3-2
|
|
(draw-axis
|
|
s5-0
|
|
(-> this mat uvec)
|
|
f30-1
|
|
(/ f30-1 4)
|
|
(if (= (-> this action) (manipulator-action manip-action2))
|
|
*color-yellow*
|
|
*color-green*
|
|
)
|
|
)
|
|
)
|
|
(if s2-0
|
|
(draw-axis
|
|
s5-0
|
|
(-> this mat fvec)
|
|
f30-1
|
|
(/ f30-1 4)
|
|
(if (= (-> this action) (manipulator-action manip-action3))
|
|
*color-yellow*
|
|
*color-blue*
|
|
)
|
|
)
|
|
)
|
|
(let ((s1-1 (new 'stack-no-clear 'vector))
|
|
(s0-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(let ((f28-0 0.1))
|
|
(set! sv-432 (cond
|
|
((= (-> this action) (manipulator-action manip-action7))
|
|
(set! sv-432 *color-yellow*)
|
|
sv-432
|
|
)
|
|
(else
|
|
*color-light-blue*
|
|
)
|
|
)
|
|
)
|
|
(let ((sv-288 s1-1))
|
|
(let ((sv-240 s5-0))
|
|
(let ((sv-272 (new 'stack-no-clear 'vector)))
|
|
(let ((sv-256 (-> (view-get-active-math-camera) inv-camera-rot))
|
|
(v1-26 (-> (view-get-active-math-camera) inv-camera-rot uvec))
|
|
)
|
|
(.lvf vf4 (&-> sv-256 rvec quad))
|
|
(.lvf vf5 (&-> v1-26 quad))
|
|
)
|
|
(.mov.vf.w vf6 vf0)
|
|
(.add.vf.xyz vf6 vf4 vf5)
|
|
(.svf (&-> sv-272 quad) vf6)
|
|
(let ((v1-28 (* f30-1 f28-0)))
|
|
(.mov vf7 v1-28)
|
|
)
|
|
(.lvf vf5 (&-> sv-272 quad))
|
|
)
|
|
(.lvf vf4 (&-> sv-240 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> sv-288 quad) vf6)
|
|
)
|
|
(let ((sv-320 s0-0))
|
|
(let ((sv-304 s1-1))
|
|
(let ((v1-32 (-> (view-get-active-math-camera) inv-camera-rot uvec)))
|
|
(let ((a0-14 (* -2.0 f30-1 f28-0)))
|
|
(.mov vf7 a0-14)
|
|
)
|
|
(.lvf vf5 (&-> v1-32 quad))
|
|
)
|
|
(.lvf vf4 (&-> sv-304 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> sv-320 quad) vf6)
|
|
)
|
|
(add-debug-line #t (bucket-id bucket785) s1-1 s0-0 sv-432 #f (the-as rgba -1))
|
|
(set! (-> s1-1 quad) (-> s0-0 quad))
|
|
(let ((sv-352 s0-0))
|
|
(let ((sv-336 s0-0))
|
|
(let ((v1-36 (-> (view-get-active-math-camera) inv-camera-rot)))
|
|
(let ((a0-19 (* -2.0 f30-1 f28-0)))
|
|
(.mov vf7 a0-19)
|
|
)
|
|
(.lvf vf5 (&-> v1-36 rvec quad))
|
|
)
|
|
(.lvf vf4 (&-> sv-336 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> sv-352 quad) vf6)
|
|
)
|
|
(add-debug-line #t (bucket-id bucket785) s1-1 s0-0 sv-432 #f (the-as rgba -1))
|
|
(set! (-> s1-1 quad) (-> s0-0 quad))
|
|
(let ((sv-384 s0-0))
|
|
(let ((sv-368 s0-0))
|
|
(let ((v1-40 (-> (view-get-active-math-camera) inv-camera-rot uvec)))
|
|
(let ((a0-24 (* 2.0 f30-1 f28-0)))
|
|
(.mov vf7 a0-24)
|
|
)
|
|
(.lvf vf5 (&-> v1-40 quad))
|
|
)
|
|
(.lvf vf4 (&-> sv-368 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> sv-384 quad) vf6)
|
|
)
|
|
(add-debug-line #t (bucket-id bucket785) s1-1 s0-0 sv-432 #f (the-as rgba -1))
|
|
(set! (-> s1-1 quad) (-> s0-0 quad))
|
|
(let ((sv-416 s0-0))
|
|
(let ((sv-400 s0-0))
|
|
(let ((v1-44 (-> (view-get-active-math-camera) inv-camera-rot)))
|
|
(let ((a0-29 (* 2.0 f30-1 f28-0)))
|
|
(.mov vf7 a0-29)
|
|
)
|
|
(.lvf vf5 (&-> v1-44 rvec quad))
|
|
)
|
|
(.lvf vf4 (&-> sv-400 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> sv-416 quad) vf6)
|
|
)
|
|
)
|
|
(add-debug-line #t (bucket-id bucket785) s1-1 s0-0 sv-432 #f (the-as rgba -1))
|
|
)
|
|
(let ((s1-2 (new 'stack-no-clear 'vector)))
|
|
(when (and s3-2 s2-0)
|
|
(let ((a1-10 s1-2))
|
|
(let ((v1-49 s5-0))
|
|
(let ((a0-31 (new 'stack-no-clear 'vector)))
|
|
(let ((a2-8 (-> this mat fvec))
|
|
(a3-8 (-> this mat uvec))
|
|
)
|
|
(.lvf vf4 (&-> a2-8 quad))
|
|
(.lvf vf5 (&-> a3-8 quad))
|
|
)
|
|
(.mov.vf.w vf6 vf0)
|
|
(.add.vf.xyz vf6 vf4 vf5)
|
|
(.svf (&-> a0-31 quad) vf6)
|
|
(let ((a2-9 f30-1))
|
|
(.mov vf7 a2-9)
|
|
)
|
|
(.lvf vf5 (&-> a0-31 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-49 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a1-10 quad) vf6)
|
|
)
|
|
(let ((s0-1 draw-axis)
|
|
(sv-448 s1-2)
|
|
)
|
|
(s0-1
|
|
sv-448
|
|
(vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec))
|
|
(* 0.15 f30-1)
|
|
(* 0.15 f30-1)
|
|
(if (= (-> this action) (manipulator-action manip-action6))
|
|
*color-yellow*
|
|
*color-green*
|
|
)
|
|
)
|
|
)
|
|
(let ((s0-2 draw-axis)
|
|
(sv-464 s1-2)
|
|
)
|
|
(s0-2
|
|
sv-464
|
|
(vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec))
|
|
(* 0.15 f30-1)
|
|
(* 0.15 f30-1)
|
|
(if (= (-> this action) (manipulator-action manip-action6))
|
|
*color-yellow*
|
|
*color-blue*
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! s2-0 (and s4-1 s2-0))
|
|
(when s2-0
|
|
(let ((a1-15 s1-2))
|
|
(let ((v1-57 s5-0))
|
|
(let ((a0-38 (new 'stack-no-clear 'vector)))
|
|
(let ((a2-12 (-> this mat))
|
|
(a3-11 (-> this mat fvec))
|
|
)
|
|
(.lvf vf4 (&-> a2-12 rvec quad))
|
|
(.lvf vf5 (&-> a3-11 quad))
|
|
)
|
|
(.mov.vf.w vf6 vf0)
|
|
(.add.vf.xyz vf6 vf4 vf5)
|
|
(.svf (&-> a0-38 quad) vf6)
|
|
(let ((a2-13 f30-1))
|
|
(.mov vf7 a2-13)
|
|
)
|
|
(.lvf vf5 (&-> a0-38 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-57 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a1-15 quad) vf6)
|
|
)
|
|
(draw-axis
|
|
s1-2
|
|
(vector-negate! (new 'stack-no-clear 'vector) (-> this mat rvec))
|
|
(* 0.15 f30-1)
|
|
(* 0.15 f30-1)
|
|
(if (= (-> this action) (manipulator-action manip-action5))
|
|
*color-yellow*
|
|
*color-red*
|
|
)
|
|
)
|
|
(draw-axis
|
|
s1-2
|
|
(vector-negate! (new 'stack-no-clear 'vector) (-> this mat fvec))
|
|
(* 0.15 f30-1)
|
|
(* 0.15 f30-1)
|
|
(if (= (-> this action) (manipulator-action manip-action5))
|
|
*color-yellow*
|
|
*color-blue*
|
|
)
|
|
)
|
|
)
|
|
(set! s3-2 (and s4-1 s3-2))
|
|
(when s3-2
|
|
(let ((a0-45 s1-2))
|
|
(let ((v1-64 (new 'stack-no-clear 'vector)))
|
|
(let ((a1-20 (-> this mat))
|
|
(a2-16 (-> this mat uvec))
|
|
)
|
|
(.lvf vf4 (&-> a1-20 rvec quad))
|
|
(.lvf vf5 (&-> a2-16 quad))
|
|
)
|
|
(.mov.vf.w vf6 vf0)
|
|
(.add.vf.xyz vf6 vf4 vf5)
|
|
(.svf (&-> v1-64 quad) vf6)
|
|
(let ((a1-21 f30-1))
|
|
(.mov vf7 a1-21)
|
|
)
|
|
(.lvf vf5 (&-> v1-64 quad))
|
|
)
|
|
(.lvf vf4 (&-> s5-0 quad))
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a0-45 quad) vf6)
|
|
)
|
|
(draw-axis
|
|
s1-2
|
|
(vector-negate! (new 'stack-no-clear 'vector) (-> this mat rvec))
|
|
(* 0.15 f30-1)
|
|
(* 0.15 f30-1)
|
|
(if (= (-> this action) (manipulator-action manip-action4))
|
|
*color-yellow*
|
|
*color-red*
|
|
)
|
|
)
|
|
(draw-axis
|
|
s1-2
|
|
(vector-negate! (new 'stack-no-clear 'vector) (-> this mat uvec))
|
|
(* 0.15 f30-1)
|
|
(* 0.15 f30-1)
|
|
(if (= (-> this action) (manipulator-action manip-action4))
|
|
*color-yellow*
|
|
*color-green*
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod drag-update! ((this manipulator) (arg0 vector))
|
|
(set! (-> this rotate-ref) (the int (-> *mouse* posx)))
|
|
(set! (-> this mouse-ref-position quad) (-> arg0 quad))
|
|
(set! (-> this drag-ref-position quad) (-> this position quad))
|
|
(set! (-> this dragging?) #t)
|
|
(set! (-> this speed quad) (the-as uint128 0))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod manipulator-method-13 ((this manipulator) (arg0 vector) (arg1 vector))
|
|
(rlet ((acc :class vf)
|
|
(vf0 :class vf)
|
|
(vf4 :class vf)
|
|
(vf5 :class vf)
|
|
(vf6 :class vf)
|
|
(vf7 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(cond
|
|
((= (-> this mode) (manipulator-mode manip-mode0))
|
|
(set! (-> this speed quad) (-> this position quad))
|
|
(let ((s5-1 (vector-! (new 'stack-no-clear 'vector) arg1 arg0))
|
|
(s4-1 (vector-! (new 'stack-no-clear 'vector) (-> this mouse-ref-position) arg0))
|
|
)
|
|
0.0
|
|
0.0
|
|
(let ((s2-0 (new 'stack-no-clear 'vector))
|
|
(s1-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(cond
|
|
((or (= (-> this action) (manipulator-action manip-action1))
|
|
(= (-> this action) (manipulator-action manip-action2))
|
|
(= (-> this action) (manipulator-action manip-action3))
|
|
)
|
|
(cond
|
|
((= (-> this action) (manipulator-action manip-action1))
|
|
(cond
|
|
((< (fabs (vector-dot s5-1 (-> this mat uvec))) (fabs (vector-dot s5-1 (-> this mat fvec))))
|
|
(set! (-> s2-0 quad) (-> this mat fvec quad))
|
|
(set! (-> s1-0 quad) (-> this mat uvec quad))
|
|
)
|
|
(else
|
|
(set! (-> s2-0 quad) (-> this mat uvec quad))
|
|
(set! (-> s1-0 quad) (-> this mat fvec quad))
|
|
)
|
|
)
|
|
)
|
|
((= (-> this action) (manipulator-action manip-action2))
|
|
(cond
|
|
((< (fabs (vector-dot s5-1 (-> this mat rvec))) (fabs (vector-dot s5-1 (-> this mat fvec))))
|
|
(set! (-> s2-0 quad) (-> this mat fvec quad))
|
|
(set! (-> s1-0 quad) (-> this mat rvec quad))
|
|
)
|
|
(else
|
|
(set! (-> s2-0 quad) (-> this mat rvec quad))
|
|
(set! (-> s1-0 quad) (-> this mat fvec quad))
|
|
)
|
|
)
|
|
)
|
|
((= (-> this action) (manipulator-action manip-action3))
|
|
(cond
|
|
((< (fabs (vector-dot s5-1 (-> this mat uvec))) (fabs (vector-dot s5-1 (-> this mat rvec))))
|
|
(set! (-> s2-0 quad) (-> this mat rvec quad))
|
|
(set! (-> s1-0 quad) (-> this mat uvec quad))
|
|
)
|
|
(else
|
|
(set! (-> s2-0 quad) (-> this mat uvec quad))
|
|
(set! (-> s1-0 quad) (-> this mat rvec quad))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((f30-0 (intersect-ray-plane arg0 s5-1 (-> this position) s2-0))
|
|
(f0-11 (intersect-ray-plane arg0 s4-1 (-> this position) s2-0))
|
|
)
|
|
(let ((a1-3 s5-1))
|
|
(let ((v1-41 arg0))
|
|
(let ((a0-43 s5-1))
|
|
(let ((a2-3 f30-0))
|
|
(.mov vf7 a2-3)
|
|
)
|
|
(.lvf vf5 (&-> a0-43 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-41 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a1-3 quad) vf6)
|
|
)
|
|
(let ((a0-44 s4-1))
|
|
(let ((v1-42 s4-1))
|
|
(let ((a1-4 f0-11))
|
|
(.mov vf7 a1-4)
|
|
)
|
|
(.lvf vf5 (&-> v1-42 quad))
|
|
)
|
|
(.lvf vf4 (&-> arg0 quad))
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a0-44 quad) vf6)
|
|
)
|
|
)
|
|
(vector-flatten! s5-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> this position)) s1-0)
|
|
(vector-flatten! s4-1 (vector-! (new 'stack-no-clear 'vector) s4-1 (-> this position)) s1-0)
|
|
(let ((v1-46 (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1)))
|
|
(let ((a2-8 (-> this position)))
|
|
(let ((a0-47 (-> this drag-ref-position))
|
|
(a1-9 v1-46)
|
|
)
|
|
(.lvf vf4 (&-> a0-47 quad))
|
|
(.lvf vf5 (&-> a1-9 quad))
|
|
)
|
|
(.mov.vf.w vf6 vf0)
|
|
(.add.vf.xyz vf6 vf4 vf5)
|
|
(.svf (&-> a2-8 quad) vf6)
|
|
)
|
|
(format *stdcon* "delta ~M ~M ~M~%" (-> v1-46 x) (-> v1-46 y) (-> v1-46 z))
|
|
)
|
|
)
|
|
((or (= (-> this action) (manipulator-action manip-action4))
|
|
(= (-> this action) (manipulator-action manip-action5))
|
|
(= (-> this action) (manipulator-action manip-action6))
|
|
(= (-> this action) (manipulator-action manip-action7))
|
|
)
|
|
(cond
|
|
((= (-> this action) (manipulator-action manip-action4))
|
|
(set! (-> s2-0 quad) (-> *z-vector* quad))
|
|
)
|
|
((= (-> this action) (manipulator-action manip-action5))
|
|
(set! (-> s2-0 quad) (-> *y-vector* quad))
|
|
)
|
|
((= (-> this action) (manipulator-action manip-action6))
|
|
(set! (-> s2-0 quad) (-> *x-vector* quad))
|
|
)
|
|
((= (-> this action) (manipulator-action manip-action7))
|
|
(set! (-> s2-0 quad) (-> (view-get-active-math-camera) inv-camera-rot fvec quad))
|
|
)
|
|
)
|
|
(vector-normalize! s2-0 1.0)
|
|
(let ((f30-1 (intersect-ray-plane arg0 s5-1 (-> this position) s2-0))
|
|
(f0-15 (intersect-ray-plane arg0 s4-1 (-> this position) s2-0))
|
|
)
|
|
(let ((a1-14 s5-1))
|
|
(let ((v1-70 arg0))
|
|
(let ((a0-66 s5-1))
|
|
(let ((a2-12 f30-1))
|
|
(.mov vf7 a2-12)
|
|
)
|
|
(.lvf vf5 (&-> a0-66 quad))
|
|
)
|
|
(.lvf vf4 (&-> v1-70 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> a1-14 quad) vf6)
|
|
)
|
|
(let ((v1-71 s4-1))
|
|
(let ((a0-67 arg0))
|
|
(let ((a1-15 s4-1))
|
|
(let ((a2-13 f0-15))
|
|
(.mov vf7 a2-13)
|
|
)
|
|
(.lvf vf5 (&-> a1-15 quad))
|
|
)
|
|
(.lvf vf4 (&-> a0-67 quad))
|
|
)
|
|
(.add.x.vf.w vf6 vf0 vf0)
|
|
(.mul.x.vf.xyz acc vf5 vf7)
|
|
(.add.mul.w.vf.xyz vf6 vf4 vf0 acc)
|
|
(.svf (&-> v1-71 quad) vf6)
|
|
)
|
|
)
|
|
(let ((v1-72 (-> this position)))
|
|
(let ((a0-68 (-> this drag-ref-position))
|
|
(a1-17 (vector-! (new 'stack-no-clear 'vector) s5-1 s4-1))
|
|
)
|
|
(.lvf vf4 (&-> a0-68 quad))
|
|
(.lvf vf5 (&-> a1-17 quad))
|
|
)
|
|
(.mov.vf.w vf6 vf0)
|
|
(.add.vf.xyz vf6 vf4 vf5)
|
|
(.svf (&-> v1-72 quad) vf6)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(vector-! (-> this speed) (-> this position) (-> this speed))
|
|
)
|
|
((= (-> this mode) (manipulator-mode manip-mode1))
|
|
(let ((s4-2 (- (-> this rotate-ref) (the int (-> *mouse* posx))))
|
|
(s5-2 (new 'stack-no-clear 'matrix))
|
|
)
|
|
(new 'stack 'euler-angles)
|
|
(matrix-identity! s5-2)
|
|
(cond
|
|
((= (-> this action) (manipulator-action manip-action1))
|
|
(matrix-axis-angle! s5-2 (-> this mat rvec) (* 182.04445 (the float s4-2)))
|
|
)
|
|
((= (-> this action) (manipulator-action manip-action2))
|
|
(matrix-axis-angle! s5-2 (-> this mat uvec) (* 182.04445 (the float s4-2)))
|
|
)
|
|
((= (-> this action) (manipulator-action manip-action3))
|
|
(matrix-axis-angle! s5-2 (-> this mat fvec) (* 182.04445 (the float s4-2)))
|
|
)
|
|
)
|
|
(matrix*! (-> this mat) (-> this mat) s5-2)
|
|
)
|
|
(matrix-remove-scale!
|
|
(-> this mat)
|
|
(-> this mat)
|
|
(new 'static 'vector :data (new 'static 'array float 4 1.0 1.0 1.0 0.0))
|
|
)
|
|
(matrix->eul (-> this angles) (-> this mat) 21)
|
|
(format *stdcon* "X = ~R~%Y = ~R~%Z = ~R~%" (-> this angles x) (-> this angles y) (-> this angles z))
|
|
(set! (-> this rotate-ref) (the int (-> *mouse* posx)))
|
|
)
|
|
(else
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod stop-dragging! ((this manipulator))
|
|
(set! (-> this speed quad) (the-as uint128 0))
|
|
(set! (-> this dragging?) #f)
|
|
0
|
|
(none)
|
|
)
|