Skip to content

Commit

Permalink
fixup: float lightFactors
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed Feb 8, 2024
1 parent 05e08ce commit 4f8f103
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/engine/renderer/gl_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -1426,30 +1426,30 @@ class GLCompileMacro_USE_ALPHA_TESTING :
};

class u_LightFactor :
GLUniform1i
GLUniform1f
{
public:
u_LightFactor( GLShader *shader ) :
GLUniform1i( shader, "u_LightFactor" )
GLUniform1f( shader, "u_LightFactor" )
{
}

void SetUniform_LightFactor( const int lightFactor )
void SetUniform_LightFactor( const float lightFactor )
{
this->SetValue( lightFactor );
}
};

class u_LightFactors :
GLUniform2i
GLUniform2f
{
public:
u_LightFactors( GLShader *shader ) :
GLUniform2i( shader, "u_LightFactors" )
GLUniform2f( shader, "u_LightFactors" )
{
}

void SetUniform_LightFactors( const ivec2_t lightFactors )
void SetUniform_LightFactors( const vec2_t lightFactors )
{
this->SetValue( lightFactors );
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/generic_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
uniform sampler2D u_ColorMap;

#if !defined(GENERIC_2D) && defined(USE_TCGEN_LIGHTMAP)
uniform int u_LightFactor;
uniform float u_LightFactor;
#endif

uniform bool u_LinearizeTexture;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/lightMapping_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ uniform sampler2D u_DiffuseMap;
uniform sampler2D u_MaterialMap;
uniform sampler2D u_GlowMap;

uniform ivec2 u_LightFactors;
uniform vec2 u_LightFactors;
#define u_LightFactor u_LightFactors[0]
uniform bvec2 u_LinearizeTextures;
#define u_LinearizeTexture u_LinearizeTextures[0]
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/lightMapping_vp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ uniform vec2 u_MapOverBrightBitsPowers;

uniform mat4 u_ModelViewProjectionMatrix;

uniform ivec2 u_LightFactors;
uniform vec2 u_LightFactors;
#define u_VertexLightFactor u_LightFactors[1]

uniform float u_Time;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/tr_bsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6958,7 +6958,7 @@ void RE_LoadWorldMap( const char *name )

tr.worldLight = tr.lightMode;
tr.modelDeluxe = deluxeMode_t::NONE;
tr.mapLightFactor = 1;
tr.mapLightFactor = 1.0;

if ( tr.worldLight == lightMode_t::FULLBRIGHT )
{
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -2828,7 +2828,7 @@ enum class deluxeMode_t { NONE, GRID, MAP };
// r_mapOverbrightBits->integer, but can be overridden by mapper using the worldspawn
int mapOverBrightBits;
// pow(2, mapOverbrightBits)
int mapLightFactor;
float mapLightFactor;
// Must be false on legacy map: clamp multiplied color and normalize colors.
bool mapCompleteOverBright;

Expand Down
6 changes: 3 additions & 3 deletions src/engine/renderer/tr_shade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,8 @@ static void Render_lightMapping( shaderStage_t *pStage )

uint32_t stateBits = pStage->stateBits;

int lightFactor = 1;
int vertexLightFactor = 1;
float lightFactor = 1.0;
float vertexLightFactor = 1.0;

switch ( lightMode )
{
Expand Down Expand Up @@ -1046,7 +1046,7 @@ static void Render_lightMapping( shaderStage_t *pStage )
vec3_t viewOrigin;

// u_LightFactors
ivec2_t lightFactors;
vec2_t lightFactors;
lightFactors[ 0 ] = lightFactor;
lightFactors[ 1 ] = vertexLightFactor;
gl_lightMappingShader->SetUniform_LightFactors( lightFactors );
Expand Down

0 comments on commit 4f8f103

Please sign in to comment.