use same fade apply frag shader
This commit is contained in:
+1
-13
@@ -48,8 +48,6 @@ public class DhFadeApplyShader extends AbstractShaderRenderer
|
||||
|
||||
// uniforms
|
||||
public int uFadeColorTextureUniform = -1;
|
||||
public int uDhDepthTextureUniform = -1;
|
||||
public int uMcDepthTextureUniform = -1;
|
||||
|
||||
|
||||
|
||||
@@ -62,14 +60,12 @@ public class DhFadeApplyShader extends AbstractShaderRenderer
|
||||
{
|
||||
this.shader = new ShaderProgram(
|
||||
"shaders/normal.vert",
|
||||
"shaders/dhFade/apply.frag",
|
||||
"shaders/fade/apply.frag",
|
||||
"fragColor",
|
||||
new String[]{ "vPosition" });
|
||||
|
||||
// uniform setup
|
||||
this.uFadeColorTextureUniform = this.shader.getUniformLocation("uFadeColorTextureUniform");
|
||||
this.uDhDepthTextureUniform = this.shader.getUniformLocation("uDhDepthTextureUniform");
|
||||
this.uMcDepthTextureUniform = this.shader.getUniformLocation("uMcDepthTextureUniform");
|
||||
|
||||
}
|
||||
|
||||
@@ -86,14 +82,6 @@ public class DhFadeApplyShader extends AbstractShaderRenderer
|
||||
GLMC.glBindTexture(this.fadeTexture);
|
||||
GL32.glUniform1i(this.uFadeColorTextureUniform, 0);
|
||||
|
||||
GLMC.glActiveTexture(GL32.GL_TEXTURE1);
|
||||
GLMC.glBindTexture(LodRenderer.INSTANCE.getActiveDepthTextureId());
|
||||
GL32.glUniform1i(this.uDhDepthTextureUniform, 1);
|
||||
|
||||
GLMC.glActiveTexture(GL32.GL_TEXTURE2);
|
||||
GLMC.glBindTexture(MC_RENDER.getDepthTextureId());
|
||||
GL32.glUniform1i(this.uMcDepthTextureUniform, 2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
-2
@@ -66,8 +66,10 @@ public class DhFadeShader extends AbstractShaderRenderer
|
||||
public void onInit()
|
||||
{
|
||||
this.shader = new ShaderProgram(
|
||||
"shaders/normal.vert", "shaders/dhFade/fade.frag",
|
||||
"fragColor", new String[]{"vPosition"}
|
||||
"shaders/normal.vert",
|
||||
"shaders/fade/dhFade.frag",
|
||||
"fragColor",
|
||||
new String[]{"vPosition"}
|
||||
);
|
||||
|
||||
// all uniforms should be tryGet...
|
||||
|
||||
+1
-12
@@ -48,8 +48,6 @@ public class VanillaFadeApplyShader extends AbstractShaderRenderer
|
||||
|
||||
// uniforms
|
||||
public int uFadeColorTextureUniform = -1;
|
||||
public int uDhDepthTextureUniform = -1;
|
||||
public int uMcDepthTextureUniform = -1;
|
||||
|
||||
|
||||
|
||||
@@ -62,13 +60,12 @@ public class VanillaFadeApplyShader extends AbstractShaderRenderer
|
||||
{
|
||||
this.shader = new ShaderProgram(
|
||||
"shaders/normal.vert",
|
||||
"shaders/vanillaFade/apply.frag",
|
||||
"shaders/fade/apply.frag",
|
||||
"fragColor",
|
||||
new String[]{ "vPosition" });
|
||||
|
||||
// uniform setup
|
||||
this.uFadeColorTextureUniform = this.shader.getUniformLocation("uFadeColorTextureUniform");
|
||||
this.uMcDepthTextureUniform = this.shader.getUniformLocation("uMcDepthTextureUniform");
|
||||
|
||||
}
|
||||
|
||||
@@ -85,14 +82,6 @@ public class VanillaFadeApplyShader extends AbstractShaderRenderer
|
||||
GLMC.glBindTexture(this.fadeTexture);
|
||||
GL32.glUniform1i(this.uFadeColorTextureUniform, 0);
|
||||
|
||||
GLMC.glActiveTexture(GL32.GL_TEXTURE1);
|
||||
GLMC.glBindTexture(LodRenderer.INSTANCE.getActiveDepthTextureId());
|
||||
GL32.glUniform1i(this.uDhDepthTextureUniform, 1);
|
||||
|
||||
GLMC.glActiveTexture(GL32.GL_TEXTURE2);
|
||||
GLMC.glBindTexture(MC_RENDER.getDepthTextureId());
|
||||
GL32.glUniform1i(this.uMcDepthTextureUniform, 2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
-2
@@ -73,8 +73,10 @@ public class VanillaFadeShader extends AbstractShaderRenderer
|
||||
public void onInit()
|
||||
{
|
||||
this.shader = new ShaderProgram(
|
||||
"shaders/normal.vert", "shaders/vanillaFade/fade.frag",
|
||||
"fragColor", new String[]{"vPosition"}
|
||||
"shaders/normal.vert",
|
||||
"shaders/fade/vanillaFade.frag",
|
||||
"fragColor",
|
||||
new String[]{"vPosition"}
|
||||
);
|
||||
|
||||
// all uniforms should be tryGet...
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uFadeColorTextureUniform;
|
||||
uniform sampler2D uDhDepthTextureUniform;
|
||||
uniform sampler2D uMcDepthTextureUniform;
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = vec4(1.0);
|
||||
|
||||
float dhFragmentDepth = textureLod(uDhDepthTextureUniform, TexCoord, 0).r;
|
||||
float mcFragmentDepth = textureLod(uMcDepthTextureUniform, TexCoord, 0).r;
|
||||
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// only update fragments that were drawn to
|
||||
// TODO this check is currently ignored as a test, this may need to be re-enabled later
|
||||
if (dhFragmentDepth != 10 && mcFragmentDepth != 0)
|
||||
{
|
||||
fragColor = texture(uFadeColorTextureUniform, TexCoord);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uFadeColorTextureUniform;
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = texture(uFadeColorTextureUniform, TexCoord);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#version 150 core
|
||||
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uFadeColorTextureUniform;
|
||||
uniform sampler2D uDhDepthTextureUniform;
|
||||
uniform sampler2D uMcDepthTextureUniform;
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = vec4(1.0);
|
||||
|
||||
float dhFragmentDepth = textureLod(uDhDepthTextureUniform, TexCoord, 0).r;
|
||||
float mcFragmentDepth = textureLod(uMcDepthTextureUniform, TexCoord, 0).r;
|
||||
|
||||
// a fragment depth of "1" means the fragment wasn't drawn to,
|
||||
// only update fragments that were drawn to
|
||||
// TODO this check is currently ignored as a test, this may need to be re-enabled later
|
||||
if (dhFragmentDepth != 10 && mcFragmentDepth != 0)
|
||||
{
|
||||
fragColor = texture(uFadeColorTextureUniform, TexCoord);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user