Skip to content

Commit 552cc35

Browse files
committed
Add RSF_FORCE_LIGHTMAP
Replaces RSF_NOLIGHTSCALE. If this flag is used when registering a shader, all `ST_COLORMAP` stages will be changed to `ST_DIFFUSEMAP`. This is intended for use with particles and trails, to make them use the lightGrid in the GLSL code.
1 parent d138796 commit 552cc35

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/engine/renderer/tr_local.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,8 @@ enum class shaderProfilerRenderSubGroupsMode {
13221322

13231323
int autoSpriteMode;
13241324

1325+
bool forceLightMap;
1326+
13251327
uint8_t numDeforms;
13261328
deformStage_t deforms[ MAX_SHADER_DEFORMS ];
13271329

src/engine/renderer/tr_shader.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5888,6 +5888,17 @@ static shader_t *FinishShader()
58885888
numStages = MAX_SHADER_STAGES;
58895889
GroupActiveStages();
58905890

5891+
if ( shader.forceLightMap ) {
5892+
for( size_t stage = 0; stage < numStages; stage++ ) {
5893+
shaderStage_t* pStage = &stages[numStages];
5894+
5895+
// TODO: Add lightmap as the first stage if there's a heatHaze stage here?
5896+
if ( pStage->type == stageType_t::ST_COLORMAP ) {
5897+
pStage->type = stageType_t::ST_DIFFUSEMAP;
5898+
}
5899+
}
5900+
}
5901+
58915902
// set appropriate stage information
58925903
for ( size_t stage = 0; stage < numStages; stage++ )
58935904
{
@@ -6375,6 +6386,11 @@ shader_t *R_FindShader( const char *name, shaderType_t type, int flags )
63756386
shader.entitySpriteFaceViewDirection = true;
63766387
}
63776388

6389+
if ( flags & RSF_FORCE_LIGHTMAP )
6390+
{
6391+
shader.forceLightMap = true;
6392+
}
6393+
63786394
// attempt to define shader from an explicit parameter file
63796395
shaderText = FindShaderInShaderText( strippedName );
63806396

src/engine/renderer/tr_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ enum RegisterShaderFlags_t {
9090
RSF_NOMIP = BIT( 2 ),
9191
RSF_FITSCREEN = BIT( 3 ),
9292
RSF_LIGHT_ATTENUATION = BIT( 4 ),
93-
RSF_NOLIGHTSCALE = BIT( 5 ), // TODO(0.56): delete, does nothing
93+
RSF_FORCE_LIGHTMAP = BIT( 5 ), // Used to make particles/trails work with the lightGrid in GLSL
9494
RSF_SPRITE = BIT( 6 ),
9595
};
9696

0 commit comments

Comments
 (0)