mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-19 11:59:40 +00:00
Beta (#461)
* Beta, maybe * Fixes for entityColor uniform in Iris * Handle Iris Texture input hook properly in GLSM * Iris Entity Fixes * Gbuffer progress * Wire up BlockEntity gbuffer * Move Entity gbuffer to a more appropriate place to avoid reentrancy * Wire up ENTITY_EYES and BEACOM_BEAM * Clean up unused RenderStateShard files * This seems marginally more correct? * Fix shadows from showing on sides of blocks * Remove overlay * yeet * More gl debugging * Grr, fix water textures * Add missed enable checks * Workaround for unset depth texture when using apitrace... Use a WrapOperation instead of an Inject with local capture - it wasn't working in dev w/ mixin debug set * update bs * Fix crosshair rendering with shaders * more final * Disable dynamic lights if shaders are in use * No light when in water * Add Void Particle Option + Mixin cleanup * update bs * less false --------- Co-authored-by: Darren Eberly <[email protected]> Co-authored-by: Caedis <[email protected]>
This commit is contained in:
51 files changed
+330
-400
No files matched your search
@@ -1,21 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.compat.toremove;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.mojang.VertexFormat;
|
||||
import lombok.Getter;
|
||||
|
||||
@Deprecated
|
||||
public class DrawState {
|
||||
@Getter
|
||||
private final VertexFormat format;
|
||||
@Getter
|
||||
private final int vertexCount;
|
||||
@Getter
|
||||
private final int mode;
|
||||
|
||||
public DrawState(VertexFormat format, int vertexCount, int mode) {
|
||||
this.format = format;
|
||||
this.vertexCount = vertexCount;
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.compat.toremove;
|
||||
|
||||
@Deprecated
|
||||
public class OverlayTexture {
|
||||
|
||||
// This is definitely wrong
|
||||
public static final int NO_OVERLAY = 0;
|
||||
}
|
||||
@@ -140,7 +140,6 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
private final RenderPhase.DepthTest depthTest;
|
||||
private final RenderPhase.Cull cull;
|
||||
private final RenderPhase.Lightmap lightmap;
|
||||
private final RenderPhase.Overlay overlay;
|
||||
private final RenderPhase.Fog fog;
|
||||
private final RenderPhase.Layering layering;
|
||||
private final RenderPhase.Target target;
|
||||
@@ -150,7 +149,7 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
private final OutlineMode outlineMode;
|
||||
private final ImmutableList<RenderPhase> phases;
|
||||
|
||||
private MultiPhaseParameters(RenderPhase.Texture texture, RenderPhase.Transparency transparency, RenderPhase.DiffuseLighting diffuseLighting, RenderPhase.ShadeModel shadeModel, RenderPhase.Alpha alpha, RenderPhase.DepthTest depthTest, RenderPhase.Cull cull, RenderPhase.Lightmap lightmap, RenderPhase.Overlay overlay, RenderPhase.Fog fog, RenderPhase.Layering layering, RenderPhase.Target target, RenderPhase.Texturing texturing, RenderPhase.WriteMaskState writeMaskState, RenderPhase.LineWidth lineWidth, OutlineMode outlineMode) {
|
||||
private MultiPhaseParameters(RenderPhase.Texture texture, RenderPhase.Transparency transparency, RenderPhase.DiffuseLighting diffuseLighting, RenderPhase.ShadeModel shadeModel, RenderPhase.Alpha alpha, RenderPhase.DepthTest depthTest, RenderPhase.Cull cull, RenderPhase.Lightmap lightmap, RenderPhase.Fog fog, RenderPhase.Layering layering, RenderPhase.Target target, RenderPhase.Texturing texturing, RenderPhase.WriteMaskState writeMaskState, RenderPhase.LineWidth lineWidth, OutlineMode outlineMode) {
|
||||
this.texture = texture;
|
||||
this.transparency = transparency;
|
||||
this.diffuseLighting = diffuseLighting;
|
||||
@@ -159,7 +158,6 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
this.depthTest = depthTest;
|
||||
this.cull = cull;
|
||||
this.lightmap = lightmap;
|
||||
this.overlay = overlay;
|
||||
this.fog = fog;
|
||||
this.layering = layering;
|
||||
this.target = target;
|
||||
@@ -167,7 +165,7 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
this.writeMaskState = writeMaskState;
|
||||
this.lineWidth = lineWidth;
|
||||
this.outlineMode = outlineMode;
|
||||
this.phases = ImmutableList.of(this.texture, this.transparency, this.diffuseLighting, this.shadeModel, this.alpha, this.depthTest, this.cull, this.lightmap, this.overlay, this.fog, this.layering, this.target, new RenderPhase[]{this.texturing, this.writeMaskState, this.lineWidth});
|
||||
this.phases = ImmutableList.of(this.texture, this.transparency, this.diffuseLighting, this.shadeModel, this.alpha, this.depthTest, this.cull, this.lightmap, this.fog, this.layering, this.target, this.texturing, this.writeMaskState, this.lineWidth);
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
@@ -202,7 +200,6 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
private RenderPhase.DepthTest depthTest;
|
||||
private RenderPhase.Cull cull;
|
||||
private RenderPhase.Lightmap lightmap;
|
||||
private RenderPhase.Overlay overlay;
|
||||
private RenderPhase.Fog fog;
|
||||
private RenderPhase.Layering layering;
|
||||
private RenderPhase.Target target;
|
||||
@@ -219,7 +216,6 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
this.depthTest = RenderPhase.LEQUAL_DEPTH_TEST;
|
||||
this.cull = RenderPhase.ENABLE_CULLING;
|
||||
this.lightmap = RenderPhase.DISABLE_LIGHTMAP;
|
||||
this.overlay = RenderPhase.DISABLE_OVERLAY_COLOR;
|
||||
this.fog = RenderPhase.FOG;
|
||||
this.layering = RenderPhase.NO_LAYERING;
|
||||
this.target = RenderPhase.MAIN_TARGET;
|
||||
@@ -263,11 +259,6 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder overlay(RenderPhase.Overlay overlay) {
|
||||
this.overlay = overlay;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder fog(RenderPhase.Fog fog) {
|
||||
this.fog = fog;
|
||||
return this;
|
||||
@@ -288,7 +279,7 @@ public abstract class RenderLayer extends RenderPhase { // Aka: RenderType (Iris
|
||||
}
|
||||
|
||||
public MultiPhaseParameters build(OutlineMode outlineMode) {
|
||||
return new MultiPhaseParameters(this.texture, this.transparency, this.diffuseLighting, this.shadeModel, this.alpha, this.depthTest, this.cull, this.lightmap, this.overlay, this.fog, this.layering, this.target, this.texturing, this.writeMaskState, this.lineWidth, outlineMode);
|
||||
return new MultiPhaseParameters(this.texture, this.transparency, this.diffuseLighting, this.shadeModel, this.alpha, this.depthTest, this.cull, this.lightmap, this.fog, this.layering, this.target, this.texturing, this.writeMaskState, this.lineWidth, outlineMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +69,6 @@ public abstract class RenderPhase {
|
||||
protected static final Texturing ENTITY_GLINT_TEXTURING;
|
||||
protected static final Lightmap ENABLE_LIGHTMAP;
|
||||
protected static final Lightmap DISABLE_LIGHTMAP;
|
||||
protected static final Overlay ENABLE_OVERLAY_COLOR;
|
||||
protected static final Overlay DISABLE_OVERLAY_COLOR;
|
||||
protected static final DiffuseLighting ENABLE_DIFFUSE_LIGHTING;
|
||||
protected static final DiffuseLighting DISABLE_DIFFUSE_LIGHTING;
|
||||
protected static final Cull ENABLE_CULLING;
|
||||
@@ -177,8 +175,6 @@ public abstract class RenderPhase {
|
||||
});
|
||||
ENABLE_LIGHTMAP = new Lightmap(true);
|
||||
DISABLE_LIGHTMAP = new Lightmap(false);
|
||||
ENABLE_OVERLAY_COLOR = new Overlay(true);
|
||||
DISABLE_OVERLAY_COLOR = new Overlay(false);
|
||||
ENABLE_DIFFUSE_LIGHTING = new DiffuseLighting(true);
|
||||
DISABLE_DIFFUSE_LIGHTING = new DiffuseLighting(false);
|
||||
ENABLE_CULLING = new Cull(true);
|
||||
@@ -505,25 +501,6 @@ public abstract class RenderPhase {
|
||||
}
|
||||
|
||||
|
||||
public static class Overlay extends Toggleable {
|
||||
public Overlay(boolean overlayColor) {
|
||||
super("overlay", () -> {
|
||||
if (overlayColor) {
|
||||
throw new RuntimeException("Not Implemented Yet");
|
||||
// MinecraftClient.getInstance().gameRenderer.getOverlayTexture().setupOverlayColor();
|
||||
}
|
||||
|
||||
}, () -> {
|
||||
if (overlayColor) {
|
||||
throw new RuntimeException("Not Implemented Yet");
|
||||
// MinecraftClient.getInstance().gameRenderer.getOverlayTexture().teardownOverlayColor();
|
||||
}
|
||||
|
||||
}, overlayColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class Lightmap extends Toggleable {
|
||||
public Lightmap(boolean lightmap) {
|
||||
super("lightmap", () -> {
|
||||
|
||||
@@ -35,13 +35,11 @@ public class AngelicaConfig {
|
||||
@Config.Comment("Enable Iris Shaders [Requires Sodium]")
|
||||
@Config.DefaultBoolean(false)
|
||||
@Config.RequiresMcRestart
|
||||
@Config.Ignore()
|
||||
public static boolean enableIris;
|
||||
|
||||
@Config.Comment("Enable MCPatcherForge features, still in Alpha. Individual features are toggled in mcpatcher.json")
|
||||
@Config.DefaultBoolean(false)
|
||||
@Config.RequiresMcRestart
|
||||
@Config.Ignore()
|
||||
public static boolean enableMCPatcherForgeFeatures;
|
||||
|
||||
@Config.Comment("Replace some vanilla render paths with more optimized versions. Disable if you encounter mixin conflicts.")
|
||||
@@ -86,7 +84,7 @@ public class AngelicaConfig {
|
||||
public static boolean enableFontRenderer;
|
||||
|
||||
@Config.Comment("Enable Dynamic Lights")
|
||||
@Config.DefaultBoolean(false)
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableDynamicLights;
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class DynamicLights {
|
||||
}
|
||||
|
||||
public static boolean isEnabled() {
|
||||
return Mode.isEnabled() && AngelicaConfig.enableDynamicLights;
|
||||
return AngelicaConfig.enableDynamicLights && Mode.isEnabled() && !IrisApi.getInstance().isShaderPackInUse();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -271,17 +271,20 @@ public final class GLDebug {
|
||||
|
||||
private static DebugState debugState;
|
||||
|
||||
private interface DebugState {
|
||||
private interface DebugState {
|
||||
void nameObject(int id, int object, String name);
|
||||
void pushGroup(String name);
|
||||
void popGroup();
|
||||
void debugMessage(String name);
|
||||
}
|
||||
|
||||
String getObjectLabel(int glProgram, int program);
|
||||
}
|
||||
|
||||
private static class KHRDebugState implements DebugState {
|
||||
private static final int ID = 0;
|
||||
private int depth = 0;
|
||||
private static final int maxDepth = GL11.glGetInteger(KHRDebug.GL_MAX_DEBUG_GROUP_STACK_DEPTH);
|
||||
private static final int maxNameLength = GL11.glGetInteger(KHRDebug.GL_MAX_LABEL_LENGTH);
|
||||
|
||||
@Override
|
||||
public void nameObject(int id, int object, String name) {
|
||||
@@ -310,6 +313,14 @@ public final class GLDebug {
|
||||
public void debugMessage(String message) {
|
||||
KHRDebug.glDebugMessageInsert(KHRDebug.GL_DEBUG_SOURCE_APPLICATION, KHRDebug.GL_DEBUG_TYPE_MARKER, ID, KHRDebug.GL_DEBUG_SEVERITY_NOTIFICATION, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectLabel(int glProgram, int program) {
|
||||
if(program == 0)
|
||||
return "";
|
||||
|
||||
return KHRDebug.glGetObjectLabel(glProgram, program, maxNameLength);
|
||||
}
|
||||
}
|
||||
|
||||
private static class UnsupportedDebugState implements DebugState {
|
||||
@@ -329,6 +340,11 @@ public final class GLDebug {
|
||||
public void debugMessage(String name) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectLabel(int glProgram, int program) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static void initDebugState() {
|
||||
@@ -359,4 +375,12 @@ public final class GLDebug {
|
||||
debugState.debugMessage(message);
|
||||
}
|
||||
}
|
||||
public static String getObjectLabel(int glProgram, int program) {
|
||||
if(debugState != null && Thread.currentThread() == GLStateManager.getMainThread()) {
|
||||
return debugState.getObjectLabel(glProgram, program);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -59,6 +59,7 @@ import org.lwjgl.opengl.GL13;
|
||||
import org.lwjgl.opengl.GL14;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
import org.lwjgl.opengl.GLContext;
|
||||
import org.lwjgl.opengl.KHRDebug;
|
||||
|
||||
import java.lang.Math;
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -134,6 +135,8 @@ public class GLStateManager {
|
||||
|
||||
@Getter protected static final ViewPortStateStack viewportState = new ViewPortStateStack();
|
||||
|
||||
@Getter protected static int activeProgram = 0;
|
||||
|
||||
public static void reset() {
|
||||
runningSplash = true;
|
||||
while(!attribs.isEmpty()) {
|
||||
@@ -399,6 +402,7 @@ public class GLStateManager {
|
||||
case GL14.GL_BLEND_DST_RGB -> blendState.getDstRgb();
|
||||
case GL14.GL_BLEND_SRC_ALPHA -> blendState.getSrcAlpha();
|
||||
case GL14.GL_BLEND_SRC_RGB -> blendState.getSrcRgb();
|
||||
case GL20.GL_CURRENT_PROGRAM -> activeProgram;
|
||||
|
||||
default -> GL11.glGetInteger(pname);
|
||||
};
|
||||
@@ -845,9 +849,6 @@ public class GLStateManager {
|
||||
} else if (textureUnit == IrisSamplers.LIGHTMAP_TEXTURE_UNIT) {
|
||||
StateTracker.INSTANCE.lightmapSampler = true;
|
||||
updatePipeline = true;
|
||||
} else if (textureUnit == IrisSamplers.OVERLAY_TEXTURE_UNIT) {
|
||||
StateTracker.INSTANCE.overlaySampler = true;
|
||||
updatePipeline = true;
|
||||
}
|
||||
|
||||
if (updatePipeline) {
|
||||
@@ -868,9 +869,6 @@ public class GLStateManager {
|
||||
} else if (textureUnit == IrisSamplers.LIGHTMAP_TEXTURE_UNIT) {
|
||||
StateTracker.INSTANCE.lightmapSampler = false;
|
||||
updatePipeline = true;
|
||||
} else if (textureUnit == IrisSamplers.OVERLAY_TEXTURE_UNIT) {
|
||||
StateTracker.INSTANCE.overlaySampler = false;
|
||||
updatePipeline = true;
|
||||
}
|
||||
|
||||
if (updatePipeline) {
|
||||
@@ -1569,4 +1567,18 @@ public class GLStateManager {
|
||||
public static void glDepthRange(double near, double far) {
|
||||
GL11.glDepthRange(near, far);
|
||||
}
|
||||
|
||||
public static void glUseProgram(int program) {
|
||||
if(program != activeProgram || shouldBypassCache()) {
|
||||
activeProgram = program;
|
||||
if(AngelicaMod.lwjglDebug) {
|
||||
final String programName = GLDebug.getObjectLabel(KHRDebug.GL_PROGRAM, program);
|
||||
GLDebug.debugMessage("Activating Program - " + program + ":" + programName);
|
||||
}
|
||||
GL20.glUseProgram(program);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -48,11 +48,6 @@ public class AngelicaTweaker implements IFMLLoadingPlugin, IEarlyMixinLoader {
|
||||
}
|
||||
ctx.updateLoggers();
|
||||
|
||||
// Too many bug reports because people refuse to read or just want to try it - so make these only able
|
||||
// to be enabled by system properties for now.
|
||||
AngelicaConfig.enableIris = Boolean.parseBoolean(System.getProperty("angelica.enableShaders", "false"));
|
||||
AngelicaConfig.enableMCPatcherForgeFeatures = Boolean.parseBoolean(System.getProperty("angelica.enableMCPatcherForgeFeatures", "false"));
|
||||
|
||||
// Debug features
|
||||
AngelicaConfig.enableTestBlocks = Boolean.parseBoolean(System.getProperty("angelica.enableTestBlocks", "false"));
|
||||
|
||||
|
||||
@@ -140,13 +140,18 @@ public enum Mixins {
|
||||
IRIS_RENDERING(new Builder("Iris Shaders").addTargetedMod(TargetedMod.VANILLA).setSide(Side.CLIENT)
|
||||
.setPhase(Phase.EARLY).setApplyIf(() -> AngelicaConfig.enableIris).addMixinClasses(
|
||||
"shaders.MixinEntityRenderer"
|
||||
,"shaders.MixinGuiIngameForge"
|
||||
,"shaders.MixinFramebuffer"
|
||||
,"shaders.MixinItem"
|
||||
,"shaders.MixinLocale"
|
||||
,"shaders.MixinOpenGlHelper"
|
||||
,"shaders.MixinRender"
|
||||
,"shaders.MixinRenderDragon"
|
||||
,"shaders.MixinRenderEnderman"
|
||||
,"shaders.MixinRendererLivingEntity"
|
||||
,"shaders.MixinRenderGlobal"
|
||||
,"shaders.MixinRenderManager"
|
||||
,"shaders.MixinRenderSpider"
|
||||
,"shaders.MixinTileEntityBeaconRenderer"
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ public abstract class MixinEntityRenderer {
|
||||
);
|
||||
}
|
||||
|
||||
@ModifyArg(method = "setupCameraTransform", at = @At(value = "INVOKE", target = "Lorg/lwjgl/util/glu/Project;gluPerspective(FFFF)V", ordinal = 0), index = 0)
|
||||
@ModifyArg(method = "setupCameraTransform", at = @At(value = "INVOKE", target = "Lorg/lwjgl/util/glu/Project;gluPerspective(FFFF)V", ordinal = 0, remap = false), index = 0)
|
||||
private float captureFov(float fov) {
|
||||
RenderingState.INSTANCE.setFov(fov);
|
||||
return fov;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(GuiIngameForge.class)
|
||||
@Mixin(value=GuiIngameForge.class, remap = false)
|
||||
public class MixinGuiIngameForge {
|
||||
@Redirect(method = "renderHUDText", at = @At(value = "FIELD", target = "Lnet/minecraft/world/biome/BiomeGenBase;biomeName:Ljava/lang/String;"))
|
||||
private String getModNameWithBiome(BiomeGenBase biome) {
|
||||
|
||||
+1
-1
@@ -510,7 +510,7 @@ public abstract class MixinRenderBlocks {
|
||||
* @author roadhog360
|
||||
*/
|
||||
@SuppressWarnings("UnreachableCode")
|
||||
@Inject(method = "renderBlockStainedGlassPane", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockPane;canPaneConnectTo(Lnet/minecraft/world/IBlockAccess;IIILnet/minecraftforge/common/util/ForgeDirection;)Z", ordinal = 3, shift = At.Shift.BY, by = 2), cancellable = true)
|
||||
@Inject(method = "renderBlockStainedGlassPane", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockPane;canPaneConnectTo(Lnet/minecraft/world/IBlockAccess;IIILnet/minecraftforge/common/util/ForgeDirection;)Z", ordinal = 3, shift = At.Shift.BY, by = 2, remap = false), cancellable = true)
|
||||
private void tweakStainedPaneRenderer(Block block, int x, int y, int z, CallbackInfoReturnable<Boolean> cir,
|
||||
@Local(name = "iicon") IIcon iicon,
|
||||
@Local(name = "d22") double d22, @Local(name = "d0") double d0, @Local(name = "d1") double d1, @Local(name = "d2") double d2,
|
||||
|
||||
+2
-1
@@ -52,7 +52,8 @@ abstract public class MixinEntityRenderer {
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lorg/lwjgl/opengl/GL11;glFogf(IF)V",
|
||||
ordinal = 14
|
||||
ordinal = 14,
|
||||
remap = false
|
||||
)
|
||||
)
|
||||
private void notFine$nearFogDistance(int mode, float value) {
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ public abstract class MixinGuiIngame {
|
||||
target = "Lnet/minecraft/client/Minecraft;isFancyGraphicsEnabled()Z"
|
||||
)
|
||||
)
|
||||
private boolean notFine$toggleVignette(float whyAndHowIsThisAFloat) {
|
||||
private boolean notFine$toggleVignette() {
|
||||
return SettingsManager.vignette;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,9 @@ public abstract class MixinFramebuffer implements IRenderTargetExt {
|
||||
@Inject(method="createFramebuffer(II)V", at=@At(value="FIELD", target="Lnet/minecraft/client/shader/Framebuffer;useDepth:Z", shift=At.Shift.BEFORE, ordinal = 1))
|
||||
private void iris$createDepthTexture(int width, int height, CallbackInfo ci) {
|
||||
if(this.iris$useDepth) {
|
||||
if(this.iris$depthTextureId == -1) {
|
||||
this.iris$depthTextureId = GL11.glGenTextures();
|
||||
}
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, this.iris$depthTextureId);
|
||||
|
||||
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import net.minecraftforge.client.GuiIngameForge;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(value = GuiIngameForge.class, remap = false)
|
||||
public class MixinGuiIngameForge {
|
||||
@Inject(method="renderCrosshairs", at= @At(value = "INVOKE", target = "Lnet/minecraftforge/client/GuiIngameForge;bind(Lnet/minecraft/util/ResourceLocation;)V", shift = At.Shift.AFTER))
|
||||
private void renderCrosshairs(CallbackInfo ci) {
|
||||
// Set the same state as vanilla so we don't break with textures that set a color value on transparent pixels for the crosshairs
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import net.coderbot.iris.gbuffer_overrides.matching.SpecialCondition;
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.minecraft.client.renderer.entity.RenderDragon;
|
||||
import net.minecraft.entity.boss.EntityDragon;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(RenderDragon.class)
|
||||
public class MixinRenderDragon {
|
||||
@Inject(method = "Lnet/minecraft/client/renderer/entity/RenderDragon;shouldRenderPass(Lnet/minecraft/entity/boss/EntityDragon;IF)I", at = @At(value="RETURN", ordinal = 1))
|
||||
private void onShouldRenderPass(EntityDragon entity, int pass, float partialTicks, CallbackInfoReturnable<Integer> cir) {
|
||||
GbufferPrograms.setupSpecialRenderCondition(SpecialCondition.ENTITY_EYES);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import net.coderbot.iris.gbuffer_overrides.matching.SpecialCondition;
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.minecraft.client.renderer.entity.RenderEnderman;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(RenderEnderman.class)
|
||||
public class MixinRenderEnderman {
|
||||
@Inject(method = "Lnet/minecraft/client/renderer/entity/RenderEnderman;shouldRenderPass(Lnet/minecraft/entity/monster/EntityEnderman;IF)I", at = @At(value="RETURN", ordinal = 1))
|
||||
private void onShouldRenderPass(EntityEnderman entity, int pass, float partialTicks, CallbackInfoReturnable<Integer> cir) {
|
||||
GbufferPrograms.setupSpecialRenderCondition(SpecialCondition.ENTITY_EYES);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.coderbot.iris.uniforms.CapturedRenderingState;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(RenderManager.class)
|
||||
public class MixinRenderManager {
|
||||
|
||||
@Unique
|
||||
private static final String DO_RENDER = "Lnet/minecraft/client/renderer/entity/Render;doRender(Lnet/minecraft/entity/Entity;DDDFF)V";
|
||||
|
||||
@Inject(method = "func_147939_a", at = @At(value = "INVOKE", target = DO_RENDER))
|
||||
private void iris$onRenderEntityPre(Entity entity, double x, double y, double z, float yaw, float partialTicks, boolean rebuild, CallbackInfoReturnable<Boolean> cir) {
|
||||
CapturedRenderingState.INSTANCE.setCurrentEntity(entity.getEntityId());
|
||||
GbufferPrograms.beginEntities();
|
||||
}
|
||||
|
||||
@Inject(method = "func_147939_a", at = @At(value = "INVOKE", target = DO_RENDER, shift = At.Shift.AFTER))
|
||||
private void iris$onRenderEntityPost(Entity entity, double x, double y, double z, float yaw, float partialTicks, boolean rebuild, CallbackInfoReturnable<Boolean> cir) {
|
||||
CapturedRenderingState.INSTANCE.setCurrentEntity(-1);
|
||||
GbufferPrograms.endEntities();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import net.coderbot.iris.gbuffer_overrides.matching.SpecialCondition;
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.minecraft.client.renderer.entity.RenderSpider;
|
||||
import net.minecraft.entity.monster.EntitySpider;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(RenderSpider.class)
|
||||
public class MixinRenderSpider {
|
||||
@Inject(method = "Lnet/minecraft/client/renderer/entity/RenderSpider;shouldRenderPass(Lnet/minecraft/entity/monster/EntitySpider;IF)I", at = @At(value="RETURN", ordinal = 1))
|
||||
private void onShouldRenderPass(EntitySpider entity, int pass, float partialTicks, CallbackInfoReturnable<Integer> cir) {
|
||||
GbufferPrograms.setupSpecialRenderCondition(SpecialCondition.ENTITY_EYES);
|
||||
}
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.coderbot.iris.uniforms.CapturedRenderingState;
|
||||
import net.minecraft.client.renderer.entity.RendererLivingEntity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(RendererLivingEntity.class)
|
||||
public class MixinRendererLivingEntity {
|
||||
|
||||
@WrapOperation(
|
||||
method="doRender",
|
||||
at=@At(value="INVOKE", target="Lnet/minecraft/client/renderer/entity/RendererLivingEntity;getColorMultiplier(Lnet/minecraft/entity/EntityLivingBase;FF)I")
|
||||
)
|
||||
private int iris$setEntityColor(RendererLivingEntity instance, EntityLivingBase elb, float f0, float f1, Operation<Integer> original) {
|
||||
final int j = original.call(instance, elb, f0, f1);
|
||||
final float a = (j >> 24 & 255) / 255.0F;
|
||||
final float r = (j >> 16 & 255) / 255.0F;
|
||||
final float g = (j >> 8 & 255) / 255.0F;
|
||||
final float b = (j & 255) / 255.0F;
|
||||
CapturedRenderingState.INSTANCE.setCurrentEntityColor(r, g, b, 1.0F - a);
|
||||
return j;
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method="Lnet/minecraft/client/renderer/entity/RendererLivingEntity;doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V", at=@At(value="INVOKE",
|
||||
target="Lnet/minecraft/client/renderer/entity/RendererLivingEntity;renderEquippedItems(Lnet/minecraft/entity/EntityLivingBase;F)V", shift=At.Shift.BEFORE)
|
||||
)
|
||||
private void iris$teardownSpecialRenderConditions(EntityLivingBase entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) {
|
||||
GbufferPrograms.teardownSpecialRenderCondition();
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.shaders;
|
||||
|
||||
import net.coderbot.iris.gbuffer_overrides.matching.SpecialCondition;
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityBeaconRenderer;
|
||||
import net.minecraft.tileentity.TileEntityBeacon;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(TileEntityBeaconRenderer.class)
|
||||
public class MixinTileEntityBeaconRenderer {
|
||||
|
||||
@Inject(method="Lnet/minecraft/client/renderer/tileentity/TileEntityBeaconRenderer;renderTileEntityAt(Lnet/minecraft/tileentity/TileEntityBeacon;DDDF)V", at=@At("HEAD"))
|
||||
private void onRenderTileEntityAt(TileEntityBeacon beacon, double x, double y, double z, float partialTicks, CallbackInfo ci) {
|
||||
GbufferPrograms.setupSpecialRenderCondition(SpecialCondition.BEACON_BEAM);
|
||||
}
|
||||
|
||||
@Inject(method="Lnet/minecraft/client/renderer/tileentity/TileEntityBeaconRenderer;renderTileEntityAt(Lnet/minecraft/tileentity/TileEntityBeacon;DDDF)V", at=@At("RETURN"))
|
||||
private void afterRenderTileEntityAt(TileEntityBeacon beacon, double x, double y, double z, float partialTicks, CallbackInfo ci) {
|
||||
GbufferPrograms.teardownSpecialRenderCondition();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+29
-3
@@ -6,15 +6,19 @@ import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.IRenderGlobalExt;
|
||||
import com.gtnewhorizons.angelica.rendering.AngelicaRenderQueue;
|
||||
import com.gtnewhorizons.angelica.rendering.RenderingState;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import lombok.Getter;
|
||||
import me.jellysquid.mods.sodium.client.gl.device.RenderDevice;
|
||||
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
|
||||
import me.jellysquid.mods.sodium.client.render.chunk.passes.BlockRenderPass;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.layer.GbufferPrograms;
|
||||
import net.coderbot.iris.pipeline.HandRenderer;
|
||||
import net.coderbot.iris.pipeline.ShadowRenderer;
|
||||
import net.coderbot.iris.pipeline.WorldRenderingPhase;
|
||||
import net.coderbot.iris.pipeline.WorldRenderingPipeline;
|
||||
import net.coderbot.iris.uniforms.CapturedRenderingState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.PlayerControllerMP;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
@@ -23,10 +27,14 @@ import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.culling.Frustrum;
|
||||
import net.minecraft.client.renderer.culling.ICamera;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.init.Blocks;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
@@ -49,6 +57,8 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
@Shadow public int renderDistanceChunks;
|
||||
@Shadow public WorldRenderer[] worldRenderers;
|
||||
@Shadow public WorldRenderer[] sortedWorldRenderers;
|
||||
@Shadow @Final private TextureManager renderEngine;
|
||||
|
||||
|
||||
@Getter
|
||||
@Unique private SodiumWorldRenderer renderer;
|
||||
@@ -141,9 +151,10 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
pipeline = null;
|
||||
} else {
|
||||
pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||
pipeline.setPhase(WorldRenderingPhase.TERRAIN_CUTOUT);
|
||||
|
||||
if(pass == 1) {
|
||||
if(pass == 0) {
|
||||
pipeline.setPhase(WorldRenderingPhase.TERRAIN_CUTOUT);
|
||||
} else if(pass == 1) {
|
||||
pipeline.setPhase(WorldRenderingPhase.TERRAIN_TRANSLUCENT);
|
||||
final Camera camera = new Camera(mc.renderViewEntity, (float) partialTicks);
|
||||
|
||||
// iris$beginTranslucents
|
||||
@@ -151,6 +162,7 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
HandRenderer.INSTANCE.renderSolid(null /*poseStack*/, (float) partialTicks, camera, mc.renderGlobal, pipeline);
|
||||
mc.mcProfiler.endStartSection("iris_pre_translucent");
|
||||
pipeline.beginTranslucents();
|
||||
this.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
}
|
||||
}
|
||||
// Handle view distance change
|
||||
@@ -172,6 +184,7 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
|
||||
try {
|
||||
final MatrixStack matrixStack = new MatrixStack(ShadowRenderer.ACTIVE ? ShadowRenderer.MODELVIEW : RenderingState.INSTANCE.getModelViewMatrix());
|
||||
mc.mcProfiler.endStartSection("draw_chunk_layer_" + pass);
|
||||
this.renderer.drawChunkLayer(BlockRenderPass.VALUES[pass], matrixStack, x, y, z);
|
||||
} finally {
|
||||
RenderDevice.exitManagedCode();
|
||||
@@ -285,6 +298,19 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
this.renderChunksDeep = 0;
|
||||
}
|
||||
|
||||
@WrapOperation(method="renderEntities", at=@At(value="INVOKE", target="Lnet/minecraft/client/renderer/entity/RenderManager;renderEntitySimple(Lnet/minecraft/entity/Entity;F)Z"))
|
||||
private boolean angelica$renderEntitySimple(RenderManager instance, Entity entity, float partialTicks, Operation<Boolean> original) {
|
||||
CapturedRenderingState.INSTANCE.setCurrentEntity(entity.getEntityId());
|
||||
GbufferPrograms.beginEntities();
|
||||
try {
|
||||
return original.call(instance, entity, partialTicks);
|
||||
} finally {
|
||||
CapturedRenderingState.INSTANCE.setCurrentEntity(-1);
|
||||
GbufferPrograms.endEntities();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method="renderEntities", at=@At(value="INVOKE", target="Lnet/minecraft/client/renderer/RenderHelper;enableStandardItemLighting()V", shift = At.Shift.AFTER))
|
||||
public void sodium$renderTileEntities(EntityLivingBase entity, ICamera camera, float partialTicks, CallbackInfo ci) {
|
||||
this.renderer.renderTileEntities(entity, camera, partialTicks);
|
||||
|
||||
@@ -204,6 +204,7 @@ public class RedirectorTransformer implements IClassTransformer {
|
||||
);
|
||||
methodRedirects.put(GL20, RedirectMap.newMap()
|
||||
.add("glBlendEquationSeparate")
|
||||
.add("glUseProgram")
|
||||
);
|
||||
methodRedirects.put(OpenGlHelper, RedirectMap.newMap()
|
||||
.add("glBlendFunc", "tryBlendFuncSeparate")
|
||||
|
||||
Reference in new issue
Block a user