Skip to content

Commit

Permalink
Fix multitheftauto#3320: Incorrect colors for 3D draws (multitheftaut…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico8340 authored Apr 5, 2024
1 parent 2e43c10 commit 1f2c6e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Client/core/Graphics/CLine3DBatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
//
//
////////////////////////////////////////////////////////////////
CLine3DBatcher::CLine3DBatcher(bool bZTest)
CLine3DBatcher::CLine3DBatcher(bool bPreGUI)
{
m_bZTest = bZTest;
m_bPreGUI = bPreGUI;
}

////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -80,8 +80,8 @@ void CLine3DBatcher::Flush()
{
const SLine3DItem& item = *iter;

const ulong ulColor = item.ulColor;
const float fWidth = item.fWidth;
ulong ulColor = item.ulColor;
const CVector& vecA = item.vecFrom;
const CVector& vecB = item.vecTo;

Expand Down Expand Up @@ -116,7 +116,7 @@ void CLine3DBatcher::Flush()
// Set states
if (g_pDeviceState->AdapterState.bRequiresClipping)
m_pDevice->SetRenderState(D3DRS_CLIPPING, TRUE);
m_pDevice->SetRenderState(D3DRS_ZENABLE, m_bZTest ? D3DZB_TRUE : D3DZB_FALSE);
m_pDevice->SetRenderState(D3DRS_ZENABLE, m_bPreGUI ? D3DZB_TRUE : D3DZB_FALSE);
m_pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
m_pDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
m_pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
Expand Down
4 changes: 2 additions & 2 deletions Client/core/Graphics/CLine3DBatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CLine3DBatcher
{
public:
ZERO_ON_NEW
CLine3DBatcher(bool bZTest);
CLine3DBatcher(bool bPreGUI);
~CLine3DBatcher();

void OnDeviceCreate(IDirect3DDevice9* pDevice, float fViewportSizeX, float fViewportSizeY);
Expand All @@ -47,7 +47,7 @@ class CLine3DBatcher
void AddLine3D(const CVector& vecFrom, const CVector& vecTo, float fWidth, ulong ulColor);

protected:
bool m_bZTest;
bool m_bPreGUI;
IDirect3DDevice9* m_pDevice;
std::vector<SLine3DItem> m_LineList;
};
9 changes: 1 addition & 8 deletions Client/core/Graphics/CMaterialLine3DBatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,7 @@ void CMaterialLine3DBatcher::DrawBatch(const CVector& vecCameraPos, uint* pBatch
{
const SMaterialLine3DItem& item = m_LineList[pBatchIndices[i]];

SColor color = item.ulColor;
if (m_bPreGUI)
{
color.R /= 2;
color.G /= 2;
color.B /= 2;
}
const ulong ulColor = color;
const ulong ulColor = item.ulColor;
const CVector& vecA = item.vecFrom;
const CVector& vecB = item.vecTo;

Expand Down

0 comments on commit 1f2c6e7

Please sign in to comment.