Skip to content

Commit eac1ff9

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 c79e079 commit eac1ff9

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
@@ -1319,6 +1319,8 @@ enum class shaderProfilerRenderSubGroupsMode {
13191319

13201320
int autoSpriteMode;
13211321

1322+
bool forceLightMap;
1323+
13221324
uint8_t numDeforms;
13231325
deformStage_t deforms[ MAX_SHADER_DEFORMS ];
13241326

src/engine/renderer/tr_shader.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5869,6 +5869,17 @@ static shader_t *FinishShader()
58695869
numStages = MAX_SHADER_STAGES;
58705870
GroupActiveStages();
58715871

5872+
if ( shader.forceLightMap ) {
5873+
for( size_t stage = 0; stage < numStages; stage++ ) {
5874+
shaderStage_t* pStage = &stages[numStages];
5875+
5876+
// TODO: Add lightmap as the first stage if there's a heatHaze stage here?
5877+
if ( pStage->type == stageType_t::ST_COLORMAP ) {
5878+
pStage->type = stageType_t::ST_DIFFUSEMAP;
5879+
}
5880+
}
5881+
}
5882+
58725883
// set appropriate stage information
58735884
for ( size_t stage = 0; stage < numStages; stage++ )
58745885
{
@@ -6233,6 +6244,11 @@ shader_t *R_FindShader( const char *name, shaderType_t type, int flags )
62336244
shader.entitySpriteFaceViewDirection = true;
62346245
}
62356246

6247+
if ( flags & RSF_FORCE_LIGHTMAP )
6248+
{
6249+
shader.forceLightMap = true;
6250+
}
6251+
62366252
// attempt to define shader from an explicit parameter file
62376253
shaderText = FindShaderInShaderText( strippedName );
62386254

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)