Skip to content

Commit

Permalink
Merge pull request #583 from wheremyfoodat/fix-fog-in-shader
Browse files Browse the repository at this point in the history
Closes #582
  • Loading branch information
wheremyfoodat authored Aug 20, 2024
2 parents 5babeaf + 937348a commit b099728
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/host_shaders/opengl_fragment_shader.frag
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,10 @@ void main() {
uint GPUREG_FOG_COLOR = readPicaReg(0x00E1u);

// Annoyingly color is not encoded in the same way as light color
float r = (GPUREG_FOG_COLOR & 0xFFu) / 255.0;
float g = ((GPUREG_FOG_COLOR >> 8) & 0xFFu) / 255.0;
float b = ((GPUREG_FOG_COLOR >> 16) & 0xFFu) / 255.0;
vec3 fog_color = vec3(r, g, b);
float r = float(GPUREG_FOG_COLOR & 0xFFu);
float g = float((GPUREG_FOG_COLOR >> 8u) & 0xFFu);
float b = float((GPUREG_FOG_COLOR >> 16u) & 0xFFu);
vec3 fog_color = (1.0 / 255.0) * vec3(r, g, b);

fragColour.rgb = mix(fog_color, fragColour.rgb, fog_factor);
}
Expand Down Expand Up @@ -561,4 +561,4 @@ void main() {
break;
}
}
}
}

0 comments on commit b099728

Please sign in to comment.