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