From 2d3202862bcf49a6971b317b209cbf26c21cb532 Mon Sep 17 00:00:00 2001 From: BeaR Date: Tue, 31 Mar 2015 16:18:49 +0200 Subject: [PATCH] Change the way quads are split into triangle splits (conform with intel/nvidia drivers) --- src/engine/client/graphics.cpp | 28 ++++++++++++------------- src/engine/client/graphics_threaded.cpp | 28 ++++++++++++------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp index 6b5f9144a..de3841412 100644 --- a/src/engine/client/graphics.cpp +++ b/src/engine/client/graphics.cpp @@ -685,16 +685,16 @@ void CGraphics_OpenGL::QuadsDrawTL(const CQuadItem *pArray, int Num) m_aVertices[m_NumVertices + 6*i + 1].m_Tex = m_aTexture[1]; m_aVertices[m_NumVertices + 6*i + 1].m_Color = m_aColor[1]; - m_aVertices[m_NumVertices + 6*i + 2].m_Pos.x = pArray[i].m_X; + m_aVertices[m_NumVertices + 6*i + 2].m_Pos.x = pArray[i].m_X + pArray[i].m_Width; m_aVertices[m_NumVertices + 6*i + 2].m_Pos.y = pArray[i].m_Y + pArray[i].m_Height; - m_aVertices[m_NumVertices + 6*i + 2].m_Tex = m_aTexture[3]; - m_aVertices[m_NumVertices + 6*i + 2].m_Color = m_aColor[3]; + m_aVertices[m_NumVertices + 6*i + 2].m_Tex = m_aTexture[2]; + m_aVertices[m_NumVertices + 6*i + 2].m_Color = m_aColor[2]; // second triangle - m_aVertices[m_NumVertices + 6*i + 3].m_Pos.x = pArray[i].m_X + pArray[i].m_Width; + m_aVertices[m_NumVertices + 6*i + 3].m_Pos.x = pArray[i].m_X; m_aVertices[m_NumVertices + 6*i + 3].m_Pos.y = pArray[i].m_Y; - m_aVertices[m_NumVertices + 6*i + 3].m_Tex = m_aTexture[1]; - m_aVertices[m_NumVertices + 6*i + 3].m_Color = m_aColor[1]; + m_aVertices[m_NumVertices + 6*i + 3].m_Tex = m_aTexture[0]; + m_aVertices[m_NumVertices + 6*i + 3].m_Color = m_aColor[0]; m_aVertices[m_NumVertices + 6*i + 4].m_Pos.x = pArray[i].m_X + pArray[i].m_Width; m_aVertices[m_NumVertices + 6*i + 4].m_Pos.y = pArray[i].m_Y + pArray[i].m_Height; @@ -772,15 +772,15 @@ void CGraphics_OpenGL::QuadsDrawFreeform(const CFreeformItem *pArray, int Num) m_aVertices[m_NumVertices + 6*i + 1].m_Tex = m_aTexture[1]; m_aVertices[m_NumVertices + 6*i + 1].m_Color = m_aColor[1]; - m_aVertices[m_NumVertices + 6*i + 2].m_Pos.x = pArray[i].m_X2; - m_aVertices[m_NumVertices + 6*i + 2].m_Pos.y = pArray[i].m_Y2; - m_aVertices[m_NumVertices + 6*i + 2].m_Tex = m_aTexture[2]; - m_aVertices[m_NumVertices + 6*i + 2].m_Color = m_aColor[2]; + m_aVertices[m_NumVertices + 6*i + 2].m_Pos.x = pArray[i].m_X3; + m_aVertices[m_NumVertices + 6*i + 2].m_Pos.y = pArray[i].m_Y3; + m_aVertices[m_NumVertices + 6*i + 2].m_Tex = m_aTexture[3]; + m_aVertices[m_NumVertices + 6*i + 2].m_Color = m_aColor[3]; - m_aVertices[m_NumVertices + 6*i + 3].m_Pos.x = pArray[i].m_X1; - m_aVertices[m_NumVertices + 6*i + 3].m_Pos.y = pArray[i].m_Y1; - m_aVertices[m_NumVertices + 6*i + 3].m_Tex = m_aTexture[1]; - m_aVertices[m_NumVertices + 6*i + 3].m_Color = m_aColor[1]; + m_aVertices[m_NumVertices + 6*i + 3].m_Pos.x = pArray[i].m_X0; + m_aVertices[m_NumVertices + 6*i + 3].m_Pos.y = pArray[i].m_Y0; + m_aVertices[m_NumVertices + 6*i + 3].m_Tex = m_aTexture[0]; + m_aVertices[m_NumVertices + 6*i + 3].m_Color = m_aColor[0]; m_aVertices[m_NumVertices + 6*i + 4].m_Pos.x = pArray[i].m_X3; m_aVertices[m_NumVertices + 6*i + 4].m_Pos.y = pArray[i].m_Y3; diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index bf3616040..48c2c0c10 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -611,16 +611,16 @@ void CGraphics_Threaded::QuadsDrawTL(const CQuadItem *pArray, int Num) m_aVertices[m_NumVertices + 6*i + 1].m_Tex = m_aTexture[1]; m_aVertices[m_NumVertices + 6*i + 1].m_Color = m_aColor[1]; - m_aVertices[m_NumVertices + 6*i + 2].m_Pos.x = pArray[i].m_X; + m_aVertices[m_NumVertices + 6*i + 2].m_Pos.x = pArray[i].m_X + pArray[i].m_Width; m_aVertices[m_NumVertices + 6*i + 2].m_Pos.y = pArray[i].m_Y + pArray[i].m_Height; - m_aVertices[m_NumVertices + 6*i + 2].m_Tex = m_aTexture[3]; - m_aVertices[m_NumVertices + 6*i + 2].m_Color = m_aColor[3]; + m_aVertices[m_NumVertices + 6*i + 2].m_Tex = m_aTexture[2]; + m_aVertices[m_NumVertices + 6*i + 2].m_Color = m_aColor[2]; // second triangle - m_aVertices[m_NumVertices + 6*i + 3].m_Pos.x = pArray[i].m_X + pArray[i].m_Width; + m_aVertices[m_NumVertices + 6*i + 3].m_Pos.x = pArray[i].m_X; m_aVertices[m_NumVertices + 6*i + 3].m_Pos.y = pArray[i].m_Y; - m_aVertices[m_NumVertices + 6*i + 3].m_Tex = m_aTexture[1]; - m_aVertices[m_NumVertices + 6*i + 3].m_Color = m_aColor[1]; + m_aVertices[m_NumVertices + 6*i + 3].m_Tex = m_aTexture[0]; + m_aVertices[m_NumVertices + 6*i + 3].m_Color = m_aColor[0]; m_aVertices[m_NumVertices + 6*i + 4].m_Pos.x = pArray[i].m_X + pArray[i].m_Width; m_aVertices[m_NumVertices + 6*i + 4].m_Pos.y = pArray[i].m_Y + pArray[i].m_Height; @@ -698,15 +698,15 @@ void CGraphics_Threaded::QuadsDrawFreeform(const CFreeformItem *pArray, int Num) m_aVertices[m_NumVertices + 6*i + 1].m_Tex = m_aTexture[1]; m_aVertices[m_NumVertices + 6*i + 1].m_Color = m_aColor[1]; - m_aVertices[m_NumVertices + 6*i + 2].m_Pos.x = pArray[i].m_X2; - m_aVertices[m_NumVertices + 6*i + 2].m_Pos.y = pArray[i].m_Y2; - m_aVertices[m_NumVertices + 6*i + 2].m_Tex = m_aTexture[2]; - m_aVertices[m_NumVertices + 6*i + 2].m_Color = m_aColor[2]; + m_aVertices[m_NumVertices + 6*i + 2].m_Pos.x = pArray[i].m_X3; + m_aVertices[m_NumVertices + 6*i + 2].m_Pos.y = pArray[i].m_Y3; + m_aVertices[m_NumVertices + 6*i + 2].m_Tex = m_aTexture[3]; + m_aVertices[m_NumVertices + 6*i + 2].m_Color = m_aColor[3]; - m_aVertices[m_NumVertices + 6*i + 3].m_Pos.x = pArray[i].m_X1; - m_aVertices[m_NumVertices + 6*i + 3].m_Pos.y = pArray[i].m_Y1; - m_aVertices[m_NumVertices + 6*i + 3].m_Tex = m_aTexture[1]; - m_aVertices[m_NumVertices + 6*i + 3].m_Color = m_aColor[1]; + m_aVertices[m_NumVertices + 6*i + 3].m_Pos.x = pArray[i].m_X0; + m_aVertices[m_NumVertices + 6*i + 3].m_Pos.y = pArray[i].m_Y0; + m_aVertices[m_NumVertices + 6*i + 3].m_Tex = m_aTexture[0]; + m_aVertices[m_NumVertices + 6*i + 3].m_Color = m_aColor[0]; m_aVertices[m_NumVertices + 6*i + 4].m_Pos.x = pArray[i].m_X3; m_aVertices[m_NumVertices + 6*i + 4].m_Pos.y = pArray[i].m_Y3;