Skip to content

Commit ef0355d

Browse files
committed
glsl/parallax: meaningful symbol names
1 parent bedf6a3 commit ef0355d

12 files changed

Lines changed: 136 additions & 133 deletions

src/engine/renderer/gl_shader.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,8 +1407,8 @@ GLShader_lightMapping::GLShader_lightMapping( GLShaderManager *manager ) :
14071407
u_ViewOrigin( this ),
14081408
u_ModelMatrix( this ),
14091409
u_ModelViewProjectionMatrix( this ),
1410-
u_OffsetScale( this ),
1411-
u_OffsetBias( this ),
1410+
u_ParallaxDepthScale( this ),
1411+
u_ParallaxOffsetBias( this ),
14121412
u_HeightMapInNormalMap( this ),
14131413
u_NormalFormat( this ),
14141414
u_numLights( this ),
@@ -1460,8 +1460,8 @@ GLShader_vertexLighting_DBS_entity::GLShader_vertexLighting_DBS_entity( GLShader
14601460
u_ModelViewProjectionMatrix( this ),
14611461
u_Bones( this ),
14621462
u_VertexInterpolation( this ),
1463-
u_OffsetScale( this ),
1464-
u_OffsetBias( this ),
1463+
u_ParallaxDepthScale( this ),
1464+
u_ParallaxOffsetBias( this ),
14651465
u_HeightMapInNormalMap( this ),
14661466
u_NormalFormat( this ),
14671467
u_EnvironmentInterpolation( this ),
@@ -1524,8 +1524,8 @@ GLShader_vertexLighting_DBS_world::GLShader_vertexLighting_DBS_world( GLShaderMa
15241524
u_ViewOrigin( this ),
15251525
u_ModelMatrix( this ),
15261526
u_ModelViewProjectionMatrix( this ),
1527-
u_OffsetScale( this ),
1528-
u_OffsetBias( this ),
1527+
u_ParallaxDepthScale( this ),
1528+
u_ParallaxOffsetBias( this ),
15291529
u_HeightMapInNormalMap( this ),
15301530
u_NormalFormat( this ),
15311531
u_LightWrapAround( this ),
@@ -1588,8 +1588,8 @@ GLShader_forwardLighting_omniXYZ::GLShader_forwardLighting_omniXYZ( GLShaderMana
15881588
u_ModelViewProjectionMatrix( this ),
15891589
u_Bones( this ),
15901590
u_VertexInterpolation( this ),
1591-
u_OffsetScale( this ),
1592-
u_OffsetBias( this ),
1591+
u_ParallaxDepthScale( this ),
1592+
u_ParallaxOffsetBias( this ),
15931593
u_HeightMapInNormalMap( this ),
15941594
u_NormalFormat( this ),
15951595
GLDeformStage( this ),
@@ -1649,8 +1649,8 @@ GLShader_forwardLighting_projXYZ::GLShader_forwardLighting_projXYZ( GLShaderMana
16491649
u_ModelViewProjectionMatrix( this ),
16501650
u_Bones( this ),
16511651
u_VertexInterpolation( this ),
1652-
u_OffsetScale( this ),
1653-
u_OffsetBias( this ),
1652+
u_ParallaxDepthScale( this ),
1653+
u_ParallaxOffsetBias( this ),
16541654
u_HeightMapInNormalMap( this ),
16551655
u_NormalFormat( this ),
16561656
GLDeformStage( this ),
@@ -1713,8 +1713,8 @@ GLShader_forwardLighting_directionalSun::GLShader_forwardLighting_directionalSun
17131713
u_ModelViewProjectionMatrix( this ),
17141714
u_Bones( this ),
17151715
u_VertexInterpolation( this ),
1716-
u_OffsetScale( this ),
1717-
u_OffsetBias( this ),
1716+
u_ParallaxDepthScale( this ),
1717+
u_ParallaxOffsetBias( this ),
17181718
u_HeightMapInNormalMap( this ),
17191719
u_NormalFormat( this ),
17201720
GLDeformStage( this ),
@@ -1795,8 +1795,8 @@ GLShader_reflection::GLShader_reflection( GLShaderManager *manager ):
17951795
u_ModelMatrix( this ),
17961796
u_ModelViewProjectionMatrix( this ),
17971797
u_Bones( this ),
1798-
u_OffsetScale( this ),
1799-
u_OffsetBias( this ),
1798+
u_ParallaxDepthScale( this ),
1799+
u_ParallaxOffsetBias( this ),
18001800
u_HeightMapInNormalMap( this ),
18011801
u_NormalScale( this ),
18021802
u_NormalFormat( this ),
@@ -2061,8 +2061,8 @@ GLShader_liquid::GLShader_liquid( GLShaderManager *manager ) :
20612061
u_FresnelPower( this ),
20622062
u_FresnelScale( this ),
20632063
u_FresnelBias( this ),
2064-
u_OffsetScale( this ),
2065-
u_OffsetBias( this ),
2064+
u_ParallaxDepthScale( this ),
2065+
u_ParallaxOffsetBias( this ),
20662066
u_HeightMapInNormalMap( this ),
20672067
u_NormalScale( this ),
20682068
u_NormalFormat( this ),

src/engine/renderer/gl_shader.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,31 +1992,31 @@ class u_DepthScale :
19921992
}
19931993
};
19941994

1995-
class u_OffsetScale :
1995+
class u_ParallaxDepthScale :
19961996
GLUniform1f
19971997
{
19981998
public:
1999-
u_OffsetScale( GLShader *shader ) :
2000-
GLUniform1f( shader, "u_OffsetScale" )
1999+
u_ParallaxDepthScale( GLShader *shader ) :
2000+
GLUniform1f( shader, "u_ParallaxDepthScale" )
20012001
{
20022002
}
20032003

2004-
void SetUniform_OffsetScale( float value )
2004+
void SetUniform_ParallaxDepthScale( float value )
20052005
{
20062006
this->SetValue( value );
20072007
}
20082008
};
20092009

2010-
class u_OffsetBias :
2010+
class u_ParallaxOffsetBias :
20112011
GLUniform1f
20122012
{
20132013
public:
2014-
u_OffsetBias( GLShader *shader ) :
2015-
GLUniform1f( shader, "u_OffsetBias" )
2014+
u_ParallaxOffsetBias( GLShader *shader ) :
2015+
GLUniform1f( shader, "u_ParallaxOffsetBias" )
20162016
{
20172017
}
20182018

2019-
void SetUniform_OffsetBias( float value )
2019+
void SetUniform_ParallaxOffsetBias( float value )
20202020
{
20212021
this->SetValue( value );
20222022
}
@@ -2403,8 +2403,8 @@ class GLShader_lightMapping :
24032403
public u_ViewOrigin,
24042404
public u_ModelMatrix,
24052405
public u_ModelViewProjectionMatrix,
2406-
public u_OffsetScale,
2407-
public u_OffsetBias,
2406+
public u_ParallaxDepthScale,
2407+
public u_ParallaxOffsetBias,
24082408
public u_HeightMapInNormalMap,
24092409
public u_NormalFormat,
24102410
public u_numLights,
@@ -2434,8 +2434,8 @@ class GLShader_vertexLighting_DBS_entity :
24342434
public u_ModelViewProjectionMatrix,
24352435
public u_Bones,
24362436
public u_VertexInterpolation,
2437-
public u_OffsetScale,
2438-
public u_OffsetBias,
2437+
public u_ParallaxDepthScale,
2438+
public u_ParallaxOffsetBias,
24392439
public u_HeightMapInNormalMap,
24402440
public u_NormalFormat,
24412441
public u_EnvironmentInterpolation,
@@ -2471,8 +2471,8 @@ class GLShader_vertexLighting_DBS_world :
24712471
public u_ViewOrigin,
24722472
public u_ModelMatrix,
24732473
public u_ModelViewProjectionMatrix,
2474-
public u_OffsetScale,
2475-
public u_OffsetBias,
2474+
public u_ParallaxDepthScale,
2475+
public u_ParallaxOffsetBias,
24762476
public u_HeightMapInNormalMap,
24772477
public u_NormalFormat,
24782478
public u_LightWrapAround,
@@ -2514,8 +2514,8 @@ class GLShader_forwardLighting_omniXYZ :
25142514
public u_ModelViewProjectionMatrix,
25152515
public u_Bones,
25162516
public u_VertexInterpolation,
2517-
public u_OffsetScale,
2518-
public u_OffsetBias,
2517+
public u_ParallaxDepthScale,
2518+
public u_ParallaxOffsetBias,
25192519
public u_HeightMapInNormalMap,
25202520
public u_NormalFormat,
25212521
public GLDeformStage,
@@ -2555,8 +2555,8 @@ class GLShader_forwardLighting_projXYZ :
25552555
public u_ModelViewProjectionMatrix,
25562556
public u_Bones,
25572557
public u_VertexInterpolation,
2558-
public u_OffsetScale,
2559-
public u_OffsetBias,
2558+
public u_ParallaxDepthScale,
2559+
public u_ParallaxOffsetBias,
25602560
public u_HeightMapInNormalMap,
25612561
public u_NormalFormat,
25622562
public GLDeformStage,
@@ -2598,8 +2598,8 @@ class GLShader_forwardLighting_directionalSun :
25982598
public u_ModelViewProjectionMatrix,
25992599
public u_Bones,
26002600
public u_VertexInterpolation,
2601-
public u_OffsetScale,
2602-
public u_OffsetBias,
2601+
public u_ParallaxDepthScale,
2602+
public u_ParallaxOffsetBias,
26032603
public u_HeightMapInNormalMap,
26042604
public u_NormalFormat,
26052605
public GLDeformStage,
@@ -2646,8 +2646,8 @@ class GLShader_reflection :
26462646
public u_ModelMatrix,
26472647
public u_ModelViewProjectionMatrix,
26482648
public u_Bones,
2649-
public u_OffsetScale,
2650-
public u_OffsetBias,
2649+
public u_ParallaxDepthScale,
2650+
public u_ParallaxOffsetBias,
26512651
public u_HeightMapInNormalMap,
26522652
public u_NormalScale,
26532653
public u_NormalFormat,
@@ -2853,8 +2853,8 @@ class GLShader_liquid :
28532853
public u_FresnelPower,
28542854
public u_FresnelScale,
28552855
public u_FresnelBias,
2856-
public u_OffsetScale,
2857-
public u_OffsetBias,
2856+
public u_ParallaxDepthScale,
2857+
public u_ParallaxOffsetBias,
28582858
public u_HeightMapInNormalMap,
28592859
public u_NormalScale,
28602860
public u_NormalFormat,

src/engine/renderer/glsl_source/forwardLighting_fp.glsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ uniform float u_ShadowBlur;
7979

8080
uniform mat4 u_ViewMatrix;
8181

82-
uniform float u_OffsetScale;
83-
uniform float u_OffsetBias;
82+
uniform float u_ParallaxDepthScale;
83+
uniform float u_ParallaxOffsetBias;
8484

8585
IN(smooth) vec3 var_Position;
8686
IN(smooth) vec4 var_TexDiffuse;
@@ -959,7 +959,7 @@ void main()
959959

960960
#if defined(USE_PARALLAX_MAPPING)
961961
// compute texcoords offset from heightmap
962-
vec2 texOffset = ParallaxTexOffset(u_NormalMap, texNormal, u_OffsetScale, u_OffsetBias, viewDir, tangentToWorldMatrix);
962+
vec2 texOffset = ParallaxTexOffset(u_NormalMap, texNormal, u_ParallaxDepthScale, u_ParallaxOffsetBias, viewDir, tangentToWorldMatrix);
963963

964964
texDiffuse += texOffset;
965965
texNormal += texOffset;

src/engine/renderer/glsl_source/lightMapping_fp.glsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ uniform sampler2D u_LightMap;
2929
uniform sampler2D u_DeluxeMap;
3030
uniform float u_AlphaThreshold;
3131
uniform vec3 u_ViewOrigin;
32-
uniform float u_OffsetScale;
33-
uniform float u_OffsetBias;
32+
uniform float u_ParallaxDepthScale;
33+
uniform float u_ParallaxOffsetBias;
3434

3535
IN(smooth) vec3 var_Position;
3636
IN(smooth) vec4 var_TexDiffuseGlow;
@@ -59,7 +59,7 @@ void main()
5959

6060
#if defined(USE_PARALLAX_MAPPING)
6161
// compute texcoords offset from heightmap
62-
vec2 texOffset = ParallaxTexOffset(u_NormalMap, texNormal, u_OffsetScale, u_OffsetBias, viewDir, tangentToWorldMatrix);
62+
vec2 texOffset = ParallaxTexOffset(u_NormalMap, texNormal, u_ParallaxDepthScale, u_ParallaxOffsetBias, viewDir, tangentToWorldMatrix);
6363

6464
texDiffuse += texOffset;
6565
texGlow += texOffset;

src/engine/renderer/glsl_source/liquid_fp.glsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ uniform float u_RefractionIndex;
3333
uniform float u_FresnelPower;
3434
uniform float u_FresnelScale;
3535
uniform float u_FresnelBias;
36-
uniform float u_OffsetScale;
37-
uniform float u_OffsetBias;
36+
uniform float u_ParallaxDepthScale;
37+
uniform float u_ParallaxOffsetBias;
3838
uniform float u_NormalScale;
3939
uniform mat4 u_ModelMatrix;
4040
uniform mat4 u_UnprojectMatrix;
@@ -99,7 +99,7 @@ void main()
9999
// ray intersect in view direction
100100

101101
// compute texcoords offset from heightmap
102-
vec2 texOffset = ParallaxTexOffset(u_NormalMap, texNormal, u_OffsetScale, u_OffsetBias, viewDir, tangentToWorldMatrix);
102+
vec2 texOffset = ParallaxTexOffset(u_NormalMap, texNormal, u_ParallaxDepthScale, u_ParallaxOffsetBias, viewDir, tangentToWorldMatrix);
103103

104104
texScreen += texOffset;
105105
texNormal += texOffset;

src/engine/renderer/glsl_source/reflection_CB_fp.glsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ uniform samplerCube u_ColorMap;
2626
uniform sampler2D u_NormalMap;
2727
uniform vec3 u_ViewOrigin;
2828
uniform mat4 u_ModelMatrix;
29-
uniform float u_OffsetScale;
30-
uniform float u_OffsetBias;
29+
uniform float u_ParallaxDepthScale;
30+
uniform float u_ParallaxOffsetBias;
3131

3232
IN(smooth) vec3 var_Position;
3333
IN(smooth) vec2 var_TexNormal;
@@ -48,7 +48,7 @@ void main()
4848

4949
#if defined(USE_PARALLAX_MAPPING)
5050
// compute texcoords offset from heightmap
51-
vec2 texOffset = ParallaxTexOffset(u_NormalMap, texNormal, u_OffsetScale, u_OffsetBias, viewDir, tangentToWorldMatrix);
51+
vec2 texOffset = ParallaxTexOffset(u_NormalMap, texNormal, u_ParallaxDepthScale, u_ParallaxOffsetBias, viewDir, tangentToWorldMatrix);
5252

5353
texNormal += texOffset;
5454
#endif // USE_PARALLAX_MAPPING

0 commit comments

Comments
 (0)