Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix camera-other #3843

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions goal_src/jak2/engine/gfx/background/background.gc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@
)

;; first 4 quadwords are planes, then itimes
(let ((data-ptr (the-as (pointer uint128) (-> dma-buf base))))
(let ((data-ptr (the-as (pointer uint128) (-> dma-buf base)))
(vec-ptr (the-as (inline-array vector) (-> dma-buf base)))
)
;; the "use-camera-other" flag is set to "move" entire levels,
;; like the rotating city below in the throne room.
(cond
Expand All @@ -263,13 +265,19 @@
(set! (-> vec y) (-> *math-camera* fog-min))
(set! (-> vec z) (-> *math-camera* fog-max))
)
(set! (-> data-ptr 14) (-> *math-camera* trans-other quad))

;; the "other" version of trans doesn't have the same meaning as the normal one.
;; but inv-camera-rot-other is right, and we can just pull the translation from there.
;; I'm not certain the most accurate way to get this - either way there is an extra rotation to do.
(set! (-> data-ptr 14) (-> *math-camera* inv-camera-rot-other vector 3 quad))
(set! (-> vec-ptr 14 w) 1.0)

(set! (-> data-ptr 15) (-> *math-camera* camera-rot-other vector 0 quad))
(set! (-> data-ptr 16) (-> *math-camera* camera-rot-other vector 1 quad))
(set! (-> data-ptr 17) (-> *math-camera* camera-rot-other vector 2 quad))
(set! (-> data-ptr 18) (-> *math-camera* camera-rot-other vector 3 quad))


(set! (-> data-ptr 19) (-> *math-camera* perspective vector 0 quad))
(set! (-> data-ptr 20) (-> *math-camera* perspective vector 1 quad))
(set! (-> data-ptr 21) (-> *math-camera* perspective vector 2 quad))
Expand All @@ -295,6 +303,7 @@
(set! (-> vec y) (-> *math-camera* fog-min))
(set! (-> vec z) (-> *math-camera* fog-max))
)
;; use the camera-trans used to derive the camera matrix.
(set! (-> data-ptr 14) (-> *math-camera* trans quad))

(set! (-> data-ptr 15) (-> *math-camera* camera-rot vector 0 quad))
Expand Down
11 changes: 9 additions & 2 deletions goal_src/jak3/engine/gfx/background/background.gc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
)

;; first 4 quadwords are planes, then itimes
(let ((data-ptr (the-as (pointer uint128) (-> dma-buf base))))
(let ((data-ptr (the-as (pointer uint128) (-> dma-buf base)))
(vec-ptr (the-as (inline-array vector) (-> dma-buf base)))
)
;; the "use-camera-other" flag is set to "move" entire levels,
;; like the rotating city below in the throne room.
(cond
Expand All @@ -38,7 +40,11 @@
(set! (-> vec y) (-> *math-camera* fog-min))
(set! (-> vec z) (-> *math-camera* fog-max))
)
(set! (-> data-ptr 14) (-> *math-camera* trans-other quad))
;; the "other" version of trans doesn't have the same meaning as the normal one.
;; but inv-camera-rot-other is right, and we can just pull the translation from there.
;; I'm not certain the most accurate way to get this - either way there is an extra rotation to do.
(set! (-> data-ptr 14) (-> *math-camera* inv-camera-rot-other vector 3 quad))
(set! (-> vec-ptr 14 w) 1.0)

(set! (-> data-ptr 15) (-> *math-camera* camera-rot-other vector 0 quad))
(set! (-> data-ptr 16) (-> *math-camera* camera-rot-other vector 1 quad))
Expand Down Expand Up @@ -70,6 +76,7 @@
(set! (-> vec y) (-> *math-camera* fog-min))
(set! (-> vec z) (-> *math-camera* fog-max))
)
;; use the camera-trans used to derive the camera matrix.
(set! (-> data-ptr 14) (-> *math-camera* trans quad))

(set! (-> data-ptr 15) (-> *math-camera* camera-rot vector 0 quad))
Expand Down
Loading