Compare commits

..
33 changed files with 430 additions and 337 deletions

No files matched your search

+1 -1
View File
@@ -16,5 +16,5 @@ pluginManagement {
}
plugins {
id("com.gtnewhorizons.gtnhsettingsconvention") version("2.0.13")
id("com.gtnewhorizons.gtnhsettingsconvention") version("2.0.18")
}
@@ -66,6 +66,7 @@ import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL14;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.opengl.KHRDebug;
@@ -3786,4 +3787,56 @@ public class GLStateManager {
return VENDOR == NVIDIA;
}
@Getter protected static int drawFramebuffer = 0;
@Getter protected static int readFramebuffer = 0;
public static void glBindFramebuffer(int target, int framebuffer) {
if (target == GL30.GL_FRAMEBUFFER) {
if (drawFramebuffer == framebuffer && readFramebuffer == framebuffer) return;
drawFramebuffer = framebuffer;
readFramebuffer = framebuffer;
} else if (target == GL30.GL_DRAW_FRAMEBUFFER) {
if (drawFramebuffer == framebuffer) return;
drawFramebuffer = framebuffer;
} else if (target == GL30.GL_READ_FRAMEBUFFER) {
if (readFramebuffer == framebuffer) return;
readFramebuffer = framebuffer;
}
GL30.glBindFramebuffer(target, framebuffer);
}
public static void glDeleteFramebuffers(int framebuffer) {
if (drawFramebuffer == framebuffer) drawFramebuffer = 0;
if (readFramebuffer == framebuffer) readFramebuffer = 0;
GL30.glDeleteFramebuffers(framebuffer);
}
public static int glGenFramebuffers() {
return GL30.glGenFramebuffers();
}
public static int glCheckFramebufferStatus(int target) {
return GL30.glCheckFramebufferStatus(target);
}
public static void glFramebufferTexture2D(int target, int attachment, int textarget, int texture, int level) {
GL30.glFramebufferTexture2D(target, attachment, textarget, texture, level);
}
public static void setActiveTexture(int textureUnit) {
glActiveTexture(textureUnit);
}
public static void setLightmapTextureCoords(int unit, float x, float y) {
GL13.glMultiTexCoord2f(unit, x, y);
if (unit == GL13.GL_TEXTURE1) {
OpenGlHelper.lastBrightnessX = x;
OpenGlHelper.lastBrightnessY = y;
}
}
public static boolean isFramebufferEnabled() {
return OpenGlHelper.framebufferSupported && Minecraft.getMinecraft().gameSettings.fboEnable;
}
}
@@ -2,7 +2,6 @@ package com.gtnewhorizons.angelica.glsm.dsa;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.glsm.RenderSystem;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL13;
@@ -77,13 +76,13 @@ public class DSAUnsupported implements DSAAccess {
@Override
public void readBuffer(int framebuffer, int buffer) {
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(GL30.GL_FRAMEBUFFER, framebuffer);
GLStateManager.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer);
GL11.glReadBuffer(buffer);
}
@Override
public void drawBuffers(int framebuffer, IntBuffer buffers) {
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(GL30.GL_FRAMEBUFFER, framebuffer);
GLStateManager.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer);
GL20.glDrawBuffers(buffers);
}
@@ -135,21 +134,21 @@ public class DSAUnsupported implements DSAAccess {
@Override
public void blitFramebuffer(int source, int dest, int offsetX, int offsetY, int width, int height, int offsetX2, int offsetY2, int width2, int height2,
int bufferChoice, int filter) {
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(GL30.GL_READ_FRAMEBUFFER, source);
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(GL30.GL_DRAW_FRAMEBUFFER, dest);
GLStateManager.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, source);
GLStateManager.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, dest);
GL30.glBlitFramebuffer(offsetX, offsetY, width, height, offsetX2, offsetY2, width2, height2, bufferChoice, filter);
}
@Override
public void framebufferTexture2D(int fb, int fbtarget, int attachment, int target, int texture, int levels) {
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(fbtarget, fb);
GLStateManager.glBindFramebuffer(fbtarget, fb);
GL30.glFramebufferTexture2D(fbtarget, attachment, target, texture, levels);
}
@Override
public int createFramebuffer() {
final int framebuffer = OpenGlHelper.func_153165_e/*glGenFramebuffers*/();
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(GL30.GL_FRAMEBUFFER, framebuffer);
final int framebuffer = GLStateManager.glGenFramebuffers();
GLStateManager.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer);
return framebuffer;
}
@@ -20,7 +20,6 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraftforge.client.GuiIngameForge;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import org.lwjgl.opengl.GL11;
@@ -68,7 +67,7 @@ public class HUDCaching {
XaeroMinimapCore.beforeIngameGuiRender(partialTicks);
}
if (!OpenGlHelper.isFramebufferEnabled()) {
if (!GLStateManager.isFramebufferEnabled()) {
ingame.renderGameOverlay(partialTicks, hasScreen, mouseX, mouseY);
return;
}
@@ -233,7 +233,15 @@ public final class AngelicaRedirector {
);
methodRedirects.put(OpenGlHelper, RedirectMap.newMap()
.add("glBlendFunc", "tryBlendFuncSeparate")
.add("func_148821_a", "tryBlendFuncSeparate"));
.add("func_148821_a", "tryBlendFuncSeparate")
.add("func_153171_g", "glBindFramebuffer")
.add("func_153174_h", "glDeleteFramebuffers")
.add("func_153165_e", "glGenFramebuffers")
.add("func_153167_i", "glCheckFramebufferStatus")
.add("func_153188_a", "glFramebufferTexture2D")
.add("setActiveTexture")
.add("setLightmapTextureCoords")
.add("isFramebufferEnabled"));
methodRedirects.put(EXTBlendFunc, RedirectMap.newMap().add("glBlendFuncSeparateEXT", "tryBlendFuncSeparate"));
methodRedirects.put(ARBMultiTexture, RedirectMap.newMap().add("glActiveTextureARB"));
methodRedirects.put(Project, RedirectMap.newMap().add("gluPerspective"));
@@ -200,7 +200,6 @@ public enum Mixins implements IMixins {
, "shaders.MixinFramebuffer"
, "shaders.MixinItem"
, "shaders.MixinLocale"
, "shaders.MixinOpenGlHelper"
, "shaders.MixinRender"
, "shaders.MixinRenderBiped"
, "shaders.MixinRenderEntityFlame"
@@ -315,7 +314,7 @@ public enum Mixins implements IMixins {
.setPhase(Phase.LATE)
.addRequiredMod(TargetedMod.NTM_SPACE)
.setApplyIf(() -> CompatConfig.fixNTMSpace && AngelicaConfig.enableIris)
.addClientMixins("client.ntmSpace.MixinSkyProviderCelestial_ShaderCompat")),
.addClientMixins("client.ntmSpace.MixinSkyProviderCelestial_ShaderCompat", "client.ntmSpace.MixinSkyProviderLaytheSunset")),
SPEEDUP_CAMPFIRE_BACKPORT_ANIMATIONS(new MixinBuilder("Add animation speedup support to Campfire Backport")
.setPhase(Phase.LATE)
@@ -31,7 +31,6 @@ import jss.notfine.core.Settings;
import jss.notfine.gui.options.named.GraphicsQualityOff;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.resources.IResourceManager;
@@ -40,6 +39,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
public class CloudRenderer implements IResourceManagerReloadListener {
// Shared constants.
@@ -337,12 +337,12 @@ public class CloudRenderer implements IResourceManagerReloadListener {
texColor = newColor;
}
GLStateManager.glActiveTexture(OpenGlHelper.lightmapTexUnit);
GLStateManager.glActiveTexture(GL13.GL_TEXTURE1);
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, COLOR_TEX.getGlTextureId());
GLStateManager.enableTexture();
// Bind the clouds texture last so the shader's sampler2D is correct.
GLStateManager.glActiveTexture(OpenGlHelper.defaultTexUnit);
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0);
mc.renderEngine.bindTexture(texture);
vbo.setupState();
@@ -384,9 +384,9 @@ public class CloudRenderer implements IResourceManagerReloadListener {
vbo.cleanupState(); // Unbind buffer and disable pointers.
// Disable our coloring.
GLStateManager.glActiveTexture(OpenGlHelper.lightmapTexUnit);
GLStateManager.glActiveTexture(GL13.GL_TEXTURE1);
GLStateManager.disableTexture();
GLStateManager.glActiveTexture(OpenGlHelper.defaultTexUnit);
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0);
// Reset texture matrix.
GLStateManager.glMatrixMode(GL11.GL_TEXTURE);
@@ -7,6 +7,8 @@ import java.util.Arrays;
import java.util.List;
import com.gtnewhorizons.angelica.rendering.celeritas.iris.BlockRenderContext;
import com.gtnewhorizons.angelica.rendering.celeritas.iris.IrisExtendedChunkVertexEncoder;
import org.embeddedt.embeddium.impl.model.light.LightPipeline;
import org.embeddedt.embeddium.impl.model.light.flat.FlatLightPipeline;
import org.embeddedt.embeddium.impl.render.chunk.ChunkColorWriter;
import com.gtnewhorizons.angelica.rendering.celeritas.light.LightDataCache;
import com.gtnewhorizons.angelica.rendering.celeritas.light.QuadLightingHelper;
@@ -49,6 +51,7 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
private final LightDataCache lightDataCache = new LightDataCache();
private final SmoothLightPipeline smoothLightPipeline;
private final FlatLightPipeline flatLightPipeline;
private final QuadLightData quadLightData = new QuadLightData();
private final VertexArrayQuadView quadView;
private boolean lightPipelineReady = false;
@@ -59,6 +62,7 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
this.textureAtlas = (TextureMapExtension) Minecraft.getMinecraft().getTextureMapBlocks();
this.worldSlice = new WorldSlice(world);
this.smoothLightPipeline = new SmoothLightPipeline(lightDataCache, VanillaDiffuseProvider.INSTANCE, false);
this.flatLightPipeline = new FlatLightPipeline(lightDataCache, VanillaDiffuseProvider.INSTANCE, false);
this.quadView = new VertexArrayQuadView(vertices);
}
@@ -73,6 +77,7 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
lightDataCache.setWorld(blockAccess);
lightDataCache.reset(minBlockX, minBlockY, minBlockZ);
smoothLightPipeline.reset();
flatLightPipeline.reset();
lightPipelineReady = true;
}
@@ -86,7 +91,11 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
}
}
private Material selectMaterial(Material material, TextureAtlasSprite sprite) {
private Material selectMaterial(Material material, TextureAtlasSprite sprite, boolean isShaderPackOverride) {
// Don't apply transparency-based optimization when shader pack explicitly overrides the material
if (isShaderPackOverride) {
return material;
}
if (sprite != null && sprite.getClass() == TextureAtlasSprite.class && !sprite.hasAnimationMetadata()) {
final var transparencyLevel = ((SpriteExtension)sprite).celeritas$getTransparencyLevel();
if (transparencyLevel == SpriteTransparencyLevel.OPAQUE && material == AngelicaRenderPassConfiguration.CUTOUT_MIPPED_MATERIAL) {
@@ -99,7 +108,8 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
}
@SuppressWarnings("unchecked")
public void copyRawBuffer(int[] rawBuffer, int vertexCount, ChunkBuildBuffers buffers, Material material) {
public void copyRawBuffer(int[] rawBuffer, int vertexCount, ChunkBuildBuffers buffers, Material material, boolean isShaderPackOverride,
boolean blockAllowsSmoothLighting) {
if (vertexCount == 0) {
return;
}
@@ -122,6 +132,14 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
int ptr = 0;
final int numQuads = vertexCount / 4;
final int blockX = blockRenderContext.localPosX;
final int blockY = blockRenderContext.localPosY;
final int blockZ = blockRenderContext.localPosZ;
final int worldX = originX + blockX;
final int worldY = originY + blockY;
final int worldZ = originZ + blockZ;
final boolean isEmissive = useAoCalculation && QuadLightingHelper.isBlockEmissive(worldSlice, worldX, worldY, worldZ);
for (int quadIdx = 0; quadIdx < numQuads; quadIdx++) {
float uSum = 0, vSum = 0;
@@ -161,11 +179,6 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
}
if (useAoCalculation) {
final int blockX = blockRenderContext.localPosX;
final int blockY = blockRenderContext.localPosY;
final int blockZ = blockRenderContext.localPosZ;
final boolean isEmissive = LightDataAccess.unpackEM(lightDataCache.get(originX + blockX, originY + blockY, originZ + blockZ));
final boolean quadIsFullBright = QuadLightingHelper.isQuadFullBright(vertices);
if (isEmissive || quadIsFullBright) {
@@ -180,7 +193,9 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
} else {
quadView.setup(trueNormal, blockX, blockY, blockZ);
final ModelQuadFacing lightFace = quadView.getLightFace();
smoothLightPipeline.calculate(quadView, originX + blockX, originY + blockY, originZ + blockZ, quadLightData, lightFace, lightFace, shade, true);
final LightPipeline pipeline = blockAllowsSmoothLighting ? smoothLightPipeline : flatLightPipeline;
final ModelQuadFacing cullFace = quadView.getCullFace();
pipeline.calculate(quadView, worldX, worldY, worldZ, quadLightData, cullFace, lightFace, shade, true);
}
for (int vIdx = 0; vIdx < 4; vIdx++) {
@@ -206,7 +221,7 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
}
}
final Material correctMaterial = selectMaterial(material, sprite);
final Material correctMaterial = selectMaterial(material, sprite, isShaderPackOverride);
final var builder = buffers.get(correctMaterial);
if (correctMaterial != material && builder.getEncoder() instanceof IrisExtendedChunkVertexEncoder iris) {
@@ -1,7 +1,6 @@
package com.gtnewhorizons.angelica.rendering.celeritas;
import com.gtnewhorizon.gtnhlib.blockpos.BlockPos;
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
import com.gtnewhorizons.angelica.rendering.AngelicaRenderQueue;
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProvider;
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProviderHolder;
@@ -10,7 +9,7 @@ import com.gtnewhorizons.angelica.rendering.celeritas.iris.ContextAwareChunkVert
import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap;
import net.coderbot.iris.vertices.ExtendedDataHelper;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
@@ -30,6 +29,7 @@ import org.embeddedt.embeddium.impl.render.chunk.data.BuiltSectionMeshParts;
import org.embeddedt.embeddium.impl.render.chunk.data.MinecraftBuiltRenderSectionData;
import org.embeddedt.embeddium.impl.render.chunk.occlusion.SectionVisibilityBuilder;
import org.embeddedt.embeddium.impl.render.chunk.terrain.TerrainRenderPass;
import org.embeddedt.embeddium.impl.render.chunk.terrain.material.Material;
import org.embeddedt.embeddium.impl.util.task.CancellationToken;
import org.joml.Vector3d;
@@ -49,7 +49,7 @@ public abstract class AngelicaChunkBuilderMeshingTask extends ChunkBuilderTask<C
private static final long DEFERRED_BLOCK_TIMEOUT_MS = 10_000; // 10 seconds
private static final int MAX_RETRIES = 2;
protected record DeferredBlock(int x, int y, int z, Block block, int meta, int pass) {}
protected record DeferredBlock(int x, int y, int z, Block block, int meta, int pass, Material materialOverride, boolean isShaderPackOverride) {}
public AngelicaChunkBuilderMeshingTask(RenderSection render, int time, Vector3d camera) {
this.render = render;
@@ -108,7 +108,7 @@ public abstract class AngelicaChunkBuilderMeshingTask extends ChunkBuilderTask<C
SmoothBiomeColorCache.setActiveCache(biomeColorCache);
final IrisShaderProvider provider = IrisShaderProviderHolder.getProvider();
final Map<Block, RenderLayer> blockTypeIds = provider != null ? provider.getBlockTypeIds() : null;
final Map<Block, BlockRenderLayer> blockTypeIds = provider != null ? provider.getBlockTypeIds() : null;
final BlockRenderContext blockRenderContext = buildContext.getBlockRenderContext();
final boolean threaded = isThreaded();
@@ -142,29 +142,32 @@ public abstract class AngelicaChunkBuilderMeshingTask extends ChunkBuilderTask<C
final boolean canRenderOffThread = !threaded || canRenderOffThread(block);
for (int pass = 0; pass < AngelicaChunkBuildContext.NUM_PASSES; pass++) {
boolean canRender = block.canRenderInPass(pass);
// Check for shader pack override
final BlockRenderLayer override = blockTypeIds != null ? blockTypeIds.get(block) : null;
// Shader pack can override render layer via block.properties
if (blockTypeIds != null) {
final RenderLayer overrideLayer = blockTypeIds.get(block);
if (overrideLayer != null) {
canRender = switch (pass) {
case 0 -> overrideLayer == RenderLayer.cutout();
case 1 -> overrideLayer == RenderLayer.translucent();
default -> canRender;
};
for (int pass = 0; pass < AngelicaChunkBuildContext.NUM_PASSES; pass++) {
final boolean canRender;
Material materialOverride = null;
if (override != null) {
// Shader pack override controls both pass and material
canRender = (pass == override.toVanillaPass());
if (canRender) {
materialOverride = buffers.getRenderPassConfiguration().getMaterialForRenderType(override);
}
} else {
// Normal block rendering
canRender = block.canRenderInPass(pass);
}
if (canRender) {
final boolean isShaderPackOverride = materialOverride != null;
if (!canRenderOffThread) {
deferredBlocks.add(new DeferredBlock(x, y, z, block, meta, pass));
deferredBlocks.add(new DeferredBlock(x, y, z, block, meta, pass, materialOverride, isShaderPackOverride));
continue;
}
renderBlock(block, meta, x, y, z, pass, tessellator, renderBlocks,
buffers, buildContext, blockRenderContext, minX, minY, minZ);
renderBlock(block, meta, x, y, z, pass, tessellator, renderBlocks, buffers, buildContext, blockRenderContext, minX, minY, minZ, materialOverride, isShaderPackOverride);
}
}
@@ -207,13 +210,21 @@ public abstract class AngelicaChunkBuilderMeshingTask extends ChunkBuilderTask<C
}
}
protected void renderBlock(Block block, int metadata, int x, int y, int z, int pass, Tessellator tessellator, RenderBlocks renderBlocks, ChunkBuildBuffers buffers, AngelicaChunkBuildContext buildContext, BlockRenderContext blockRenderContext, int originX, int originY, int originZ) {
protected void renderBlock(Block block, int metadata, int x, int y, int z, int pass, Tessellator tessellator, RenderBlocks renderBlocks, ChunkBuildBuffers buffers, AngelicaChunkBuildContext buildContext, BlockRenderContext blockRenderContext, int originX, int originY, int originZ, Material materialOverride, boolean isShaderPackOverride) {
final Material blockMaterial = block.getMaterial();
final boolean isFluid = blockMaterial == Material.water || blockMaterial == Material.lava;
final var blockMaterial = block.getMaterial();
final boolean isFluid = blockMaterial == net.minecraft.block.material.Material.water || blockMaterial == net.minecraft.block.material.Material.lava;
// Use material override if provided, otherwise derive from pass
// Lava is opaque - use solid to skip unnecessary alpha testing
final var passMaterial = blockMaterial == Material.lava ? AngelicaRenderPassConfiguration.SOLID_MATERIAL : buffers.getRenderPassConfiguration().getMaterialForRenderType(BlockRenderLayer.fromVanillaPass(pass));
final Material passMaterial;
if (materialOverride != null) {
passMaterial = materialOverride;
} else if (blockMaterial == net.minecraft.block.material.Material.lava) {
passMaterial = AngelicaRenderPassConfiguration.SOLID_MATERIAL;
} else {
passMaterial = buffers.getRenderPassConfiguration().getMaterialForRenderType(BlockRenderLayer.fromVanillaPass(pass));
}
final var encoder = buffers.get(passMaterial).getEncoder();
final ContextAwareChunkVertexEncoder contextEncoder = (encoder instanceof ContextAwareChunkVertexEncoder) ? (ContextAwareChunkVertexEncoder) encoder : null;
@@ -237,7 +248,15 @@ public abstract class AngelicaChunkBuilderMeshingTask extends ChunkBuilderTask<C
block.canRenderInPass(pass);
tessellator.startDrawingQuads();
renderBlocks.renderBlockByRenderType(block, x, y, z);
buildContext.copyRawBuffer(tessellator.rawBuffer, tessellator.vertexCount, buffers, passMaterial);
// In modern versions, block models can specify whether to enable AO or not, but here we must
// rely on render ID heuristics to figure out which models would have turned it off
int vanillaRenderId = block.getRenderType();
boolean blockAllowsSmoothLighting = Minecraft.isAmbientOcclusionEnabled() // smooth lighting on
&& block.getLightValue() == 0 // does not emit real block light
&& vanillaRenderId != 1 // is not a "cross" block
&& vanillaRenderId != 40; // is not a double plant block
buildContext.copyRawBuffer(tessellator.rawBuffer, tessellator.vertexCount, buffers, passMaterial,
isShaderPackOverride, blockAllowsSmoothLighting);
tessellator.reset();
tessellator.isDrawing = false;
@@ -258,7 +277,7 @@ public abstract class AngelicaChunkBuilderMeshingTask extends ChunkBuilderTask<C
for (DeferredBlock deferred : deferredBlocks) {
renderBlock(deferred.block(), deferred.meta(), deferred.x(), deferred.y(), deferred.z(), deferred.pass(),
mainTessellator, mainThreadRenderBlocks, buffers, buildContext,
blockRenderContext, minX, minY, minZ);
blockRenderContext, minX, minY, minZ, deferred.materialOverride(), deferred.isShaderPackOverride());
}
mainTessellator.setTranslation(0, 0, 0);
@@ -68,13 +68,16 @@ public class AngelicaRenderPassConfiguration {
CUTOUT_MIPPED_MATERIAL = new Material(CUTOUT_MIPPED_PASS, AlphaCutoffParameter.ONE_TENTH, true);
final ImmutableListMultimap.Builder<BlockRenderLayer, TerrainRenderPass> vanillaRenderStages = ImmutableListMultimap.builder();
vanillaRenderStages.put(BlockRenderLayer.TRANSLUCENT, TRANSLUCENT_PASS);
vanillaRenderStages.put(BlockRenderLayer.SOLID, SOLID_PASS);
vanillaRenderStages.put(BlockRenderLayer.SOLID, CUTOUT_MIPPED_PASS);
vanillaRenderStages.put(BlockRenderLayer.CUTOUT, CUTOUT_MIPPED_PASS);
vanillaRenderStages.put(BlockRenderLayer.CUTOUT_MIPPED, CUTOUT_MIPPED_PASS);
vanillaRenderStages.put(BlockRenderLayer.TRANSLUCENT, TRANSLUCENT_PASS);
// Material lookup by terrain layer
final Map<BlockRenderLayer, Material> renderTypeToMaterialMap = new Reference2ReferenceOpenHashMap<>(4, Reference2ReferenceOpenHashMap.VERY_FAST_LOAD_FACTOR);
renderTypeToMaterialMap.put(BlockRenderLayer.SOLID, CUTOUT_MIPPED_MATERIAL);
renderTypeToMaterialMap.put(BlockRenderLayer.SOLID, SOLID_MATERIAL);
renderTypeToMaterialMap.put(BlockRenderLayer.CUTOUT, CUTOUT_MIPPED_MATERIAL);
renderTypeToMaterialMap.put(BlockRenderLayer.CUTOUT_MIPPED, CUTOUT_MIPPED_MATERIAL);
renderTypeToMaterialMap.put(BlockRenderLayer.TRANSLUCENT, TRANSLUCENT_MATERIAL);
return new RenderPassConfiguration<>(renderTypeToMaterialMap, vanillaRenderStages.build().asMap(), CUTOUT_MIPPED_MATERIAL, CUTOUT_MIPPED_MATERIAL, TRANSLUCENT_MATERIAL);
@@ -1,12 +1,18 @@
package com.gtnewhorizons.angelica.rendering.celeritas;
public enum BlockRenderLayer {
SOLID, // vanilla pass 0
TRANSLUCENT; // vanilla pass 1
SOLID, // pass 0, no alpha test
CUTOUT, // pass 0, alpha test (not mipped)
CUTOUT_MIPPED, // pass 0, alpha test (mipped)
TRANSLUCENT; // pass 1
private static final BlockRenderLayer[] VALUES = values();
public int toVanillaPass() {
return this == TRANSLUCENT ? 1 : 0;
}
public static BlockRenderLayer fromVanillaPass(int pass) {
return VALUES[pass];
// CUTOUT_MIPPED is the safe default for pass 0
// SOLID/CUTOUT are only used for explicit shader pack and material overrides
return pass == 0 ? CUTOUT_MIPPED : TRANSLUCENT;
}
}
@@ -12,6 +12,7 @@ public class VertexArrayQuadView implements ModelQuadView {
private int trueNormal;
private int blockX, blockY, blockZ;
private ModelQuadFacing lightFace;
private int flags;
public VertexArrayQuadView(ChunkVertexEncoder.Vertex[] vertices) {
this.vertices = vertices;
@@ -23,6 +24,7 @@ public class VertexArrayQuadView implements ModelQuadView {
this.blockY = blockY;
this.blockZ = blockZ;
this.lightFace = null; // Reset cached lightFace
this.flags = 0;
}
@Override
@@ -62,7 +64,10 @@ public class VertexArrayQuadView implements ModelQuadView {
@Override
public int getFlags() {
return ModelQuadFlags.getQuadFlags(this, getLightFace());
if (flags == 0) {
flags = ModelQuadFlags.getQuadFlags(this, getLightFace());
}
return flags;
}
@Override
@@ -98,6 +103,21 @@ public class VertexArrayQuadView implements ModelQuadView {
return trueNormal;
}
/**
* Gets the cull face of a quad. This is distinct from the light face, as it will not be set for non-axis-aligned
* and non-block-grid-aligned quads (i.e. quads on the surface of the 1x1x1 cube).
* @return the cull face if present, or UNASSIGNED
*/
public ModelQuadFacing getCullFace() {
// In modern, only quads that are aligned to the block grid can have a cull face, as otherwise
// they should not participate in face culling (an adjacent block wouldn't obscure an inset quad)
if ((getFlags() & ModelQuadFlags.IS_ALIGNED) == 0) {
return ModelQuadFacing.UNASSIGNED;
}
return getNormalFace();
}
private static ModelQuadFacing computeLightFace(int normal) {
final float nx = NormI8.unpackX(normal);
final float ny = NormI8.unpackY(normal);
@@ -1,12 +1,12 @@
package com.gtnewhorizons.angelica.rendering.celeritas.api;
import com.gtnewhorizons.angelica.rendering.celeritas.BlockRenderLayer;
import net.minecraft.block.Block;
import org.embeddedt.embeddium.impl.gl.shader.GlProgram;
import org.embeddedt.embeddium.impl.render.chunk.RenderPassConfiguration;
import org.embeddedt.embeddium.impl.render.chunk.shader.ChunkShaderInterface;
import org.embeddedt.embeddium.impl.render.chunk.terrain.TerrainRenderPass;
import org.embeddedt.embeddium.impl.render.chunk.vertex.format.ChunkVertexType;
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
@@ -26,5 +26,5 @@ public interface IrisShaderProvider {
void setRenderPassConfiguration(RenderPassConfiguration<?> configuration);
/** Block render layer overrides from shader pack */
@Nullable Map<Block, RenderLayer> getBlockTypeIds();
@Nullable Map<Block, BlockRenderLayer> getBlockTypeIds();
}
@@ -35,17 +35,6 @@ public class LightDataCache extends LightDataAccess {
// Opacity check - true if block is view-blocking (solid blocks)
final boolean op = block.getMaterial().isOpaque() && block.getLightOpacity() > 0;
boolean em;
if (lu > 0) {
em = true;
} else {
try {
em = block.getMixedBrightnessForBlock(EmptyBlockAccess.INSTANCE, x, y, z) == QuadLightingHelper.FULL_BRIGHT_15;
} catch (Exception e) {
em = false;
}
}
return packFC(fc) | packFO(fo) | packOP(op) | packEM(em) | packAO(ao) | packLU(lu) | packSL(sl) | packBL(bl);
return packFC(fc) | packFO(fo) | packOP(op) | packAO(ao) | packLU(lu) | packSL(sl) | packBL(bl);
}
}
@@ -1,5 +1,7 @@
package com.gtnewhorizons.angelica.rendering.celeritas.light;
import net.minecraft.block.Block;
import net.minecraft.world.IBlockAccess;
import org.embeddedt.embeddium.impl.render.chunk.vertex.format.ChunkVertexEncoder;
public final class QuadLightingHelper {
@@ -9,6 +11,15 @@ public final class QuadLightingHelper {
public static final int FULL_BRIGHT_15 = (15 << 20) | (15 << 4); // 15728880
public static final int FULL_BRIGHT_14 = (14 << 20) | (14 << 4); // 14680288
public static boolean isBlockEmissive(IBlockAccess world, int x, int y, int z) {
final Block block = world.getBlock(x, y, z);
try {
return block.getMixedBrightnessForBlock(EmptyBlockAccess.INSTANCE, x, y, z) == FULL_BRIGHT_15;
} catch (Exception e) {
return false;
}
}
public static boolean isQuadFullBright(ChunkVertexEncoder.Vertex[] vertices) {
final int first = vertices[0].light;
@@ -1,10 +1,9 @@
package net.coderbot.iris.block_rendering;
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
import com.gtnewhorizons.angelica.rendering.celeritas.BlockRenderLayer;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap;
@@ -36,33 +35,37 @@ public class BlockMaterialMapping {
return blockMatches;
}
public static Map<Block, RenderLayer> createBlockTypeMap(Map<NamespacedId, BlockRenderType> blockPropertiesMap) {
Map<Block, RenderLayer> blockTypeIds = new Reference2ReferenceOpenHashMap<>();
public static Map<Block, BlockRenderLayer> createBlockTypeMap(Map<NamespacedId, BlockRenderType> blockPropertiesMap) {
Map<Block, BlockRenderLayer> blockTypeIds = new Reference2ReferenceOpenHashMap<>();
blockPropertiesMap.forEach((id, blockType) -> {
ResourceLocation resourceLocation = new ResourceLocation(id.getNamespace(), id.getName());
final ResourceLocation resourceLocation = new ResourceLocation(id.getNamespace(), id.getName());
final Block block = Block.getBlockFromName(resourceLocation.toString());
Block block = Block.getBlockFromName(resourceLocation.toString());
if (block == null || block == Blocks.air) {
return;
}
blockTypeIds.put(block, convertBlockToRenderType(blockType));
final BlockRenderLayer layer = convertBlockToRenderLayer(blockType);
if (layer != null) {
blockTypeIds.put(block, layer);
}
});
return blockTypeIds;
}
private static RenderLayer convertBlockToRenderType(BlockRenderType type) {
private static BlockRenderLayer convertBlockToRenderLayer(BlockRenderType type) {
if (type == null) {
return null;
}
return switch (type) {
// Everything renders in cutout or translucent in 1.7.10
case SOLID, CUTOUT, CUTOUT_MIPPED -> RenderLayer.cutout();
// case SOLID -> RenderLayer.solid();
// case CUTOUT_MIPPED -> RenderLayer.cutoutMipped();
case TRANSLUCENT -> RenderLayer.translucent();
default -> null;
};
return switch (type) {
case SOLID -> BlockRenderLayer.SOLID;
case CUTOUT -> BlockRenderLayer.CUTOUT;
case CUTOUT_MIPPED -> BlockRenderLayer.CUTOUT_MIPPED;
case TRANSLUCENT -> BlockRenderLayer.TRANSLUCENT;
};
}
/**
@@ -1,6 +1,6 @@
package net.coderbot.iris.block_rendering;
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
import com.gtnewhorizons.angelica.rendering.celeritas.BlockRenderLayer;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntFunction;
import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
@@ -18,7 +18,7 @@ public class BlockRenderingSettings {
@Getter
private boolean reloadRequired;
private Reference2ObjectMap<Block, Int2IntMap> blockMetaMatches;
private Map<Block, RenderLayer> blockTypeIds;
private Map<Block, BlockRenderLayer> blockTypeIds;
private Object2IntFunction<NamespacedId> entityIds;
private Object2IntFunction<NamespacedId> itemIds;
private float ambientOcclusionLevel;
@@ -55,7 +55,7 @@ public class BlockRenderingSettings {
}
@Nullable
public Map<Block, RenderLayer> getBlockTypeIds() {
public Map<Block, BlockRenderLayer> getBlockTypeIds() {
return blockTypeIds;
}
@@ -74,7 +74,7 @@ public class BlockRenderingSettings {
this.blockMetaMatches = blockMetaIds;
}
public void setBlockTypeIds(Map<Block, RenderLayer> blockTypeIds) {
public void setBlockTypeIds(Map<Block, BlockRenderLayer> blockTypeIds) {
if (this.blockTypeIds != null && this.blockTypeIds.equals(blockTypeIds)) {
return;
}
@@ -14,6 +14,7 @@ import net.coderbot.iris.pipeline.transform.PatchShaderType;
import net.coderbot.iris.rendertarget.RenderTargets;
import net.coderbot.iris.uniforms.CommonUniforms;
import net.coderbot.iris.uniforms.builtin.BuiltinReplacementUniforms;
import net.coderbot.iris.shaderpack.ProgramSource;
import net.coderbot.iris.uniforms.custom.CustomUniforms;
import org.jetbrains.annotations.Nullable;
@@ -60,124 +61,82 @@ public class CeleritasTerrainPipeline {
IntFunction<ProgramImages> createTerrainImages,
IntFunction<ProgramImages> createShadowImages,
CustomUniforms customUniforms,
String terrainSourceName,
String translucentSourceName,
String shadowSourceName,
Optional<ProgramSource> terrainSource,
Optional<ProgramSource> translucentSource,
Optional<ProgramSource> shadowSource,
CompletableFuture<Map<PatchShaderType, String>> terrainFuture,
CompletableFuture<Map<PatchShaderType, String>> translucentFuture,
CompletableFuture<Map<PatchShaderType, String>> shadowFuture,
RenderTargets renderTargets,
ImmutableSet<Integer> flippedAfterPrepare,
ImmutableSet<Integer> flippedAfterTranslucent,
@Nullable GlFramebuffer shadowFramebuffer,
int[] terrainDrawBuffers
@Nullable GlFramebuffer shadowFramebuffer
) {
this.customUniforms = customUniforms;
// Initialize PassInfo for each pass
for (IrisTerrainPass pass : IrisTerrainPass.VALUES) {
passInfoMap.put(pass, new PassInfo());
}
// Process terrain shaders (used for GBUFFER_SOLID and GBUFFER_CUTOUT)
if (terrainFuture != null) {
try {
final Map<PatchShaderType, String> result = terrainFuture.join();
final PassInfo solidInfo = passInfoMap.get(IrisTerrainPass.GBUFFER_SOLID);
final PassInfo cutoutInfo = passInfoMap.get(IrisTerrainPass.GBUFFER_CUTOUT);
solidInfo.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
solidInfo.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
solidInfo.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
cutoutInfo.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
cutoutInfo.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
cutoutInfo.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
PatchedShaderPrinter.debugPatchedShaders(terrainSourceName + "_celeritas",
result.get(PatchShaderType.VERTEX), result.get(PatchShaderType.GEOMETRY), result.get(PatchShaderType.FRAGMENT));
} catch (Exception e) {
Iris.logger.error("Failed to transform terrain shader for Celeritas: {}", terrainSourceName, e);
throw new RuntimeException("Shader transformation failed for " + terrainSourceName, e);
}
}
// Process translucent shaders (used for GBUFFER_TRANSLUCENT)
if (translucentFuture != null) {
try {
final Map<PatchShaderType, String> result = translucentFuture.join();
final PassInfo translucentInfo = passInfoMap.get(IrisTerrainPass.GBUFFER_TRANSLUCENT);
translucentInfo.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
translucentInfo.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
translucentInfo.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
PatchedShaderPrinter.debugPatchedShaders(translucentSourceName + "_celeritas",
result.get(PatchShaderType.VERTEX), result.get(PatchShaderType.GEOMETRY), result.get(PatchShaderType.FRAGMENT));
} catch (Exception e) {
Iris.logger.error("Failed to transform translucent shader for Celeritas: {}", translucentSourceName, e);
throw new RuntimeException("Shader transformation failed for " + translucentSourceName, e);
}
}
// Process shadow shaders (used for SHADOW and SHADOW_CUTOUT)
if (shadowFuture != null) {
try {
final Map<PatchShaderType, String> result = shadowFuture.join();
final PassInfo shadowInfo = passInfoMap.get(IrisTerrainPass.SHADOW);
final PassInfo shadowCutoutInfo = passInfoMap.get(IrisTerrainPass.SHADOW_CUTOUT);
shadowInfo.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
shadowInfo.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
shadowInfo.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
shadowCutoutInfo.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
shadowCutoutInfo.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
shadowCutoutInfo.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
PatchedShaderPrinter.debugPatchedShaders(shadowSourceName + "_celeritas",
result.get(PatchShaderType.VERTEX), result.get(PatchShaderType.GEOMETRY), result.get(PatchShaderType.FRAGMENT));
} catch (Exception e) {
Iris.logger.error("Failed to transform shadow shader for Celeritas: {}", shadowSourceName, e);
throw new RuntimeException("Shader transformation failed for " + shadowSourceName, e);
}
}
// Set up framebuffers for each pass
// Shadow passes use the shadow framebuffer
if (shadowFramebuffer != null) {
passInfoMap.get(IrisTerrainPass.SHADOW).framebuffer = shadowFramebuffer;
passInfoMap.get(IrisTerrainPass.SHADOW_CUTOUT).framebuffer = shadowFramebuffer;
}
// GBuffer passes use render target framebuffers
if (renderTargets != null && terrainDrawBuffers != null) {
final GlFramebuffer solidFb = renderTargets.createGbufferFramebuffer(flippedAfterPrepare, terrainDrawBuffers);
final GlFramebuffer translucentFb = renderTargets.createGbufferFramebuffer(flippedAfterTranslucent, terrainDrawBuffers);
passInfoMap.get(IrisTerrainPass.GBUFFER_SOLID).framebuffer = solidFb;
passInfoMap.get(IrisTerrainPass.GBUFFER_CUTOUT).framebuffer = solidFb;
passInfoMap.get(IrisTerrainPass.GBUFFER_TRANSLUCENT).framebuffer = translucentFb;
}
// Set blend mode overrides
passInfoMap.get(IrisTerrainPass.GBUFFER_SOLID).blendModeOverride = BlendModeOverride.OFF;
passInfoMap.get(IrisTerrainPass.GBUFFER_CUTOUT).blendModeOverride = BlendModeOverride.OFF;
passInfoMap.get(IrisTerrainPass.GBUFFER_TRANSLUCENT).blendModeOverride = null; // Default blending
passInfoMap.get(IrisTerrainPass.SHADOW).blendModeOverride = BlendModeOverride.OFF;
passInfoMap.get(IrisTerrainPass.SHADOW_CUTOUT).blendModeOverride = BlendModeOverride.OFF;
// Set alpha references
passInfoMap.get(IrisTerrainPass.GBUFFER_SOLID).alphaReference = 0.0f;
passInfoMap.get(IrisTerrainPass.GBUFFER_CUTOUT).alphaReference = 0.1f;
passInfoMap.get(IrisTerrainPass.GBUFFER_TRANSLUCENT).alphaReference = 0.0f;
passInfoMap.get(IrisTerrainPass.SHADOW).alphaReference = 0.0f;
passInfoMap.get(IrisTerrainPass.SHADOW_CUTOUT).alphaReference = 0.1f;
this.createTerrainSamplers = createTerrainSamplers;
this.createShadowSamplers = createShadowSamplers;
this.createTerrainImages = createTerrainImages;
this.createShadowImages = createShadowImages;
// Build program source map (local - only needed during construction)
final EnumMap<IrisTerrainPass, Optional<ProgramSource>> gbufferProgramSource = new EnumMap<>(IrisTerrainPass.class);
gbufferProgramSource.put(IrisTerrainPass.GBUFFER_SOLID, terrainSource);
gbufferProgramSource.put(IrisTerrainPass.GBUFFER_CUTOUT, terrainSource);
gbufferProgramSource.put(IrisTerrainPass.GBUFFER_TRANSLUCENT, translucentSource.isPresent() ? translucentSource : terrainSource);
gbufferProgramSource.put(IrisTerrainPass.SHADOW, shadowSource);
// Initialize PassInfo, framebuffers, blend modes, and alpha in single pass
for (IrisTerrainPass pass : IrisTerrainPass.VALUES) {
PassInfo passInfo = new PassInfo();
passInfoMap.put(pass, passInfo);
// Set up framebuffer
if (pass == IrisTerrainPass.SHADOW || pass == IrisTerrainPass.SHADOW_CUTOUT) {
passInfo.framebuffer = shadowFramebuffer;
} else if (renderTargets != null) {
ImmutableSet<Integer> flipped = pass == IrisTerrainPass.GBUFFER_TRANSLUCENT ? flippedAfterTranslucent : flippedAfterPrepare;
Optional<ProgramSource> programSource = gbufferProgramSource.get(pass);
programSource.ifPresentOrElse(source -> passInfo.framebuffer = renderTargets.createGbufferFramebuffer(flipped, source.getDirectives().getDrawBuffers()), () -> passInfo.framebuffer = renderTargets.createGbufferFramebuffer(flipped, new int[] {0}));
}
// Set blend mode override
passInfo.blendModeOverride = switch (pass) {
case GBUFFER_TRANSLUCENT -> null; // Default blending
default -> BlendModeOverride.OFF;
};
// Set alpha reference
passInfo.alphaReference = switch (pass) {
case GBUFFER_CUTOUT, SHADOW_CUTOUT -> 0.1f;
default -> 0.0f;
};
}
// Process and apply shader sources
processShaderFuture(terrainFuture, terrainSource, passInfoMap.get(IrisTerrainPass.GBUFFER_SOLID), passInfoMap.get(IrisTerrainPass.GBUFFER_CUTOUT));
processShaderFuture(translucentFuture, translucentSource, passInfoMap.get(IrisTerrainPass.GBUFFER_TRANSLUCENT));
processShaderFuture(shadowFuture, shadowSource, passInfoMap.get(IrisTerrainPass.SHADOW), passInfoMap.get(IrisTerrainPass.SHADOW_CUTOUT));
}
private void processShaderFuture(@Nullable CompletableFuture<Map<PatchShaderType, String>> future, Optional<ProgramSource> source, PassInfo... targets) {
if (future == null || source.isEmpty()) {
return;
}
final String sourceName = source.get().getName();
try {
final Map<PatchShaderType, String> result = future.join();
for (PassInfo target : targets) {
target.setSource(PatchShaderType.VERTEX, result.get(PatchShaderType.VERTEX));
target.setSource(PatchShaderType.GEOMETRY, result.get(PatchShaderType.GEOMETRY));
target.setSource(PatchShaderType.FRAGMENT, result.get(PatchShaderType.FRAGMENT));
}
PatchedShaderPrinter.debugPatchedShaders(sourceName + "_celeritas",
result.get(PatchShaderType.VERTEX), result.get(PatchShaderType.GEOMETRY), result.get(PatchShaderType.FRAGMENT));
} catch (Exception e) {
Iris.logger.error("Failed to transform shader for Celeritas: {}", sourceName, e);
throw new RuntimeException("Shader transformation failed for " + sourceName, e);
}
}
public PassInfo getPassInfo(IrisTerrainPass pass) {
@@ -1,5 +1,6 @@
package net.coderbot.iris.celeritas;
import com.gtnewhorizons.angelica.rendering.celeritas.BlockRenderLayer;
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProvider;
import com.gtnewhorizons.angelica.rendering.celeritas.iris.IrisExtendedChunkVertexType;
import net.coderbot.iris.Iris;
@@ -11,7 +12,6 @@ import org.embeddedt.embeddium.impl.render.chunk.RenderPassConfiguration;
import org.embeddedt.embeddium.impl.render.chunk.shader.ChunkShaderInterface;
import org.embeddedt.embeddium.impl.render.chunk.terrain.TerrainRenderPass;
import org.embeddedt.embeddium.impl.render.chunk.vertex.format.ChunkVertexType;
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
@@ -61,7 +61,7 @@ public class IrisCeleritasShaderProvider implements IrisShaderProvider {
@Override
@Nullable
public Map<Block, RenderLayer> getBlockTypeIds() {
public Map<Block, BlockRenderLayer> getBlockTypeIds() {
return BlockRenderingSettings.INSTANCE.getBlockTypeIds();
}
@@ -104,7 +104,7 @@ public class GlFramebuffer extends GlResource {
@Override
protected void destroyInternal() {
OpenGlHelper.func_153184_g/*glDeleteFramebuffers*/(getGlId());
OpenGlHelper.func_153174_h/*glDeleteFramebuffers*/(getGlId());
}
public boolean isComplete() {
@@ -96,7 +96,7 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
@Override
public void drawScreen(int mouseX, int mouseY, float delta) {
GLStateManager.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
if(dirty) {
dirty = false;
this.initGui();
@@ -174,7 +174,7 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
} else {
this.fontRendererObj.drawStringWithShadow(irisTextComponent, 2, this.height - 10, 0xFFFFFF);
}
GLStateManager.glPopAttrib();
}
@@ -507,7 +507,7 @@ public class ShaderPackScreen extends GuiScreen implements HudHideable {
}
public boolean isDisplayingComment() {
return this.hoveredElementCommentTimer > 20 &&
return this.hoveredElementCommentTimer > 10 &&
this.hoveredElementCommentTitle.isPresent() &&
!this.hoveredElementCommentBody.isEmpty();
}
@@ -524,19 +524,16 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
final GlFramebuffer celeritasShadowFb = (shadowRenderTargets != null && shadowRenderer != null)
? shadowRenderTargets.createShadowFramebuffer(shadowRenderTargets.snapshot(), new int[] {0, 1})
: null;
final int[] celeritasTerrainDrawBuffers = terrainSource
.map(source -> source.getDirectives().getDrawBuffers())
.orElse(new int[] {0});
this.celeritasTerrainPipeline = new CeleritasTerrainPipeline(createTerrainSamplers,
shadowRenderer == null ? null : createShadowTerrainSamplers, createTerrainImages,
shadowRenderer == null ? null : createShadowTerrainImages, this.customUniforms,
terrainSource.map(ProgramSource::getName).orElse(null),
translucentSource.map(ProgramSource::getName).orElse(null),
shadowSource.map(ProgramSource::getName).orElse(null),
terrainSource,
translucentSource,
shadowSource,
celeritasTerrainFuture, celeritasTranslucentFuture, celeritasShadowFuture,
renderTargets, flippedAfterPrepare, flippedAfterTranslucent,
celeritasShadowFb, celeritasTerrainDrawBuffers);
celeritasShadowFb);
this.dhCompat = new DHCompat();
}
@@ -930,11 +927,21 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
// Destroy the composite rendering pipeline
//
// This destroys all the loaded composite programs as well.
prepareRenderer.destroy();
compositeRenderer.destroy();
deferredRenderer.destroy();
finalPassRenderer.destroy();
centerDepthSampler.destroy();
// Destroy shadow compute programs
if (shadowComputes != null) {
for (ComputeProgram compute : shadowComputes) {
if (compute != null) {
compute.destroy();
}
}
}
horizonRenderer.destroy();
// Make sure that any custom framebuffers are not bound before destroying render targets
@@ -957,7 +964,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
// Destroy custom textures and the static samplers (normals, specular, and noise)
customTextureManager.destroy();
// whitePixel.releaseId();
whitePixel.deleteGlTexture();
// Destroy custom images
for (GlImage image : customImages) {
@@ -3,9 +3,9 @@ package net.coderbot.iris.pipeline;
import com.gtnewhorizons.angelica.compat.mojang.Camera;
import com.gtnewhorizons.angelica.compat.mojang.GameModeUtil;
import com.gtnewhorizons.angelica.compat.mojang.InteractionHand;
import com.gtnewhorizons.angelica.compat.toremove.RenderLayer;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import com.gtnewhorizons.angelica.rendering.RenderingState;
import com.gtnewhorizons.angelica.rendering.celeritas.BlockRenderLayer;
import net.coderbot.iris.block_rendering.BlockRenderingSettings;
import net.coderbot.iris.layer.GbufferPrograms;
import net.irisshaders.iris.api.v0.IrisApi;
@@ -81,14 +81,12 @@ public class HandRenderer {
public boolean isHandTranslucent(InteractionHand hand) {
ItemStack heldItem = hand.getItemInHand(Minecraft.getMinecraft().thePlayer);
if (heldItem == null) {
return false;
}
Item item = heldItem.getItem();
if (heldItem == null) return false;
final Item item = heldItem.getItem();
if (item instanceof ItemBlock itemBlock) {
Map<Block, RenderLayer> blockTypeIds = BlockRenderingSettings.INSTANCE.getBlockTypeIds();
return blockTypeIds != null && blockTypeIds.get(itemBlock.field_150939_a) == RenderLayer.translucent();
final Map<Block, BlockRenderLayer> blockTypeIds = BlockRenderingSettings.INSTANCE.getBlockTypeIds();
return blockTypeIds != null && blockTypeIds.get(itemBlock.field_150939_a) == BlockRenderLayer.TRANSLUCENT;
}
return false;
@@ -36,7 +36,6 @@ import net.coderbot.iris.uniforms.CelestialUniforms;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.culling.Frustrum;
import net.minecraft.client.renderer.entity.RenderManager;
@@ -538,7 +537,7 @@ public class ShadowRenderer {
return;
}
int brightness = tile.getWorldObj().getLightBrightnessForSkyBlocks(tile.xCoord, tile.yCoord, tile.zCoord, 0);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) brightness % 65536, (float) brightness / 65536);
GLStateManager.setLightmapTextureCoords(GL13.GL_TEXTURE1, (float) brightness % 65536, (float) brightness / 65536);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
TileEntityRendererDispatcher.instance.renderTileEntityAt(tile,
(double)tile.xCoord - cameraX,
@@ -453,5 +453,6 @@ public class FinalPassRenderer {
if (finalPass != null) {
finalPass.destroy();
}
colorHolder.destroy();
}
}
@@ -203,7 +203,14 @@ public class ShaderPack {
this.shaderPackOptions = new ShaderPackOptions(graph, changedConfigs);
graph = this.shaderPackOptions.getIncludes();
Iterable<StringPair> finalEnvironmentDefines = environmentDefines;
List<StringPair> finalEnvironmentDefines = new ArrayList<>();
environmentDefines.forEach(finalEnvironmentDefines::add);
for (FeatureFlags flag : FeatureFlags.values()) {
if (flag.isUsable()) {
finalEnvironmentDefines.add(new StringPair("IRIS_FEATURE_" + flag.name(), ""));
}
}
this.shaderProperties = Optional.ofNullable(readProperties(root, "shaders.properties"))
.map(source -> new ShaderProperties(source, shaderPackOptions, finalEnvironmentDefines))
.orElseGet(ShaderProperties::empty);
@@ -220,15 +227,6 @@ public class ShaderPack {
IrisApi.getInstance().getConfig().setShadersEnabledAndApply(false);
}
List<String> optionalFeatureFlags = shaderProperties.getOptionalFeatureFlags().stream().filter(flag -> !FeatureFlags.isInvalid(flag)).collect(Collectors.toList());
if (!optionalFeatureFlags.isEmpty()) {
List<StringPair> newEnvDefines = new ArrayList<>();
environmentDefines.forEach(newEnvDefines::add);
optionalFeatureFlags.forEach(flag -> newEnvDefines.add(new StringPair("IRIS_FEATURE_" + flag, "")));
environmentDefines = ImmutableList.copyOf(newEnvDefines);
}
ProfileSet profiles = ProfileSet.fromTree(shaderProperties.getProfiles(), this.shaderPackOptions.getOptionSet());
this.profile = profiles.scan(this.shaderPackOptions.getOptionSet(), this.shaderPackOptions.getOptionValues());
@@ -26,10 +26,11 @@ public class ItemMaterialHelper {
/**
* Get the material ID for an ItemStack.
* Checks item.properties first, then block.properties if the item is an ItemBlock.
* For ItemBlock: checks block.properties first, then item.properties.
* For other items: checks item.properties only.
*
* @param itemStack The item stack to get material ID for
* @return The material ID, or -1 if not found in either map
* @return The material ID, or -1 if not found
*/
public static int getMaterialId(ItemStack itemStack) {
if (itemStack == null || itemStack.getItem() == null) {
@@ -68,50 +69,42 @@ public class ItemMaterialHelper {
/**
* Perform the actual material ID lookup without caching.
*
* For block items (ItemBlock): use block.properties first, then fall back to item.properties.
* For non-block items: use item.properties only.
*
* This matches modern Iris behavior where block items use block IDs and non-block items use item IDs.
*/
private static int lookupMaterialId(Item item, int metadata) {
String itemIdString = (String) Item.itemRegistry.getNameForObject(item);
if (itemIdString == null) {
return -1;
}
ResourceLocation itemId = new ResourceLocation(itemIdString);
NamespacedId namespacedId = new NamespacedId(itemId.getResourceDomain(), itemId.getResourcePath());
// First, check item.properties
Object2IntFunction<NamespacedId> itemIds = BlockRenderingSettings.INSTANCE.getItemIds();
if (itemIds != null) {
int id = itemIds.applyAsInt(namespacedId);
if (id != -1) {
return id;
}
}
// Second, check block.properties if this is an ItemBlock
// For ItemBlock: check block.properties first
if (item instanceof ItemBlock) {
ItemBlock itemBlock = (ItemBlock) item;
Block block = itemBlock.field_150939_a; // The block this item places
final ItemBlock itemBlock = (ItemBlock) item;
final Block block = itemBlock.field_150939_a; // The block this item places
if (block == null) {
return -1;
}
// Convert item damage to block metadata
int blockMeta = itemBlock.getMetadata(metadata);
Reference2ObjectMap<Block, Int2IntMap> blockMetaMatches = BlockRenderingSettings.INSTANCE.getBlockMetaMatches();
if (blockMetaMatches != null) {
Int2IntMap metaMap = blockMetaMatches.get(block);
if (metaMap != null) {
int id = metaMap.get(blockMeta);
if (id != -1) {
return id;
if (block != null) {
Reference2ObjectMap<Block, Int2IntMap> blockMetaMatches = BlockRenderingSettings.INSTANCE.getBlockMetaMatches();
if (blockMetaMatches != null) {
Int2IntMap metaMap = blockMetaMatches.get(block);
if (metaMap != null) {
int id = metaMap.get(itemBlock.getMetadata(metadata));
if (id != -1) {
return id;
}
}
}
}
}
// Not found in either map
// Fall back to item.properties
Object2IntFunction<NamespacedId> itemIds = BlockRenderingSettings.INSTANCE.getItemIds();
if (itemIds != null) {
String itemIdString = (String) Item.itemRegistry.getNameForObject(item);
if (itemIdString != null) {
ResourceLocation itemId = new ResourceLocation(itemIdString);
return itemIds.applyAsInt(new NamespacedId(itemId.getResourceDomain(), itemId.getResourcePath()));
}
}
return -1;
}
@@ -17,7 +17,6 @@ import net.coderbot.iris.pipeline.WorldRenderingPipeline;
import net.coderbot.iris.shadows.ShadowRenderingState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.RenderHelper;
@@ -31,6 +30,7 @@ import org.embeddedt.embeddium.impl.render.chunk.shader.ChunkShaderFogComponent;
import org.embeddedt.embeddium.impl.render.terrain.SimpleWorldRenderer;
import org.embeddedt.embeddium.impl.render.viewport.ViewportProvider;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -144,7 +144,7 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
RenderHelper.disableStandardItemLighting();
GLStateManager.glActiveTexture(OpenGlHelper.defaultTexUnit);
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0);
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.getTextureMapBlocks().getGlTextureId());
GLStateManager.glEnable(GL11.GL_TEXTURE_2D);
@@ -158,8 +158,15 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
final double camZ = lerp(entity.lastTickPosZ, entity.posZ, partialTicks);
try {
mc.mcProfiler.endStartSection("draw_chunk_layer_" + pass);
this.celeritas$renderer.drawChunkLayer(BlockRenderLayer.fromVanillaPass(pass), camX, camY, camZ);
if (pass == 0) {
mc.mcProfiler.endStartSection("draw_chunk_layer_solid");
this.celeritas$renderer.drawChunkLayer(BlockRenderLayer.SOLID, camX, camY, camZ);
mc.mcProfiler.endStartSection("draw_chunk_layer_cutout_mipped");
this.celeritas$renderer.drawChunkLayer(BlockRenderLayer.CUTOUT_MIPPED, camX, camY, camZ);
} else {
mc.mcProfiler.endStartSection("draw_chunk_layer_translucent");
this.celeritas$renderer.drawChunkLayer(BlockRenderLayer.TRANSLUCENT, camX, camY, camZ);
}
} finally {
RenderDevice.exitManagedCode();
}
@@ -1,7 +1,7 @@
package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cit.client.renderer.entity;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.EntityLivingBase;
@@ -13,6 +13,7 @@ import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.Logger;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL13;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@@ -224,9 +225,9 @@ public abstract class MixinRenderEntityLiving extends Render {
this.renderEquippedItems(entity, p_76986_9_);
float f14 = entity.getBrightness(p_76986_9_);
j = this.getColorMultiplier(entity, f14, p_76986_9_);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GLStateManager.setActiveTexture(GL13.GL_TEXTURE1);
GL11.glDisable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
GLStateManager.setActiveTexture(GL13.GL_TEXTURE0);
if ((j >> 24 & 255) > 0 || entity.hurtTime > 0 || entity.deathTime > 0) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
@@ -274,9 +275,9 @@ public abstract class MixinRenderEntityLiving extends Render {
logger.error("Couldn't render entity", exception);
}
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GLStateManager.setActiveTexture(GL13.GL_TEXTURE1);
GL11.glEnable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
GLStateManager.setActiveTexture(GL13.GL_TEXTURE0);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
this.passSpecialRender(entity, x, y, z);
@@ -1,53 +0,0 @@
package com.gtnewhorizons.angelica.mixins.early.shaders;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL30;
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.CallbackInfo;
@Mixin(OpenGlHelper.class)
public class MixinOpenGlHelper {
@Unique private static int iris$drawFramebuffer = 0;
@Unique private static int iris$readFramebuffer = 0;
@Inject(method="func_153171_g", at=@At("HEAD"), cancellable=true)
private static void iris$avoidRedundantBind(int target, int framebuffer, CallbackInfo ci) {
if (target == GL30.GL_FRAMEBUFFER) {
if (iris$drawFramebuffer == target && iris$readFramebuffer == target) {
ci.cancel();
} else {
iris$drawFramebuffer = framebuffer;
iris$readFramebuffer = framebuffer;
}
} else if (target == GL30.GL_DRAW_FRAMEBUFFER) {
if (iris$drawFramebuffer == target) {
ci.cancel();
} else {
iris$drawFramebuffer = framebuffer;
}
} else if (target == GL30.GL_READ_FRAMEBUFFER) {
if (iris$readFramebuffer == target) {
ci.cancel();
} else {
iris$readFramebuffer = framebuffer;
}
} else {
throw new IllegalStateException("Invalid framebuffer target: " + target);
}
}
@Inject(method="func_153174_h", at=@At("HEAD"))
private static void iris$trackFramebufferDelete(int framebuffer, CallbackInfo ci) {
if (iris$drawFramebuffer == framebuffer) {
iris$drawFramebuffer = 0;
}
if (iris$readFramebuffer == framebuffer) {
iris$readFramebuffer = 0;
}
}
}
@@ -20,6 +20,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(RendererLivingEntity.class)
public class MixinRendererLivingEntity {
/**
* Reset currentRenderedItemId at the start of rendering each living entity, otherwise entity materials don't apply.
*/
@Inject(
method = "doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V",
at = @At("HEAD")
)
private void iris$resetItemIdAtStart(EntityLivingBase entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) {
CapturedRenderingState.INSTANCE.setCurrentRenderedItem(0);
}
@WrapOperation(
method="doRender",
at=@At(value="INVOKE", target="Lnet/minecraft/client/renderer/entity/RendererLivingEntity;getColorMultiplier(Lnet/minecraft/entity/EntityLivingBase;FF)I")
@@ -30,10 +30,29 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(value = SkyProviderCelestial.class, priority = 100)
public class MixinSkyProviderCelestial_ShaderCompat {
/// Simple white 2x2 texture
@Unique
private static ResourceLocation GL_TEXTURE_2D_WORKAROUND = new ResourceLocation("angelica:textures/shaders_workaround.png"); /// Simple white 2x2 texture
private static ResourceLocation GL_TEXTURE_2D_WORKAROUND = new ResourceLocation("angelica:textures/shaders_workaround.png");
/// Fixes
// Fixes
/**
* Disables {@link GL11#glDisable(int GL_TEXTURE_2D)} call
* @see #iris$atmosphereBlend$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)
*/
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", ordinal = 0), remap = false)
private boolean iris$sunset$revertTextureDisable(int i) {
return false;
}
/**
* Disables {@link GL11#glEnable(int GL_TEXTURE_2D)} call
* @see #iris$atmosphereBlend$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)
*/
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", ordinal = 0), remap = false)
private boolean iris$sunsetBlend$revertTextureEnable(int i) {
return false;
}
/**
* Forces sunset to render with the default program
@@ -41,13 +60,14 @@ public class MixinSkyProviderCelestial_ShaderCompat {
* Fixes sunset not rendering at all with shaders enabled
*/
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;renderSunset(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;)V"), remap = false)
public void iris$sunset$renderInDefaultProgram(CallbackInfo ci, @Share("sunset$previousProgram") LocalIntRef sunset$previousProgram) {
public void iris$sunset$renderInDefaultProgram(CallbackInfo ci, @Local(argsOnly = true) Minecraft mc, @Share("sunset$previousProgram") LocalIntRef sunset$previousProgram) {
sunset$previousProgram.set(GLStateManager.getActiveProgram());
GLStateManager.glUseProgram(0);
mc.getTextureManager().bindTexture(GL_TEXTURE_2D_WORKAROUND);
}
/**
* Sets the program back before {@link #iris$sunset$renderInDefaultProgram(CallbackInfo, LocalIntRef)} call
* Sets the program back before {@link #iris$sunset$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)} call
*/
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;renderSunset(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;)V", shift = At.Shift.AFTER), remap = false)
public void iris$sunset$restorePreviousProgram(CallbackInfo ci, @Share("sunset$previousProgram") LocalIntRef sunset$previousProgram) {
@@ -200,7 +220,7 @@ public class MixinSkyProviderCelestial_ShaderCompat {
GLStateManager.glUseProgram(ringsFront$previousProgram.get());
}
/// Pipeline setup
// Pipeline setup
@Inject(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/Tessellator;instance:Lnet/minecraft/client/renderer/Tessellator;"))
private void iris$renderSky$beginNormalSky(CallbackInfo ci, @Share("pipeline") LocalRef<WorldRenderingPipeline> pipeline) {
@@ -0,0 +1,28 @@
package com.gtnewhorizons.angelica.mixins.late.client.ntmSpace;
import com.hbm.dim.laythe.SkyProviderLaytheSunset;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(value = SkyProviderLaytheSunset.class, priority = 100)
public class MixinSkyProviderLaytheSunset {
/**
* Disables {@link GL11#glDisable(int GL_TEXTURE_2D)} call
*/
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glDisable(I)V", ordinal = 0), remap = false)
private boolean iris$sunset$revertTextureDisable(int i) {
return false;
}
/**
* Disables {@link GL11#glEnable(int GL_TEXTURE_2D)} call
*/
@WrapWithCondition(method = "renderSunset", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", ordinal = 0), remap = false)
private boolean iris$sunsetBlend$revertTextureEnable(int i) {
return false;
}
}