Fix issue where look-ahead scanline adjustments could get too high and cause monitors to dance

This commit is contained in:
wheaney 2025-02-14 20:09:54 -08:00
parent 41588a8f7a
commit a69560a909
1 changed files with 2 additions and 2 deletions

View File

@ -562,9 +562,9 @@ export const VirtualMonitorEffect = GObject.registerClass({
// project the vector onto a flat surface, return it's vertical position relative to the vertical fov, where 0.0 is
// the top and 1.0 is the bottom. vectors that project outside the vertical range of the display will have values
// outside this range.
// outside this range, but capped
float vectorToScanline(float fovVerticalRadians, vec3 v) {
return 1.0 - (-v.y / (tan(fovVerticalRadians / 2.0) * v.z) + 1.0) / 2.0;
return clamp(1.0 - (-v.y / (tan(fovVerticalRadians / 2.0) * v.z) + 1.0) / 2.0, -0.5, 1.5);
}
`;