Fix fog values for sprites.

(cherry picked from commit cbeee9a7d0d2f1782a7a1aac6ad1ec45f0869742)
This commit is contained in:
Jean-Philip Desjardins 2025-02-11 11:12:48 -05:00
parent 60b7ee0614
commit dd968d1472
2 changed files with 26 additions and 12 deletions

View file

@ -1588,6 +1588,13 @@ void CGSH_OpenGL::Prim_Sprite()
float nS[2] = {0, 0};
float nT[2] = {0, 0};
float nF = 0;
if(m_PrimitiveMode.nFog)
{
nF = (float)(0xFF - m_VtxBuffer[0].fog) / 255.0f;
}
if(m_PrimitiveMode.nTexture)
{
if(m_PrimitiveMode.nUseUV)
@ -1629,13 +1636,13 @@ void CGSH_OpenGL::Prim_Sprite()
// clang-format off
PRIM_VERTEX vertices[] =
{
{nX1, nY1, nZ, color, nS[0], nT[0], 1, 0},
{nX2, nY1, nZ, color, nS[1], nT[0], 1, 0},
{nX1, nY2, nZ, color, nS[0], nT[1], 1, 0},
{nX1, nY1, nZ, color, nS[0], nT[0], 1, nF},
{nX2, nY1, nZ, color, nS[1], nT[0], 1, nF},
{nX1, nY2, nZ, color, nS[0], nT[1], 1, nF},
{nX1, nY2, nZ, color, nS[0], nT[1], 1, 0},
{nX2, nY1, nZ, color, nS[1], nT[0], 1, 0},
{nX2, nY2, nZ, color, nS[1], nT[1], 1, 0},
{nX1, nY2, nZ, color, nS[0], nT[1], 1, nF},
{nX2, nY1, nZ, color, nS[1], nT[0], 1, nF},
{nX2, nY2, nZ, color, nS[1], nT[1], 1, nF},
};
// clang-format on

View file

@ -1238,6 +1238,13 @@ void CGSH_Vulkan::Prim_Sprite()
float s[2] = {0, 0};
float t[2] = {0, 0};
float f = 0;
if(m_primitiveMode.nFog)
{
f = static_cast<float>(0xFF - m_vtxBuffer[0].fog) / 255.0f;
}
if(m_primitiveMode.nTexture)
{
if(m_primitiveMode.nUseUV)
@ -1279,13 +1286,13 @@ void CGSH_Vulkan::Prim_Sprite()
// clang-format off
CDraw::PRIM_VERTEX vertices[] =
{
{x1, y1, z, color, s[0], t[0], 1, 0},
{x2, y1, z, color, s[1], t[0], 1, 0},
{x1, y2, z, color, s[0], t[1], 1, 0},
{x1, y1, z, color, s[0], t[0], 1, f},
{x2, y1, z, color, s[1], t[0], 1, f},
{x1, y2, z, color, s[0], t[1], 1, f},
{x1, y2, z, color, s[0], t[1], 1, 0},
{x2, y1, z, color, s[1], t[0], 1, 0},
{x2, y2, z, color, s[1], t[1], 1, 0},
{x1, y2, z, color, s[0], t[1], 1, f},
{x2, y1, z, color, s[1], t[0], 1, f},
{x2, y2, z, color, s[1], t[1], 1, f},
};
// clang-format on