From 49aea0a72180234c1bdee95db8d934ea5203abfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Flatval?= <70905152+haakonflatval-cognite@users.noreply.github.com> Date: Wed, 19 Jun 2024 13:52:44 +0200 Subject: [PATCH] fix: cone rendering sometimes overshooting (#4616) --- .../packages/rendering/src/glsl/sector/primitives/cone.frag | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/viewer/packages/rendering/src/glsl/sector/primitives/cone.frag b/viewer/packages/rendering/src/glsl/sector/primitives/cone.frag index f8d6e45126a..962b3afbc28 100644 --- a/viewer/packages/rendering/src/glsl/sector/primitives/cone.frag +++ b/viewer/packages/rendering/src/glsl/sector/primitives/cone.frag @@ -98,6 +98,7 @@ void main() vec3 intersectionPoint = E + dist * D; float theta = atan(intersectionPoint.y, intersectionPoint.x); if (theta < v_angle) theta += 2.0 * PI; + if (theta < v_angle) theta += 2.0 * PI; // Intersection point in camera space vec3 p = rayTarget + dist * rayDirection; @@ -116,7 +117,10 @@ void main() intersectionPoint = E + dist * D; theta = atan(intersectionPoint.y, intersectionPoint.x); p = rayTarget + dist * rayDirection; + if (theta < v_angle) theta += 2.0 * PI; + if (theta < v_angle) theta += 2.0 * PI; + if (intersectionPoint.z <= 0.0 || intersectionPoint.z > height || theta > v_angle + v_arcAngle ||