From 2db0f40ec126c658d703300d3f3610151b7b1efd Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:37:09 +0200 Subject: [PATCH] Recast: fix z-fighting properly The near clip plane has been increased significantly. This was never adjusted correctly with the large scale change that was done to make Recast work with the scale of Titanfall and Apex maps. The near clipping is still minimal but the z-fighting problem has been fixed entirely. The offset for Recast and Detour debug drawing have also been reduced significantly as a result, since they no longer need to be offset that much. Also removed a comment regarding the projection matrix since we have to adjust the projection matric for XYZ rendering. --- src/naveditor/Editor.cpp | 4 ++-- src/naveditor/main.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/naveditor/Editor.cpp b/src/naveditor/Editor.cpp index 2c8b8fdb..b890bc0a 100644 --- a/src/naveditor/Editor.cpp +++ b/src/naveditor/Editor.cpp @@ -82,8 +82,8 @@ Editor::Editor() : for (int i = 0; i < MAX_TOOLS; i++) m_toolStates[i] = 0; - dtVset(m_recastDrawOffset, 0.0f,0.0f,20.0f); - dtVset(m_detourDrawOffset, 0.0f,0.0f,30.0f); + dtVset(m_recastDrawOffset, 0.0f,0.0f,4.0f); + dtVset(m_detourDrawOffset, 0.0f,0.0f,8.0f); } Editor::~Editor() diff --git a/src/naveditor/main.cpp b/src/naveditor/main.cpp index f2ee1db2..190a4f8a 100644 --- a/src/naveditor/main.cpp +++ b/src/naveditor/main.cpp @@ -820,7 +820,7 @@ int not_main(int argc, char** argv) // Compute the projection matrix. glMatrixMode(GL_PROJECTION); glLoadIdentity(); - gluPerspective(75.0f, (float)width/(float)height, 1.0f, camr); + gluPerspective(85.0f, (float)width/(float)height, 25.0f, camr); GLdouble projectionMatrix[16]; glGetDoublev(GL_PROJECTION_MATRIX, projectionMatrix); @@ -832,7 +832,7 @@ int not_main(int argc, char** argv) const float mXZY_to_XYZ[16] = { 1,0,0,0, - 0,0,-1,0, //tbh not sure why this is needed, the tri flips again? something is very stupid... + 0,0,-1,0, 0,1,0,0, 0,0,0,1 };