Skip to content

Commit

Permalink
[rend2] Fix surface sprites vertex colors behaviour
Browse files Browse the repository at this point in the history
Vanilla doesn't use rgbGens for surface sprites, only the approximated lighting from the emitting surfaces vertex colors.
  • Loading branch information
SomaZ committed Jun 12, 2024
1 parent 574197f commit aac82ec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion shared/rd-rend2/tr_bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3823,7 +3823,8 @@ static int R_CreateSurfaceSpritesVertexData(
const srfVert_t *verts = bspSurf->verts;
const glIndex_t *indexes = bspSurf->indexes;

vec4_t color = { 1.0, 1.0, 1.0, 1.0 };
#if 0
vec4_t color = { 1.0f, 1.0f, 1.0f, 1.0f };
if (stage->rgbGen == CGEN_CONST)
{
color[0] = stage->constantColor[0];
Expand All @@ -3835,6 +3836,13 @@ static int R_CreateSurfaceSpritesVertexData(
stage->rgbGen == CGEN_EXACT_VERTEX ||
stage->rgbGen == CGEN_VERTEX_LIT ||
stage->rgbGen == CGEN_EXACT_VERTEX_LIT);
#else
// Vanilla behaviour is always: color by vertex color of the emitting surface
// even just the blue component used for all three color channels to be exact
// in pseudo code: outVert.rgb = inVert.bbb;
bool vertexLit = true;
vec4_t color = { 1.0f, 1.0f, 1.0f, 1.0f };
#endif

int numSprites = 0;
for ( int i = 0, numIndexes = bspSurf->numIndexes; i < numIndexes; i += 3 )
Expand Down

0 comments on commit aac82ec

Please sign in to comment.