From 5152be586f9a6d0e3a61e21239917525798166ea Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 28 Jan 2019 17:45:45 -0500 Subject: [PATCH] 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 fd6b67fae249ee2289ccdef4059b6004de4ff1f7 --- .../resources/net/runelite/client/plugins/gpu/common.glsl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl index 996976226b..207e8300a1 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/gpu/common.glsl @@ -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);