Skip to content

Commit 10a1aae

Browse files
committed
Reimagined r1.3.2
1 parent 9bfb95f commit 10a1aae

File tree

1 file changed

+26
-34
lines changed

1 file changed

+26
-34
lines changed

shaders/program/shadow.glsl

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -154,49 +154,41 @@ attribute vec4 mc_Entity;
154154

155155
//Program//
156156
void main() {
157-
#ifdef PERPENDICULAR_TWEAKS
158-
vec3 normal = gl_NormalMatrix * gl_Normal;
159-
160-
if (abs(dot(normal, gl_ModelViewMatrix[2].xyz)) > 0.99 && abs(mat - 20000) < 19999) {
161-
gl_Position = vec4(-1.0);
162-
} else
163-
#endif
164-
{
165-
texCoord = gl_MultiTexCoord0.xy;
166-
glColor = gl_Color;
167-
168-
sunVec = GetSunVector();
169-
upVec = normalize(gbufferModelView[1].xyz);
157+
texCoord = gl_MultiTexCoord0.xy;
158+
glColor = gl_Color;
170159

171-
mat = int(mc_Entity.x + 0.5);
160+
sunVec = GetSunVector();
161+
upVec = normalize(gbufferModelView[1].xyz);
172162

173-
position = gl_Vertex;
163+
mat = int(mc_Entity.x + 0.5);
174164

175-
#ifdef WAVING_ANYTHING
176-
#ifdef NO_WAVING_INDOORS
177-
lmCoord = GetLightMapCoordinates();
178-
#endif
165+
position = gl_Vertex;
179166

180-
DoWave(position.xyz, mat);
167+
#ifdef WAVING_ANYTHING
168+
#ifdef NO_WAVING_INDOORS
169+
lmCoord = GetLightMapCoordinates();
181170
#endif
182171

183-
#ifdef PERPENDICULAR_TWEAKS
184-
if (mat == 10004 || mat == 10016) {
185-
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
186-
vec2 texMinMidCoord = texCoord - midCoord;
187-
if (texMinMidCoord.y < 0.0) {
188-
position.xyz += normal * 0.25;
189-
}
172+
DoWave(position.xyz, mat);
173+
#endif
174+
175+
#ifdef PERPENDICULAR_TWEAKS
176+
if (mat == 10004 || mat == 10016) {
177+
vec2 midCoord = (gl_TextureMatrix[0] * mc_midTexCoord).st;
178+
vec2 texMinMidCoord = texCoord - midCoord;
179+
if (texMinMidCoord.y < 0.0) {
180+
vec3 normal = gl_NormalMatrix * gl_Normal;
181+
position.xyz += normal * 0.25;
190182
}
191-
#endif
183+
}
184+
#endif
192185

193-
gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * position;
186+
gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * position;
194187

195-
float lVertexPos = sqrt(gl_Position.x * gl_Position.x + gl_Position.y * gl_Position.y);
196-
float distortFactor = lVertexPos * shadowMapBias + (1.0 - shadowMapBias);
197-
gl_Position.xy *= 1.0 / distortFactor;
198-
gl_Position.z = gl_Position.z * 0.2;
199-
}
188+
float lVertexPos = sqrt(gl_Position.x * gl_Position.x + gl_Position.y * gl_Position.y);
189+
float distortFactor = lVertexPos * shadowMapBias + (1.0 - shadowMapBias);
190+
gl_Position.xy *= 1.0 / distortFactor;
191+
gl_Position.z = gl_Position.z * 0.2;
200192
}
201193

202194
#endif

0 commit comments

Comments
 (0)