Skip to content

Commit

Permalink
Fix issues with some synthesized shaders (#2537)
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Jan 18, 2025
1 parent cc2c662 commit 3040616
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public static String vsh(boolean hasChunkOffset, ShaderAttributeInputs inputs, F

// Copied from Mojang code.
shader.append("vec4 minecraft_mix_light(vec3 lightDir0, vec3 lightDir1, vec3 normal, vec4 color) {\n" +
" lightDir0 = normalize(lightDir0);\n" +
" lightDir1 = normalize(lightDir1);\n" +
// " lightDir0 = normalize(lightDir0);\n" +
// " lightDir1 = normalize(lightDir1);\n" +
" float light0 = max(0.0, dot(lightDir0, normal));\n" +
" float light1 = max(0.0, dot(lightDir1, normal));\n" +
" float lightAccum = min(1.0, (light0 + light1) * 0.6 + 0.4);\n" +
Expand Down Expand Up @@ -122,7 +122,8 @@ public static String vsh(boolean hasChunkOffset, ShaderAttributeInputs inputs, F
shader.append("in vec2 UV0;\n");
shader.append("out vec2 texCoord;\n");

main.append(" texCoord = UV0;\n");
shader.append("uniform mat4 TextureMat;\n");
main.append(" texCoord = (TextureMat * vec4(UV0, 0.0, 1.0)).xy;\n");
}

// Fog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public enum ShaderKey {
TEXTURED(ProgramId.Textured, AlphaTests.NON_ZERO_ALPHA, DefaultVertexFormat.POSITION_TEX, FogMode.OFF, LightingModel.LIGHTMAP),
TEXTURED_COLOR(ProgramId.Textured, AlphaTests.ONE_TENTH_ALPHA, DefaultVertexFormat.POSITION_TEX_COLOR, FogMode.OFF, LightingModel.LIGHTMAP),
SPS(ProgramId.SpiderEyes, AlphaTests.OFF, DefaultVertexFormat.POSITION_TEX_COLOR, FogMode.PER_FRAGMENT, LightingModel.FULLBRIGHT),
SKY_BASIC(ProgramId.SkyBasic, AlphaTests.OFF, DefaultVertexFormat.POSITION, FogMode.PER_VERTEX, LightingModel.LIGHTMAP),
SKY_BASIC(ProgramId.SkyBasic, AlphaTests.OFF, DefaultVertexFormat.POSITION, FogMode.OFF, LightingModel.FULLBRIGHT),
SKY_BASIC_COLOR(ProgramId.SkyBasic, AlphaTests.NON_ZERO_ALPHA, DefaultVertexFormat.POSITION_COLOR, FogMode.OFF, LightingModel.LIGHTMAP),
SKY_TEXTURED(ProgramId.SkyTextured, AlphaTests.OFF, DefaultVertexFormat.POSITION_TEX, FogMode.OFF, LightingModel.LIGHTMAP),
SKY_TEXTURED_COLOR(ProgramId.SkyTextured, AlphaTests.OFF, DefaultVertexFormat.POSITION_TEX_COLOR, FogMode.OFF, LightingModel.LIGHTMAP),
Expand Down

0 comments on commit 3040616

Please sign in to comment.