gpu: fix priority renderer face cull checking

The face_visible check is not accounting for camera position, which causes
culled faces to erroneously be included (or not) into the priority renderer
distance calculations when placing 10 and 11 priority faces.

This was introduced in fd6b67fae2
This commit is contained in:
Adam
2019-01-28 17:45:45 -05:00
parent 7b8676d6f9
commit 5152be586f

View File

@@ -68,9 +68,11 @@ int face_distance(ivec4 vA, ivec4 vB, ivec4 vC, int cameraYaw, int cameraPitch)
* Test if a face is visible (not backward facing)
*/
bool face_visible(ivec4 vA, ivec4 vB, ivec4 vC, ivec4 position, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom) {
vA += position;
vB += position;
vC += position;
// Move model to scene location, and account for camera offset
ivec4 cameraPos = ivec4(cameraX, cameraY, cameraZ, 0);
vA += position - cameraPos;
vB += position - cameraPos;
vC += position - cameraPos;
ivec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
ivec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);