mirror of
https://github.com/open-goal/jak-project
synced 2026-08-16 05:09:45 -04:00
jak2 ref
This commit is contained in:
+12
-10
@@ -108,11 +108,12 @@
|
||||
)
|
||||
(cond
|
||||
((= (logand (/ arg2 2) 1) 1)
|
||||
(let* ((f0-0 (-> (the-as (pointer float) (+ (+ (* s2-0 4) (* s3-0 16)) (the-as int arg1)))))
|
||||
(f0-2 (* f0-0 f0-0))
|
||||
(f1-0 (-> (the-as (pointer float) (+ (+ (* s1-0 4) (* s3-0 16)) (the-as int arg1)))))
|
||||
(f30-0 (sqrtf (+ f0-2 (* f1-0 f1-0))))
|
||||
)
|
||||
(let ((f30-0 (sqrtf (+ (square (-> (the-as (pointer float) (+ (+ (* s2-0 4) (* s3-0 16)) (the-as int arg1)))))
|
||||
(square (-> (the-as (pointer float) (+ (+ (* s1-0 4) (* s3-0 16)) (the-as int arg1)))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((< 0.00000000001 f30-0)
|
||||
(set! (-> arg0 x) (atan
|
||||
@@ -140,11 +141,12 @@
|
||||
)
|
||||
)
|
||||
(else
|
||||
(let* ((f0-21 (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1)))))
|
||||
(f0-23 (* f0-21 f0-21))
|
||||
(f1-3 (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s2-0 16)) (the-as int arg1)))))
|
||||
(f30-1 (sqrtf (+ f0-23 (* f1-3 f1-3))))
|
||||
)
|
||||
(let ((f30-1 (sqrtf (+ (square (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1)))))
|
||||
(square (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s2-0 16)) (the-as int arg1)))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(cond
|
||||
((< 0.00000000001 f30-1)
|
||||
(set! (-> arg0 x)
|
||||
|
||||
+5
-5
@@ -640,11 +640,11 @@
|
||||
)
|
||||
)
|
||||
(dotimes (v1-3 6)
|
||||
(set! f0-1 (- (the-as float f0-1)
|
||||
(/ (- (* (the-as float (* (the-as float f0-1) (the-as float f0-1))) (the-as float f0-1)) arg0)
|
||||
(* 3.0 (the-as float f0-1) (the-as float f0-1))
|
||||
)
|
||||
)
|
||||
(set! f0-1
|
||||
(- (the-as float f0-1) (/ (- (* (the-as float (square (the-as float f0-1))) (the-as float f0-1)) arg0)
|
||||
(* 3.0 (the-as float f0-1) (the-as float f0-1))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as float f0-1)
|
||||
|
||||
+7
-18
@@ -48,12 +48,9 @@
|
||||
;; definition for function vector-angle<-quaternion!
|
||||
(defun vector-angle<-quaternion! ((arg0 vector) (arg1 quaternion))
|
||||
"Convert the quaternion arg1 to axis-angle form and store in arg0 (angle goes in w)"
|
||||
(let* ((f0-0 1.0)
|
||||
(f1-0 1.0)
|
||||
(f2-0 (-> arg1 w))
|
||||
(f30-0 (/ f0-0 (sqrtf (- f1-0 (* f2-0 f2-0)))))
|
||||
(f0-3 (* 2.0 (acos-rad (-> arg1 w))))
|
||||
)
|
||||
(let ((f30-0 (/ 1.0 (sqrtf (- 1.0 (square (-> arg1 w))))))
|
||||
(f0-3 (* 2.0 (acos-rad (-> arg1 w))))
|
||||
)
|
||||
(set! (-> arg0 x) (* (-> arg1 x) f30-0))
|
||||
(set! (-> arg0 y) (* (-> arg1 y) f30-0))
|
||||
(set! (-> arg0 z) (* (-> arg1 z) f30-0))
|
||||
@@ -599,11 +596,7 @@
|
||||
;; definition for function quaternion-vector-len
|
||||
(defun quaternion-vector-len ((arg0 quaternion))
|
||||
"Assuming quaternion is normalized, get the length of the xyz part."
|
||||
(let ((f0-0 1.0)
|
||||
(f1-0 (-> arg0 w))
|
||||
)
|
||||
(sqrtf (- f0-0 (* f1-0 f1-0)))
|
||||
)
|
||||
(sqrtf (- 1.0 (square (-> arg0 w))))
|
||||
)
|
||||
|
||||
;; definition for function quaternion-log!
|
||||
@@ -689,9 +682,7 @@
|
||||
(quaternion-normalize! arg0)
|
||||
)
|
||||
(else
|
||||
(let* ((f1-4 1.0)
|
||||
(f2-1 f0-0)
|
||||
(f1-6 (sqrtf (- f1-4 (* f2-1 f2-1))))
|
||||
(let* ((f1-6 (sqrtf (- 1.0 (square f0-0))))
|
||||
(f0-6 (/ (- f1-6 f0-0) (+ f1-6 f0-0)))
|
||||
(f28-0 (/ 1.0 f1-6))
|
||||
)
|
||||
@@ -767,10 +758,8 @@
|
||||
(quaternion-negate! s3-0 s3-0)
|
||||
)
|
||||
(quaternion-! s5-0 s3-0 arg1)
|
||||
(let ((f0-1 (quaternion-norm2 s5-0))
|
||||
(f1-1 arg3)
|
||||
)
|
||||
(if (< (* f1-1 f1-1) f0-1)
|
||||
(let ((f0-1 (quaternion-norm2 s5-0)))
|
||||
(if (< (square arg3) f0-1)
|
||||
(quaternion-float*! s5-0 s5-0 (/ arg3 (sqrtf f0-1)))
|
||||
)
|
||||
)
|
||||
|
||||
+31
-47
@@ -156,63 +156,47 @@
|
||||
;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4]
|
||||
;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5]
|
||||
(defmethod rotate-toward-orientation! ((this trsqv) (arg0 quaternion) (arg1 float) (arg2 float) (arg3 int) (arg4 int) (arg5 float))
|
||||
(local-vars
|
||||
(f0-4 float)
|
||||
(sv-192 (function quaternion vector vector float int quaternion))
|
||||
(sv-208 quaternion)
|
||||
(sv-224 vector)
|
||||
(sv-240 int)
|
||||
(sv-256 vector)
|
||||
(sv-272 vector)
|
||||
)
|
||||
(set! sv-240 arg4)
|
||||
(let ((s2-0 arg5)
|
||||
(local-vars (f0-4 float))
|
||||
(let ((sv-240 arg4)
|
||||
(s2-0 arg5)
|
||||
(s5-0 (get-quaternion this))
|
||||
)
|
||||
(let ((gp-0 (new 'stack-no-clear 'quaternion)))
|
||||
(when (< 0.0 arg2)
|
||||
(set! sv-192 quaternion-from-two-vectors-smooth!)
|
||||
(set! sv-208 gp-0)
|
||||
(set! sv-224 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(let ((a2-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg0)))
|
||||
(sv-192 sv-208 sv-224 a2-1 arg2 sv-240)
|
||||
(quaternion-from-two-vectors-smooth!
|
||||
gp-0
|
||||
(vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0)
|
||||
(vector-y-quaternion! (new 'stack-no-clear 'vector) arg0)
|
||||
arg2
|
||||
sv-240
|
||||
)
|
||||
(quaternion-normalize! (quaternion*! s5-0 gp-0 s5-0))
|
||||
)
|
||||
(when (< 0.0 arg1)
|
||||
(set! sv-256 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(let ((s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0)))
|
||||
(set! sv-272 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0))
|
||||
(let ((s0-1 (new 'stack-no-clear 'matrix)))
|
||||
(vector-flatten! s1-2 s1-2 sv-256)
|
||||
(vector-flatten! sv-272 sv-272 sv-256)
|
||||
(vector-normalize! s1-2 1.0)
|
||||
(vector-normalize! sv-272 1.0)
|
||||
(cond
|
||||
((!= s2-0 0.0)
|
||||
(let* ((v1-5 (vector-cross! (new 'stack-no-clear 'vector) s1-2 sv-272))
|
||||
(f0-3 (-> sv-256 x))
|
||||
(f1-3 (-> sv-256 y))
|
||||
(f2-0 (-> sv-256 z))
|
||||
(f3-0 (-> v1-5 x))
|
||||
(f4-0 (-> v1-5 y))
|
||||
(f5-0 (-> v1-5 z))
|
||||
)
|
||||
(.mula.s f0-3 f3-0)
|
||||
(.madda.s f1-3 f4-0)
|
||||
(.madd.s f0-4 f2-0 f5-0)
|
||||
)
|
||||
(if (< (* f0-4 s2-0) 0.0)
|
||||
(matrix-from-two-vectors-the-long-way-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
(matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
)
|
||||
(let ((sv-256 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(sv-272 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0))
|
||||
(s0-1 (new 'stack-no-clear 'matrix))
|
||||
)
|
||||
(vector-flatten! s1-2 s1-2 sv-256)
|
||||
(vector-flatten! sv-272 sv-272 sv-256)
|
||||
(vector-normalize! s1-2 1.0)
|
||||
(vector-normalize! sv-272 1.0)
|
||||
(cond
|
||||
((!= s2-0 0.0)
|
||||
(let* ((v1-5 (vector-cross! (new 'stack-no-clear 'vector) s1-2 sv-272)))
|
||||
(set! f0-4 (vector-dot sv-256 v1-5))
|
||||
)
|
||||
(if (< (* f0-4 s2-0) 0.0)
|
||||
(matrix-from-two-vectors-the-long-way-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
(matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
)
|
||||
(matrix->quaternion gp-0 s0-1)
|
||||
)
|
||||
(matrix->quaternion gp-0 s0-1)
|
||||
)
|
||||
(quaternion-normalize! (quaternion*! s5-0 gp-0 s5-0))
|
||||
)
|
||||
|
||||
+4
-11
@@ -167,7 +167,7 @@
|
||||
(let ((f2-0 (* 0.000095873795 (the float (sar (shl (the int arg0) 48) 48)))))
|
||||
f2-0
|
||||
(let* ((f1-4 (* 0.999998 f2-0))
|
||||
(f0-3 (* f2-0 f2-0))
|
||||
(f0-3 (square f2-0))
|
||||
(f2-1 (* f2-0 f0-3))
|
||||
(f1-5 (+ f1-4 (* -0.16666014 f2-1)))
|
||||
(f2-2 (* f2-1 f0-3))
|
||||
@@ -522,10 +522,7 @@
|
||||
16383.996
|
||||
)
|
||||
(else
|
||||
(let* ((f0-6 1.0)
|
||||
(f1-2 arg0)
|
||||
(f0-8 (sqrtf (- f0-6 (* f1-2 f1-2))))
|
||||
)
|
||||
(let ((f0-8 (sqrtf (- 1.0 (square arg0)))))
|
||||
(atan0 arg0 f0-8)
|
||||
)
|
||||
)
|
||||
@@ -551,18 +548,14 @@
|
||||
"Inverse cosine, radians."
|
||||
(cond
|
||||
((>= arg0 0.0)
|
||||
(let* ((f0-1 1.0)
|
||||
(f1-1 arg0)
|
||||
(f0-3 (sqrtf (- f0-1 (* f1-1 f1-1))))
|
||||
(let* ((f0-3 (sqrtf (- 1.0 (square arg0))))
|
||||
(f0-5 (/ (- f0-3 arg0) (+ f0-3 arg0)))
|
||||
)
|
||||
(atan-series-rad f0-5)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(let* ((f0-6 1.0)
|
||||
(f1-6 arg0)
|
||||
(f0-8 (sqrtf (- f0-6 (* f1-6 f1-6))))
|
||||
(let* ((f0-8 (sqrtf (- 1.0 (square arg0))))
|
||||
(f0-10 (/ (+ f0-8 arg0) (- f0-8 arg0)))
|
||||
)
|
||||
(- 3.1415925 (atan-series-rad f0-10))
|
||||
|
||||
+2
-6
@@ -1071,16 +1071,12 @@
|
||||
|
||||
;; definition for function vector-length<
|
||||
(defun vector-length< ((arg0 vector) (arg1 float))
|
||||
(let ((f0-0 (vector-length-squared arg0))
|
||||
(f1-0 arg1)
|
||||
)
|
||||
(< f0-0 (* f1-0 f1-0))
|
||||
)
|
||||
(< (vector-length-squared arg0) (square arg1))
|
||||
)
|
||||
|
||||
;; definition for function vector-length>
|
||||
(defun vector-length> ((arg0 vector) (arg1 float))
|
||||
(< (* arg1 arg1) (vector-length-squared arg0))
|
||||
(< (square arg1) (vector-length-squared arg0))
|
||||
)
|
||||
|
||||
;; definition for symbol *zero-vector*, type vector
|
||||
|
||||
+3
-3
@@ -366,7 +366,7 @@
|
||||
(when (or (!= f0-1 0.0) (!= f2-1 0.0))
|
||||
(let* ((f1-5 (* f0-1 arg3))
|
||||
(f0-3 (* f2-1 arg3))
|
||||
(f2-4 (sqrtf (+ (* f1-5 f1-5) (* f0-3 f0-3))))
|
||||
(f2-4 (sqrtf (+ (square f1-5) (square f0-3))))
|
||||
)
|
||||
(cond
|
||||
((>= arg2 f2-4)
|
||||
@@ -398,7 +398,7 @@
|
||||
(when (or (!= f0-1 0.0) (!= f2-1 0.0))
|
||||
(let* ((f1-5 (* f0-1 arg3))
|
||||
(f0-3 (* f2-1 arg3))
|
||||
(f2-4 (sqrtf (+ (* f1-5 f1-5) (* f0-3 f0-3))))
|
||||
(f2-4 (sqrtf (+ (square f1-5) (square f0-3))))
|
||||
)
|
||||
(cond
|
||||
((>= arg2 f2-4)
|
||||
@@ -432,7 +432,7 @@
|
||||
(let* ((f2-6 (* f0-1 arg3))
|
||||
(f1-3 (* f1-2 arg3))
|
||||
(f0-4 (* f3-1 arg3))
|
||||
(f3-5 (sqrtf (+ (* f2-6 f2-6) (* f1-3 f1-3) (* f0-4 f0-4))))
|
||||
(f3-5 (sqrtf (+ (square f2-6) (square f1-3) (square f0-4))))
|
||||
)
|
||||
(cond
|
||||
((>= arg2 f3-5)
|
||||
|
||||
Reference in New Issue
Block a user