Fix shader compatibility in default renderer
Disable shaders in cubic and stereoscopic rendering
This commit is contained in:
@@ -86,6 +86,7 @@ public class EntityRendererCT implements IClassTransformer {
|
||||
|
||||
// Rename original method
|
||||
setupTerrain.name = "loadShader$Original";
|
||||
setupTerrain.access = ACC_PUBLIC;
|
||||
|
||||
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
||||
classNode.accept(classWriter);
|
||||
|
||||
@@ -4,6 +4,7 @@ import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||
import eu.crushedpixel.replaymod.settings.RenderOptions;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class CubicEntityRenderer extends CustomEntityRenderer {
|
||||
|
||||
@@ -51,6 +52,15 @@ public class CubicEntityRenderer extends CustomEntityRenderer {
|
||||
super.gluPerspective(90, 1, zNear, zFar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadShader(ResourceLocation resourceLocation) {
|
||||
if (proxied.theShaderGroup != null) {
|
||||
proxied.theShaderGroup.deleteShaderGroup();
|
||||
proxied.theShaderGroup = null;
|
||||
}
|
||||
proxied.useShader = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupCameraTransform(float partialTicks) {
|
||||
Entity entity = mc.getRenderViewEntity();
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.util.glu.Project;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
@@ -70,10 +71,20 @@ public abstract class CustomEntityRenderer {
|
||||
}
|
||||
}
|
||||
System.out.println("CustomEntityRenderer using " + renderingStrategy);
|
||||
|
||||
// Install entity renderer hooks
|
||||
try {
|
||||
Field hookField = EntityRenderer.class.getField("hook");
|
||||
hookField.set(proxied, this);
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new Error(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") // Method called by ASM hook
|
||||
protected void loadShader(ResourceLocation resourceLocation) {
|
||||
public void loadShader(ResourceLocation resourceLocation) {
|
||||
if (loadShaderHook != null) {
|
||||
loadShaderHook.loadShader(resourceLocation);
|
||||
} else {
|
||||
@@ -300,6 +311,15 @@ public abstract class CustomEntityRenderer {
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
try {
|
||||
Field hookField = EntityRenderer.class.getField("hook");
|
||||
hookField.set(proxied, null);
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new Error(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
|
||||
renderingStrategy.cleanup();
|
||||
spectatorRenderer.cleanup();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package eu.crushedpixel.replaymod.video.entity;
|
||||
import eu.crushedpixel.replaymod.settings.RenderOptions;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
@@ -28,6 +29,15 @@ public class StereoscopicEntityRenderer extends CustomEntityRenderer {
|
||||
super.renderFrame(partialTicks, into, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadShader(ResourceLocation resourceLocation) {
|
||||
if (proxied.theShaderGroup != null) {
|
||||
proxied.theShaderGroup.deleteShaderGroup();
|
||||
proxied.theShaderGroup = null;
|
||||
}
|
||||
proxied.useShader = false;
|
||||
}
|
||||
|
||||
protected void translateStereoscopic() {
|
||||
GlStateManager.translate(leftEye ? 0.07 : -0.07, 0, 0);
|
||||
}
|
||||
|
||||
@@ -54,11 +54,8 @@ public class VanillaFrameBufferRenderingStrategy implements FrameRenderingStrate
|
||||
if (frameBuffer == null) {
|
||||
frameBuffer = new Framebuffer(renderer.resultWidth, renderer.resultHeight, true);
|
||||
|
||||
ShaderGroup theShaderGroup = renderer.proxied.theShaderGroup;
|
||||
if (theShaderGroup != null) {
|
||||
theShaderGroup.deleteShaderGroup();
|
||||
renderer.proxied.theShaderGroup = null;
|
||||
}
|
||||
renderer.loadShaderHook = this;
|
||||
renderer.proxied.loadEntityShader(renderer.mc.getRenderViewEntity());
|
||||
}
|
||||
return frameBuffer;
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ replaymod.gui.rendersettings.renderer.stereoscopic=Stereoscopic Rendering
|
||||
replaymod.gui.rendersettings.renderer.cubic=Cubic Rendering
|
||||
replaymod.gui.rendersettings.renderer.equirectangular=Equirectangular Rendering
|
||||
|
||||
replaymod.gui.rendersettings.renderer.default.description=Renders the video in the specified resolution. Fastest Rendering Option.
|
||||
replaymod.gui.rendersettings.renderer.default.description=Renders the video in the specified resolution. Fastest Rendering Option. Supports all minecraft shaders up to a certain resolution (depending on your graphics card).
|
||||
replaymod.gui.rendersettings.renderer.stereoscopic.description=Renders the video as a stereoscopic (side-by-side) 3D movie, useable by different 3D technologies. The image for one eye is half the width of the video
|
||||
replaymod.gui.rendersettings.renderer.cubic.description=Renders the video with a 360 degree panoramic view, using Cubic Projection. This is useable by several 360 degree video players (and the Oculus Rift), for example VR Player.
|
||||
replaymod.gui.rendersettings.renderer.equirectangular.description=Renders the video with a 360 degree panoramic view, using Equirectangular Projection. This is useable by YouTube's new 360 degree video function, and several video players (and the Oculus Rift), for example VR Player.
|
||||
|
||||
Reference in New Issue
Block a user