Fix the sky in harley in first person mode where pixels in the sky are culled when they shouldn't be with the quad renderer. Basically we were running out of precision in a rare corner case. Doing the maths with double precision and casting back to float was enough to fix the issue.

This commit is contained in:
Ian Curtis 2019-12-27 21:36:46 +00:00
parent a5858e635d
commit 605dad2c02

View file

@ -82,7 +82,7 @@ out GS_OUT
flat vec4 color;
} gs_out;
float area(vec2 a, vec2 b)
double area(dvec2 a, dvec2 b)
{
return a.x*b.y - a.y*b.x;
}
@ -124,13 +124,15 @@ void main(void)
//
int reorder[4] = int[]( 1, 0, 2, 3 );
int ii = reorder[i];
dvec2 vector[4];
for (j=0; j<4; j++) {
gs_out.v[j] = v[j] - v[ii];
vector[j] = dvec2(v[j]) - dvec2(v[ii]);
gs_out.v[j] = vec2(vector[j]);
}
for (j=0; j<4; j++) {
j_next = (j+1) % 4;
gs_out.area[j] = area(gs_out.v[j], gs_out.v[j_next]);
gs_out.area[j] = float(area(vector[j], vector[j_next]));
}
gl_Position = gl_in[ii].gl_Position;
@ -276,9 +278,9 @@ void QuadraticInterpolation()
}
}
}
if (abs(lambdaSignCount) != 4) {
if (lambdaSignCount != 4) {
if(!gl_HelperInvocation) {
discard; // need to revisit this
discard;
}
}