From 52d6ae36cb51941ac5f922e0f95ed73c5056a784 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Thu, 2 Dec 2021 00:46:32 +0100 Subject: [PATCH] LibGL: Do not exclude points on the clip planes Most resources seem to suggest that points on the clip planes are also inside the frustum, e.g.: https://www.cubic.org/docs/3dclip.htm This seems to resolve some rendering issues in Grim Fandango in OpenGL mode where the screen remained black. This was because of quads being drawn with their vertex positions exactly on the clip planes. --- Userland/Libraries/LibGL/Clipper.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibGL/Clipper.cpp b/Userland/Libraries/LibGL/Clipper.cpp index 7da384e5929..a85e6233ba7 100644 --- a/Userland/Libraries/LibGL/Clipper.cpp +++ b/Userland/Libraries/LibGL/Clipper.cpp @@ -15,17 +15,17 @@ bool Clipper::point_within_clip_plane(const FloatVector4& vertex, ClipPlane plan { switch (plane) { case ClipPlane::LEFT: - return vertex.x() > -vertex.w(); + return vertex.x() >= -vertex.w(); case ClipPlane::RIGHT: - return vertex.x() < vertex.w(); + return vertex.x() <= vertex.w(); case ClipPlane::TOP: - return vertex.y() < vertex.w(); + return vertex.y() <= vertex.w(); case ClipPlane::BOTTOM: - return vertex.y() > -vertex.w(); + return vertex.y() >= -vertex.w(); case ClipPlane::NEAR: - return vertex.z() > -vertex.w(); + return vertex.z() >= -vertex.w(); case ClipPlane::FAR: - return vertex.z() < vertex.w(); + return vertex.z() <= vertex.w(); } return false;