Skip to content

Commit

Permalink
Merge branch 'refs/heads/refractor' into 1.20.1-new
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Apr 23, 2024
2 parents 318a4d0 + f044ff0 commit 4cf87c8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,46 +131,42 @@ public static FallbackShader createFallback(String name, GlFramebuffer writingTo
String fragment = ShaderSynthesizer.fsh(inputs, fogMode, alpha, intensityTex, isLeash);


String shaderJsonString = """
{
" "blend": {
" "func": "add",
" "srcrgb": "srcalpha",
" "dstrgb": "1-srcalpha"
" },
" "vertex": "" + name + "",
" "fragment": "" + name + "",
" "attributes": [
" "Position",
" "Color",
(inputs.hasTex() ? " "UV0",
" : "") +
(inputs.hasOverlay() ? " "UV1",
" : "") +
(inputs.hasLight() ? " "UV2",
" : "") +
" "Normal"
" ],
" "uniforms": [
" { "name": "TextureMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
" { "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
" { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
" { "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
" { "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
" { "name": "GlintAlpha", "type": "float", "count": 1, "values": [ 1.0 ] },
" { "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
" { "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
" { "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
" { "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
" { "name": "FogDensity", "type": "float", "count": 1, "values": [ 1.0 ] },
" { "name": "FogIsExp2", "type": "int", "count": 1, "values": [ 0 ] },
" { "name": "AlphaTestValue", "type": "float", "count": 1, "values": [ 0.0 ] },
" { "name": "LineWidth", "type": "float", "count": 1, "values": [ 1.0 ] },
" { "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
" { "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
" ]
"}""";

String shaderJsonString = String.format("""
{
"blend": {
"func": "add",
"srcrgb": "srcalpha",
"dstrgb": "1-srcalpha"
},
"vertex": "%s",
"fragment": "%s",
"attributes": [
"Position",
"Color",
"UV0",
"UV1",
"UV2",
"Normal"
],
"uniforms": [
{ "name": "TextureMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "ModelViewMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
{ "name": "ChunkOffset", "type": "float", "count": 3, "values": [ 0.0, 0.0, 0.0 ] },
{ "name": "ColorModulator", "type": "float", "count": 4, "values": [ 1.0, 1.0, 1.0, 1.0 ] },
{ "name": "GlintAlpha", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "Light0_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
{ "name": "Light1_Direction", "type": "float", "count": 3, "values": [0.0, 0.0, 0.0] },
{ "name": "FogStart", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "FogEnd", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "FogDensity", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "FogIsExp2", "type": "int", "count": 1, "values": [ 0 ] },
{ "name": "AlphaTestValue", "type": "float", "count": 1, "values": [ 0.0 ] },
{ "name": "LineWidth", "type": "float", "count": 1, "values": [ 1.0 ] },
{ "name": "ScreenSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
{ "name": "FogColor", "type": "float", "count": 4, "values": [ 0.0, 0.0, 0.0, 0.0 ] }
]
}""", name, name);
ShaderPrinter.printProgram(name)
.addSource(PatchShaderType.VERTEX, vertex)
.addSource(PatchShaderType.FRAGMENT, fragment)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/irisshaders/iris/shaderpack/IdMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private static Optional<Properties> loadProperties(Path shaderPath, String name,
}

// TODO: This is the worst code I have ever made. Do not do this.
String processed = PropertiesPreprocessor.preprocessSource(fileContents, shaderPackOptions, environmentDefines).replaceAll("\\\\\\n\\s*\\n", " ").replaceAll("\\S\s*block.", "\nblock.");
String processed = PropertiesPreprocessor.preprocessSource(fileContents, shaderPackOptions, environmentDefines).replaceAll("\\\\\\n\\s*\\n", " ").replaceAll("\\S\s*block\\.", "\nblock.");

StringReader propertiesReader = new StringReader(processed);

Expand Down

0 comments on commit 4cf87c8

Please sign in to comment.