mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-15 12:24:39 +00:00
Reduce hardcoded constants in Lights_GlowCheck, some more comments on the CPU driven depth test and z-buffer value conversion (#1506)
This commit is contained in:
parent
47ffb59f68
commit
54638f9768
2 changed files with 18 additions and 10 deletions
|
@ -339,11 +339,18 @@ void Lights_GlowCheck(PlayState* play) {
|
|||
wY = multDest.y * cappedInvWDest;
|
||||
|
||||
if ((multDest.z > 1.0f) && (fabsf(wX) < 1.0f) && (fabsf(wY) < 1.0f)) {
|
||||
wZ = (s32)((multDest.z * cappedInvWDest) * 16352.0f) + 16352;
|
||||
zBuf = gZBuffer[(s32)((wY * -120.0f) + 120.0f)][(s32)((wX * 160.0f) + 160.0f)] * 4;
|
||||
// Compute screen z value assuming the viewport scale and translation both have value G_MAXZ / 2
|
||||
// The multiplication by 32 follows from how the RSP microcode computes the screen z value.
|
||||
wZ = (s32)((multDest.z * cappedInvWDest) * ((G_MAXZ / 2) * 32)) + ((G_MAXZ / 2) * 32);
|
||||
// Obtain the z-buffer value for the screen pixel corresponding to the center of the glow.
|
||||
zBuf = gZBuffer[(s32)((wY * -(SCREEN_HEIGHT / 2)) + (SCREEN_HEIGHT / 2))]
|
||||
[(s32)((wX * (SCREEN_WIDTH / 2)) + (SCREEN_WIDTH / 2))]
|
||||
<< 2;
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
|
||||
// Compare the computed screen z value to the integer part of the z-buffer value in fixed point. If
|
||||
// it is less than the value from the z-buffer the depth test passes and the glow can draw.
|
||||
if (wZ < (Environment_ZBufValToFixedPoint(zBuf) >> 3)) {
|
||||
params->drawGlow = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue