Skip to content

Commit 1f2c6e7

Browse files
authored
Fix #3320: Incorrect colors for 3D draws (#3321)
1 parent 2e43c10 commit 1f2c6e7

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

Client/core/Graphics/CLine3DBatcher.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
//
2020
//
2121
////////////////////////////////////////////////////////////////
22-
CLine3DBatcher::CLine3DBatcher(bool bZTest)
22+
CLine3DBatcher::CLine3DBatcher(bool bPreGUI)
2323
{
24-
m_bZTest = bZTest;
24+
m_bPreGUI = bPreGUI;
2525
}
2626

2727
////////////////////////////////////////////////////////////////
@@ -80,8 +80,8 @@ void CLine3DBatcher::Flush()
8080
{
8181
const SLine3DItem& item = *iter;
8282

83+
const ulong ulColor = item.ulColor;
8384
const float fWidth = item.fWidth;
84-
ulong ulColor = item.ulColor;
8585
const CVector& vecA = item.vecFrom;
8686
const CVector& vecB = item.vecTo;
8787

@@ -116,7 +116,7 @@ void CLine3DBatcher::Flush()
116116
// Set states
117117
if (g_pDeviceState->AdapterState.bRequiresClipping)
118118
m_pDevice->SetRenderState(D3DRS_CLIPPING, TRUE);
119-
m_pDevice->SetRenderState(D3DRS_ZENABLE, m_bZTest ? D3DZB_TRUE : D3DZB_FALSE);
119+
m_pDevice->SetRenderState(D3DRS_ZENABLE, m_bPreGUI ? D3DZB_TRUE : D3DZB_FALSE);
120120
m_pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
121121
m_pDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
122122
m_pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);

Client/core/Graphics/CLine3DBatcher.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class CLine3DBatcher
3838
{
3939
public:
4040
ZERO_ON_NEW
41-
CLine3DBatcher(bool bZTest);
41+
CLine3DBatcher(bool bPreGUI);
4242
~CLine3DBatcher();
4343

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

4949
protected:
50-
bool m_bZTest;
50+
bool m_bPreGUI;
5151
IDirect3DDevice9* m_pDevice;
5252
std::vector<SLine3DItem> m_LineList;
5353
};

Client/core/Graphics/CMaterialLine3DBatcher.cpp

+1-8
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,7 @@ void CMaterialLine3DBatcher::DrawBatch(const CVector& vecCameraPos, uint* pBatch
203203
{
204204
const SMaterialLine3DItem& item = m_LineList[pBatchIndices[i]];
205205

206-
SColor color = item.ulColor;
207-
if (m_bPreGUI)
208-
{
209-
color.R /= 2;
210-
color.G /= 2;
211-
color.B /= 2;
212-
}
213-
const ulong ulColor = color;
206+
const ulong ulColor = item.ulColor;
214207
const CVector& vecA = item.vecFrom;
215208
const CVector& vecB = item.vecTo;
216209

0 commit comments

Comments
 (0)