Skip to content

Commit d891681

Browse files
author
jK
committed
minor changes to SMFVertProg.glsl
1 parent 31507d9 commit d891681

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

cont/base/springcontent/shaders/GLSL/SMFVertProg.glsl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,12 @@ void main() {
2929
halfDir = normalize(lightDir.xyz + viewDir);
3030
vertexWorldPos = gl_Vertex;
3131

32-
gl_Position = gl_ModelViewMatrix * gl_Vertex;
33-
float fogCoord = length(gl_Position.xyz);
34-
gl_Position = gl_ProjectionMatrix * gl_Position;
3532

3633
diffuseTexCoords = floor(gl_Vertex.xz) / SMF_TEXSQR_SIZE - vec2(ivec2(texSquareX, texSquareZ));
3734
specularTexCoords = gl_Vertex.xz / mapSize.xy;
3835
normalTexCoords = gl_Vertex.xz / mapSizePO2.xy;
3936

40-
// detail-tex coors
37+
// detail-tex coords
4138
#if (SMF_DETAIL_TEXTURE_SPLATTING == 0)
4239
gl_TexCoord[0].st = gl_Vertex.xz * vec2(SMF_DETAILTEX_RES);
4340
#else
@@ -47,7 +44,11 @@ void main() {
4744
gl_TexCoord[1].pq = gl_Vertex.xz * vec2(splatTexScales.a);
4845
#endif
4946

47+
gl_Position = gl_ModelViewMatrix * gl_Vertex;
48+
float fogCoord = length(gl_Position.xyz);
49+
gl_Position = gl_ProjectionMatrix * gl_Position;
50+
5051
// emulate linear fog
51-
fogFactor = (gl_Fog.end - fogCoord) / (gl_Fog.end - gl_Fog.start);
52+
fogFactor = (gl_Fog.end - fogCoord) * gl_Fog.scale; // gl_Fog.scale == 1.0 / (gl_Fog.end - gl_Fog.start)
5253
fogFactor = clamp(fogFactor, 0.0, 1.0);
5354
}

0 commit comments

Comments
 (0)