mirror of
https://github.com/open-goal/jak-project
synced 2026-07-28 07:09:43 -04:00
[jak2] fix foreground light calculation (#2254)
Fixes the abrupt change in lighting when walking around here 
This commit is contained in:
@@ -449,6 +449,14 @@ void Merc2::handle_pc_model(const DmaTransfer& setup,
|
||||
|
||||
// allocate lights
|
||||
u32 lights = alloc_lights(current_lights);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
float debug_length = current_lights.direction0[i] * current_lights.direction0[i] +
|
||||
current_lights.direction1[i] * current_lights.direction1[i] +
|
||||
current_lights.direction2[i] * current_lights.direction2[i];
|
||||
if (debug_length > 0.01 && debug_length < 0.98) {
|
||||
fmt::print("likely incorrect merc light direction {}\n", debug_length);
|
||||
}
|
||||
}
|
||||
|
||||
// loop over effects, creating draws for each
|
||||
for (size_t ei = 0; ei < model->effects.size(); ei++) {
|
||||
|
||||
@@ -284,11 +284,11 @@
|
||||
)
|
||||
)
|
||||
(.lvf vf9 (&-> arg1 dir1 levels quad))
|
||||
(let ((a3-1 (make-u128 t1-1 v1-0)))
|
||||
(let ((a3-1 (the uint128 (make-u128 t1-1 v1-0))))
|
||||
(.lvf vf6 (&-> arg1 dir2 color quad))
|
||||
(.pcpyud v1-1 v1-0 t1-1)
|
||||
(.lvf vf10 (&-> arg1 dir2 levels quad))
|
||||
(let ((a2-2 (make-u128 (the-as int t0-1) a2-1)))
|
||||
(let ((a2-2 (the uint128 (make-u128 (the-as int t0-1) a2-1))))
|
||||
(.lvf vf7 (&-> arg1 ambi color quad))
|
||||
(.mul.x.vf vf4 vf4 vf8)
|
||||
(.lvf vf11 (&-> arg1 ambi levels quad))
|
||||
|
||||
@@ -414,12 +414,12 @@
|
||||
;; ????????
|
||||
(let ((a3-0 (the-as uint128 (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0))))
|
||||
(nop!)
|
||||
(let ((a2-0 (-> arg1 dir0 direction quad)))
|
||||
(let ((a2-0 (-> arg1 dir0 direction quad))) ;; a2-0 = l0.dir
|
||||
(nop!)
|
||||
(let ((t1-0 (-> arg1 dir1 direction quad)))
|
||||
(let ((t1-0 (-> arg1 dir1 direction quad))) ;; t1-0 = l1.dir
|
||||
(nop!)
|
||||
(.lvf vf4 (&-> arg1 dir0 color quad))
|
||||
(.pextlw v1-0 t1-0 a2-0)
|
||||
(.lvf vf4 (&-> arg1 dir0 color quad)) ;; vf4 = l0.col
|
||||
(.pextlw v1-0 t1-0 a2-0) ;;
|
||||
(let ((t0-0 (-> arg1 dir2 direction quad)))
|
||||
(.pextuw a2-1 t1-0 a2-0)
|
||||
(.lvf vf8 (&-> arg1 dir0 extra quad))
|
||||
@@ -431,11 +431,11 @@
|
||||
)
|
||||
)
|
||||
(.lvf vf9 (&-> arg1 dir1 extra quad))
|
||||
(let ((a3-1 (make-u128 t1-1 v1-0)))
|
||||
(let ((a3-1 (the uint128 (make-u128 t1-1 v1-0))))
|
||||
(.lvf vf6 (&-> arg1 dir2 color quad))
|
||||
(.pcpyud v1-1 v1-0 t1-1)
|
||||
(.lvf vf10 (&-> arg1 dir2 extra quad))
|
||||
(let ((a2-2 (make-u128 t0-1 a2-1)))
|
||||
(let ((a2-2 (the uint128 (make-u128 t0-1 a2-1))))
|
||||
(.lvf vf7 (&-> arg1 ambi color quad))
|
||||
(.mul.x.vf vf4 vf4 vf8)
|
||||
(.lvf vf11 (&-> arg1 ambi extra quad))
|
||||
|
||||
Reference in New Issue
Block a user