diff --git a/src/common/rendering/polyrenderer/backend/poly_renderstate.cpp b/src/common/rendering/polyrenderer/backend/poly_renderstate.cpp index 6c22b99b0..89577c44e 100644 --- a/src/common/rendering/polyrenderer/backend/poly_renderstate.cpp +++ b/src/common/rendering/polyrenderer/backend/poly_renderstate.cpp @@ -292,6 +292,7 @@ void PolyRenderState::Apply() constants.uAlphaThreshold = mAlphaThreshold; constants.uClipSplit = { mClipSplit[0], mClipSplit[1] }; constants.uLightIndex = mLightIndex; + constants.uDynLightColor = mStreamData.uDynLightColor; // [GEC] mDrawCommands->PushStreamData(mStreamData, constants); ApplyMatrices(); diff --git a/src/common/rendering/polyrenderer/drawers/poly_triangle.h b/src/common/rendering/polyrenderer/drawers/poly_triangle.h index ded2d65cb..a0340a3b8 100644 --- a/src/common/rendering/polyrenderer/drawers/poly_triangle.h +++ b/src/common/rendering/polyrenderer/drawers/poly_triangle.h @@ -111,6 +111,7 @@ struct PolyPushConstants // dynamic lights int uLightIndex; + FVector4 uDynLightColor; // [GEC] }; class PolyInputAssembly diff --git a/src/common/rendering/polyrenderer/drawers/screen_scanline_setup.cpp b/src/common/rendering/polyrenderer/drawers/screen_scanline_setup.cpp index 57cb3ed90..e35b826ec 100644 --- a/src/common/rendering/polyrenderer/drawers/screen_scanline_setup.cpp +++ b/src/common/rendering/polyrenderer/drawers/screen_scanline_setup.cpp @@ -260,7 +260,23 @@ static void WriteLightArray(int y, int x0, int x1, const TriDrawTriangleArgs* ar uint32_t b = vColorB[x]; uint32_t a = vColorA[x]; - lightarray[x] = MAKEARGB(a, (r * l) >> 8, (g * l) >> 8, (b * l) >> 8); + // [GEC] DynLightColor On Sprite + r = (r * l) >> 8; + g = (g * l) >> 8; + b = (b * l) >> 8; + + if (constants->uLightIndex == -1) + { + r += (uint32_t)(constants->uDynLightColor.X * 255.0f); + g += (uint32_t)(constants->uDynLightColor.Y * 255.0f); + b += (uint32_t)(constants->uDynLightColor.Z * 255.0f); + + r = MIN(r, 255); + g = MIN(g, 255); + b = MIN(b, 255); + } + + lightarray[x] = MAKEARGB(a, r, g, b); lightpos += lightstep; } } @@ -275,7 +291,23 @@ static void WriteLightArray(int y, int x0, int x1, const TriDrawTriangleArgs* ar uint32_t b = vColorB[x]; uint32_t a = vColorA[x]; - lightarray[x] = MAKEARGB(a, (r * l) >> 8, (g * l) >> 8, (b * l) >> 8); + // [GEC] DynLightColor On Sprite + r = (r * l) >> 8; + g = (g * l) >> 8; + b = (b * l) >> 8; + + if (constants->uLightIndex == -1) + { + r += (uint32_t)(constants->uDynLightColor.X * 255.0f); + g += (uint32_t)(constants->uDynLightColor.Y * 255.0f); + b += (uint32_t)(constants->uDynLightColor.Z * 255.0f); + + r = MIN(r, 255); + g = MIN(g, 255); + b = MIN(b, 255); + } + + lightarray[x] = MAKEARGB(a, r, g, b); lightpos += lightstep; } } @@ -323,6 +355,19 @@ static void WriteLightArray(int y, int x0, int x1, const TriDrawTriangleArgs* ar uint32_t r = thread->scanline.vColorR[x]; uint32_t g = thread->scanline.vColorG[x]; uint32_t b = thread->scanline.vColorB[x]; + + // [GEC] DynLightColor On Weapon + if (constants->uLightIndex == -1) + { + r += (uint32_t)(constants->uDynLightColor.X * 255.0f); + g += (uint32_t)(constants->uDynLightColor.Y * 255.0f); + b += (uint32_t)(constants->uDynLightColor.Z * 255.0f); + + r = MIN(r, 255); + g = MIN(g, 255); + b = MIN(b, 255); + } + lightarray[x] = MAKEARGB(a, r, g, b); } }