Fix ODS rendering in 1.15
This commit is contained in:
@@ -80,13 +80,23 @@ public class ODSFrameCapturer implements FrameCapturer<ODSOpenGlFrame> {
|
||||
private void bindProgram() {
|
||||
shaderProgram.use();
|
||||
setTexture("texture", 0);
|
||||
//#if MC>=11500
|
||||
//$$ setTexture("overlay", 1);
|
||||
//$$ setTexture("lightMap", 2);
|
||||
//#else
|
||||
setTexture("lightMap", 1);
|
||||
//#endif
|
||||
|
||||
renderStateEvents = new EventRegistrations();
|
||||
Program.Uniform[] texture2DUniforms = new Program.Uniform[]{
|
||||
shaderProgram.getUniformVariable("textureEnabled"),
|
||||
//#if MC>=11500
|
||||
//$$ shaderProgram.getUniformVariable("overlayEnabled"),
|
||||
//$$ shaderProgram.getUniformVariable("lightMapEnabled"),
|
||||
//#else
|
||||
shaderProgram.getUniformVariable("lightMapEnabled"),
|
||||
shaderProgram.getUniformVariable("hurtTextureEnabled")
|
||||
shaderProgram.getUniformVariable("overlayEnabled"),
|
||||
//#endif
|
||||
};
|
||||
renderStateEvents.on(Texture2DStateCallback.EVENT, (id, enabled) -> {
|
||||
if (id >= 0 && id < texture2DUniforms.length) {
|
||||
|
||||
@@ -4,13 +4,19 @@ varying vec4 vertColor;
|
||||
|
||||
varying vec4 textureCoord;
|
||||
varying vec4 lightMapCoord;
|
||||
//#if MC>=11500
|
||||
//$$ varying vec4 overlayCoords;
|
||||
//#endif
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D lightMap;
|
||||
//#if MC>=11500
|
||||
//$$ uniform sampler2D overlay;
|
||||
//#endif
|
||||
|
||||
uniform bool textureEnabled;
|
||||
uniform bool lightMapEnabled;
|
||||
uniform bool hurtTextureEnabled;
|
||||
uniform bool overlayEnabled;
|
||||
uniform bool fogEnabled;
|
||||
|
||||
void main() {
|
||||
@@ -18,12 +24,17 @@ void main() {
|
||||
if (textureEnabled) {
|
||||
color *= texture2D(texture, textureCoord.st);
|
||||
}
|
||||
if (overlayEnabled) {
|
||||
//#if MC>=11500
|
||||
//$$ vec4 c = texture2D(overlay, overlayCoords.st);
|
||||
//$$ color = vec4(mix(c.rgb, color.rgb, c.a), color.a);
|
||||
//#else
|
||||
color = vec4(mix(color.rgb, vec3(1, 0, 0), 0.3), color.a);
|
||||
//#endif
|
||||
}
|
||||
if (lightMapEnabled) {
|
||||
color *= texture2D(lightMap, lightMapCoord.st);
|
||||
}
|
||||
if (hurtTextureEnabled) {
|
||||
color = vec4(mix(color.rgb, vec3(1, 0, 0), 0.3), color.a);
|
||||
}
|
||||
if (fogEnabled) {
|
||||
color.rgb = mix(color.rgb, gl_Fog.color.rgb, clamp((gl_FogFragCoord - gl_Fog.start) * gl_Fog.scale, 0.0, 1.0));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ varying float vertId;
|
||||
|
||||
varying vec4 textureCoord;
|
||||
varying vec4 lightMapCoord;
|
||||
//#if MC>=11500
|
||||
//$$ varying vec4 overlayCoords;
|
||||
//#endif
|
||||
|
||||
uniform bool leftEye;
|
||||
uniform int direction;
|
||||
@@ -66,7 +69,12 @@ void main() {
|
||||
|
||||
// Misc.
|
||||
textureCoord = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
lightMapCoord = gl_TextureMatrix[1] * gl_MultiTexCoord1;
|
||||
//#if MC>=11500
|
||||
//$$ overlayCoords = gl_TextureMatrix[1] * gl_MultiTexCoord1;
|
||||
//$$ lightMapCoord = gl_TextureMatrix[2] * gl_MultiTexCoord2;
|
||||
//#else
|
||||
lightMapCoord = gl_TextureMatrix[1] * gl_MultiTexCoord1;
|
||||
//#endif
|
||||
vertColor = gl_Color;
|
||||
gl_FogFragCoord = sqrt(position.x * position.x + position.y * position.y + position.z * position.z);
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import com.replaymod.gradle.preprocess.PreprocessTask
|
||||
|
||||
buildscript {
|
||||
def mcVersion
|
||||
def (major, minor, patch) = project.name.tokenize('-')[0].tokenize('.')
|
||||
@@ -88,6 +90,15 @@ apply plugin: 'com.replaymod.preprocess'
|
||||
preprocess {
|
||||
vars.put("MC", project.mcVersion)
|
||||
vars.put("FABRIC", project.fabric ? 1 : 0)
|
||||
|
||||
keywords.set([
|
||||
".java": PreprocessTask.DEFAULT_KEYWORDS,
|
||||
".json": PreprocessTask.DEFAULT_KEYWORDS,
|
||||
".mcmeta": PreprocessTask.DEFAULT_KEYWORDS,
|
||||
".cfg": PreprocessTask.CFG_KEYWORDS,
|
||||
".vert": PreprocessTask.DEFAULT_KEYWORDS,
|
||||
".frag": PreprocessTask.DEFAULT_KEYWORDS,
|
||||
])
|
||||
}
|
||||
|
||||
def mcVersionStr = "${(int)(mcVersion/10000)}.${(int)(mcVersion/100)%100}" + (mcVersion%100==0 ? '' : ".${mcVersion%100}")
|
||||
|
||||
Reference in New Issue
Block a user