Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #3320: Incorrect colors for 3D draws #3321

Merged
merged 9 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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