Iris support v1

This commit is contained in:
mcrcortex
2024-02-18 12:02:57 +10:00
parent 4d29cc4889
commit 71cfe67fe7
12 changed files with 119 additions and 16 deletions

View File

@@ -13,6 +13,7 @@ uint faceHasAlphaCuttout(uint faceData) {
return (faceData>>22)&1u;
}
//TODO: try and get rid of
uint faceHasAlphaCuttoutOverride(uint faceData) {
return (faceData>>23)&1u;
}

View File

@@ -0,0 +1,32 @@
#version 450 core
layout(binding = 0) uniform sampler2D colourTex;
layout(binding = 1) uniform sampler2D depthTex;
layout(location = 2) uniform mat4 invProjMat;
layout(location = 3) uniform mat4 projMat;
out vec4 colour;
in vec2 UV;
vec3 rev3d(vec3 clip) {
vec4 view = invProjMat * vec4(clip*2.0-1.0,1.0);
return view.xyz/view.w;
}
float projDepth(vec3 pos) {
vec4 view = projMat * vec4(pos, 1);
return view.z/view.w;
}
void main() {
colour = texture(colourTex, UV.xy);
if (colour.a == 0.0) {
discard;
}
float depth = texture(depthTex, UV.xy).r;
depth = projDepth(rev3d(vec3(UV.xy, depth)));
depth = min(1f-(2f/((1<<24)-1)), depth);
depth = depth * 0.5f + 0.5f;
depth = gl_DepthRange.diff * depth + gl_DepthRange.near;
gl_FragDepth = depth;
}

View File

@@ -16,6 +16,7 @@
"defaultRequire": 1
},
"mixins": [
"sodium.MixinDefaultChunkRenderer",
"sodium.MixinRenderSectionManager"
]
}