mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
parent
89e52e3114
commit
a48df0683f
|
@ -58,6 +58,58 @@
|
|||
)
|
||||
|
||||
|
||||
(defun sphere-cull-for-ocean ((arg0 vector))
|
||||
"Is the given sphere in the view frustum?
|
||||
PC-port ocean version"
|
||||
(local-vars (v1-0 uint128) (v1-1 uint128) (v1-2 uint128))
|
||||
(rlet ((acc :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf10 :class vf)
|
||||
(vf16 :class vf)
|
||||
(vf17 :class vf)
|
||||
(vf18 :class vf)
|
||||
(vf19 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
;; modified for PC: these register would be loaded by the draw method of bsp.
|
||||
(cond
|
||||
((-> *time-of-day-context* use-camera-other)
|
||||
(let ((at-0 *math-camera*))
|
||||
(.lvf vf16 (&-> at-0 plane-other 0 quad))
|
||||
(.lvf vf17 (&-> at-0 plane-other 1 quad))
|
||||
(.lvf vf18 (&-> at-0 plane-other 2 quad))
|
||||
(.lvf vf19 (&-> at-0 plane-other 3 quad))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(let ((at-0 *math-camera*))
|
||||
(.lvf vf16 (&-> at-0 plane 0 quad))
|
||||
(.lvf vf17 (&-> at-0 plane 1 quad))
|
||||
(.lvf vf18 (&-> at-0 plane 2 quad))
|
||||
(.lvf vf19 (&-> at-0 plane 3 quad))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(init-vf0-vector)
|
||||
(.lvf vf10 (&-> arg0 quad))
|
||||
(.mul.x.vf acc vf16 vf10)
|
||||
(.add.mul.y.vf acc vf17 vf10 acc)
|
||||
(.add.mul.z.vf acc vf18 vf10 acc)
|
||||
(.sub.mul.w.vf vf9 vf19 vf0 acc)
|
||||
|
||||
;; checking to see if we are inside all 4 planes.
|
||||
|
||||
;; using the inside part of the sphere
|
||||
(.add.w.vf vf9 vf9 vf10)
|
||||
(.mov v1-0 vf9)
|
||||
(.pcgtw v1-1 0 v1-0)
|
||||
(.ppach v1-2 (the-as uint128 0) v1-1)
|
||||
(zero? (the-as int v1-2))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defun guard-band-cull ((arg0 vector))
|
||||
"Is the given sphere within the guard band, and possibly needs clipping?"
|
||||
(local-vars (v1-0 uint128) (v1-1 uint128) (v1-2 uint128))
|
||||
|
|
|
@ -939,53 +939,4 @@
|
|||
)
|
||||
)
|
||||
|
||||
(defun sphere-cull-for-ocean ((arg0 vector))
|
||||
"Is the given sphere in the view frustum?
|
||||
PC-port ocean version"
|
||||
(local-vars (v1-0 uint128) (v1-1 uint128) (v1-2 uint128))
|
||||
(rlet ((acc :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf10 :class vf)
|
||||
(vf16 :class vf)
|
||||
(vf17 :class vf)
|
||||
(vf18 :class vf)
|
||||
(vf19 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
;; modified for PC: these register would be loaded by the draw method of bsp.
|
||||
(cond
|
||||
((-> *time-of-day-context* use-camera-other)
|
||||
(let ((at-0 *math-camera*))
|
||||
(.lvf vf16 (&-> at-0 plane-other 0 quad))
|
||||
(.lvf vf17 (&-> at-0 plane-other 1 quad))
|
||||
(.lvf vf18 (&-> at-0 plane-other 2 quad))
|
||||
(.lvf vf19 (&-> at-0 plane-other 3 quad))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(let ((at-0 *math-camera*))
|
||||
(.lvf vf16 (&-> at-0 plane 0 quad))
|
||||
(.lvf vf17 (&-> at-0 plane 1 quad))
|
||||
(.lvf vf18 (&-> at-0 plane 2 quad))
|
||||
(.lvf vf19 (&-> at-0 plane 3 quad))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(init-vf0-vector)
|
||||
(.lvf vf10 (&-> arg0 quad))
|
||||
(.mul.x.vf acc vf16 vf10)
|
||||
(.add.mul.y.vf acc vf17 vf10 acc)
|
||||
(.add.mul.z.vf acc vf18 vf10 acc)
|
||||
(.sub.mul.w.vf vf9 vf19 vf0 acc)
|
||||
|
||||
;; checking to see if we are inside all 4 planes.
|
||||
|
||||
;; using the inside part of the sphere
|
||||
(.add.w.vf vf9 vf9 vf10)
|
||||
(.mov v1-0 vf9)
|
||||
(.pcgtw v1-1 0 v1-0)
|
||||
(.ppach v1-2 (the-as uint128 0) v1-1)
|
||||
(zero? (the-as int v1-2))
|
||||
)
|
||||
)
|
||||
(define-extern sphere-cull-for-ocean (function vector symbol))
|
Loading…
Reference in a new issue