mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-24 06:04:27 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
417f23f826 | ||
|
|
ca3c46c873 | ||
|
|
82fa9ade2b | ||
|
|
aaab8fd0bc | ||
|
|
bd56ccc4b8 |
No files matched your search
+1
-1
@@ -71,7 +71,7 @@ dependencies {
|
||||
|
||||
// Iris Shaders
|
||||
compileOnly('org.jetbrains:annotations:26.0.2')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.9.9:dev")
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.9.10:dev")
|
||||
|
||||
shadowImplementation("org.anarres:jcpp:1.4.14") // Apache 2.0
|
||||
shadowImplementation("org.taumc:glsl-transformation-lib:0.2.0-26.g5ee7d96-GTNH") {
|
||||
|
||||
@@ -88,12 +88,16 @@ public class AngelicaConfig {
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableHudCachingEventTransformer;
|
||||
|
||||
@Config.Comment("Enable HUD Caching at runtime. Requires enableHudCaching to be on at startup. [Experimental]")
|
||||
@Config.DefaultBoolean(false)
|
||||
public static boolean hudCachingActive;
|
||||
|
||||
@Config.Comment("The amount of frames to wait before updating the HUD elements. [Experimental]")
|
||||
@Config.DefaultInt(20)
|
||||
@Config.RangeInt(min = 1, max = 60)
|
||||
public static int hudCachingFPS = 20;
|
||||
|
||||
@Config.Comment("Batch drawScreen fonts [Experimental]")
|
||||
@Config.Comment("Batch drawScreen fonts")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableFontRenderer;
|
||||
@@ -210,6 +214,8 @@ public class AngelicaConfig {
|
||||
"shukaro.artifice.block.world.BlockOre",
|
||||
"bartworks.system.material.BWMetaGeneratedOres",
|
||||
"gtPlusPlus.core.block.base.BlockBaseOre",
|
||||
"org.pfaa.geologica.block.BrokenGeoBlock",
|
||||
"org.pfaa.geologica.block.BrickGeoBlock",
|
||||
})
|
||||
public static String[] blockCrackFixRenderPassWhitelist__;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gtnewhorizons.angelica.glsm;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.client.opengl.UniversalVAO;
|
||||
import com.mitchej123.glsm.GLStateManagerService;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -149,17 +150,17 @@ public class AngelicaGLStateManagerService implements GLStateManagerService {
|
||||
|
||||
@Override
|
||||
public int glGenVertexArrays() {
|
||||
return GL30.glGenVertexArrays();
|
||||
return UniversalVAO.genVertexArrays();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBindVertexArray(int array) {
|
||||
GL30.glBindVertexArray(array);
|
||||
GLStateManager.glBindVertexArray(array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDeleteVertexArrays(int array) {
|
||||
GL30.glDeleteVertexArrays(array);
|
||||
UniversalVAO.deleteVertexArrays(array);
|
||||
}
|
||||
|
||||
// ===================== BUFFER OPERATIONS =====================
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.joml.Vector3d;
|
||||
import org.joml.Vector3f;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.opengl.APPLEVertexArrayObject;
|
||||
import com.gtnewhorizon.gtnhlib.client.opengl.UniversalVAO;
|
||||
import org.lwjgl.opengl.ARBMultitexture;
|
||||
import org.lwjgl.opengl.ContextCapabilities;
|
||||
import org.lwjgl.opengl.Display;
|
||||
@@ -3778,20 +3778,12 @@ public class GLStateManager {
|
||||
}
|
||||
if (boundVAO != array) {
|
||||
boundVAO = array;
|
||||
GL30.glBindVertexArray(array);
|
||||
UniversalVAO.bindVertexArray(array);
|
||||
}
|
||||
}
|
||||
|
||||
public static void glBindVertexArrayAPPLE(int array) {
|
||||
if (DisplayListManager.isRecording()) {
|
||||
DisplayListManager.recordBindVAO(array);
|
||||
// Since the vao needs to be bound to do stuff like state setup & data upload, it'll still execute the bind call.
|
||||
// This is technically wrong, but I'm not sure if there's a better solution here.
|
||||
}
|
||||
if (boundVAO != array) {
|
||||
boundVAO = array;
|
||||
APPLEVertexArrayObject.glBindVertexArrayAPPLE(array);
|
||||
}
|
||||
glBindVertexArray(array);
|
||||
}
|
||||
|
||||
public static boolean isVBOBound() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gtnewhorizons.angelica.glsm.recording;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vao.VAOManager;
|
||||
import com.gtnewhorizon.gtnhlib.client.opengl.UniversalVAO;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vertex.VertexFlags;
|
||||
import com.gtnewhorizons.angelica.glsm.DisplayListManager;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
@@ -519,7 +519,7 @@ public final class CommandBufferExecutor {
|
||||
ptr += 4;
|
||||
}
|
||||
case GLCommand.BIND_VAO -> {
|
||||
VAOManager.VAO.glBindVertexArray(memGetInt(ptr));
|
||||
UniversalVAO.bindVertexArray(memGetInt(ptr));
|
||||
ptr += 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public class HUDCaching {
|
||||
XaeroMinimapCore.beforeIngameGuiRender(partialTicks);
|
||||
}
|
||||
|
||||
if (!GLStateManager.isFramebufferEnabled()) {
|
||||
if (!AngelicaConfig.hudCachingActive || !GLStateManager.isFramebufferEnabled()) {
|
||||
ingame.renderGameOverlay(partialTicks, hasScreen, mouseX, mouseY);
|
||||
return;
|
||||
}
|
||||
|
||||
+57
-2
@@ -54,6 +54,18 @@ public final class AngelicaRedirector {
|
||||
private static final String OpenGlHelper = "net/minecraft/client/renderer/OpenGlHelper";
|
||||
private static final String EXTBlendFunc = "org/lwjgl/opengl/EXTBlendFuncSeparate";
|
||||
private static final String ARBMultiTexture = "org/lwjgl/opengl/ARBMultitexture";
|
||||
|
||||
// Redirect VAO related calls from NHLib and LWJGLService
|
||||
private static final String UniversalVAO = "com/gtnewhorizon/gtnhlib/client/opengl/UniversalVAO";
|
||||
private static final String UniversalVAODot = "com.gtnewhorizon.gtnhlib.client.opengl.UniversalVAO";
|
||||
private static final String VaoFunctions = "com/gtnewhorizon/gtnhlib/client/renderer/vao/VaoFunctions";
|
||||
private static final String LWJGLService = "com/mitchej123/lwjgl/LWJGLService";
|
||||
|
||||
// Don't redirect these items inside of UniversalVAO, since we might be delegating to them
|
||||
private static final Set<String> UniversalVAOSkippedMethods = ImmutableSet.of(
|
||||
"glBindVertexArray", "glGenVertexArrays", "glDeleteVertexArrays", "glIsVertexArray"
|
||||
);
|
||||
|
||||
private static final String MinecraftClient = "net.minecraft.client";
|
||||
private static final String SplashProgress = "cpw.mods.fml.client.SplashProgress";
|
||||
private static final Set<String> ExcludedMinecraftMainThreadChecks = ImmutableSet.of(
|
||||
@@ -63,6 +75,7 @@ public final class AngelicaRedirector {
|
||||
|
||||
private static final ClassConstantPoolParser cstPoolParser = new ClassConstantPoolParser(GL11, GL12, GL13, GL14, GL20, OpenGlHelper, EXTBlendFunc, ARBMultiTexture, Project);
|
||||
private static final Map<String, Map<String, String>> methodRedirects = new HashMap<>();
|
||||
private static final Map<String, Map<String, String>> interfaceRedirects = new HashMap<>();
|
||||
private static final Map<Integer, String> glCapRedirects = new HashMap<>();
|
||||
|
||||
static {
|
||||
@@ -270,12 +283,29 @@ public final class AngelicaRedirector {
|
||||
|
||||
// APPLE
|
||||
methodRedirects.put(APPLEVertexArrayObject, RedirectMap.newMap()
|
||||
.add("glBindVertexArrayAPPLE")
|
||||
.add("glBindVertexArrayAPPLE", "glBindVertexArray")
|
||||
);
|
||||
|
||||
// GTNHLib VAO
|
||||
methodRedirects.put(UniversalVAO, RedirectMap.newMap()
|
||||
.add("bindVertexArray", "glBindVertexArray")
|
||||
);
|
||||
|
||||
// OTHER
|
||||
methodRedirects.put(Project, RedirectMap.newMap().add("gluPerspective"));
|
||||
|
||||
// Interface/virtual redirects — callers invoke these on a receiver object
|
||||
interfaceRedirects.put(VaoFunctions, RedirectMap.newMap()
|
||||
.add("glBindVertexArray")
|
||||
);
|
||||
interfaceRedirects.put(LWJGLService, RedirectMap.newMap()
|
||||
.add("glBindVertexArray")
|
||||
);
|
||||
|
||||
cstPoolParser.addString(UniversalVAO);
|
||||
cstPoolParser.addString(VaoFunctions);
|
||||
cstPoolParser.addString(LWJGLService);
|
||||
|
||||
final String glPrefix = "org/lwjgl/opengl/GL";
|
||||
for (var entry : new HashMap<>(methodRedirects).entrySet()) {
|
||||
if (entry.getKey().startsWith(glPrefix)) {
|
||||
@@ -356,7 +386,8 @@ public final class AngelicaRedirector {
|
||||
final Map<String, String> redirects = methodRedirects.get(mNode.owner);
|
||||
if (redirects != null) {
|
||||
final String glsmName = redirects.get(mNode.name);
|
||||
if (glsmName != null) {
|
||||
// Skip VAO method redirects inside UniversalVAO
|
||||
if (glsmName != null && !(transformedName.startsWith(UniversalVAODot) && UniversalVAOSkippedMethods.contains(glsmName))) {
|
||||
if (LOG_SPAM) {
|
||||
final String shortOwner = mNode.owner.substring(mNode.owner.lastIndexOf("/") + 1);
|
||||
LOGGER.info("Redirecting call in {} from {}.{}{} to GLStateManager.{}{}", transformedName, shortOwner, mNode.name, mNode.desc, glsmName, mNode.desc);
|
||||
@@ -367,6 +398,30 @@ public final class AngelicaRedirector {
|
||||
redirectInMethod = true;
|
||||
}
|
||||
}
|
||||
// Interface/virtual redirects: rewrite receiver-based calls to static GLStateManager calls
|
||||
if ((mNode.getOpcode() == Opcodes.INVOKEINTERFACE || mNode.getOpcode() == Opcodes.INVOKEVIRTUAL) && mNode.desc.equals("(I)V")) {
|
||||
final Map<String, String> ifaceRedirects = interfaceRedirects.get(mNode.owner);
|
||||
if (ifaceRedirects != null) {
|
||||
final String glsmName = ifaceRedirects.get(mNode.name);
|
||||
if (glsmName != null && !(transformedName.startsWith(UniversalVAODot) && UniversalVAOSkippedMethods.contains(glsmName))) {
|
||||
if (LOG_SPAM) {
|
||||
final String shortOwner = mNode.owner.substring(mNode.owner.lastIndexOf("/") + 1);
|
||||
LOGGER.info("Redirecting interface call in {} from {}.{}{} to GLStateManager.{}{}", transformedName, shortOwner, mNode.name, mNode.desc, glsmName, "(I)V");
|
||||
}
|
||||
// Stack is: [receiver, int_arg]. We need just [int_arg] for static call.
|
||||
// Insert SWAP + POP before the call to remove the receiver.
|
||||
mn.instructions.insertBefore(mNode, new InsnNode(Opcodes.SWAP));
|
||||
mn.instructions.insertBefore(mNode, new InsnNode(Opcodes.POP));
|
||||
mNode.setOpcode(Opcodes.INVOKESTATIC);
|
||||
mNode.owner = GLStateManager;
|
||||
mNode.name = glsmName;
|
||||
mNode.desc = "(I)V";
|
||||
mNode.itf = false;
|
||||
changed = true;
|
||||
redirectInMethod = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
-1
@@ -1,11 +1,17 @@
|
||||
package com.gtnewhorizons.angelica.rendering.celeritas;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProvider;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProviderHolder;
|
||||
import org.embeddedt.embeddium.impl.gl.device.RenderDevice;
|
||||
import org.embeddedt.embeddium.impl.gl.shader.GlProgram;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.MultiDrawMode;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.DefaultChunkRenderer;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.RenderPassConfiguration;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.multidraw.DirectMultiDrawEmitter;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.multidraw.IndirectMultiDrawEmitter;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.multidraw.MultiDrawEmitter;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.shader.ChunkShaderInterface;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.shader.ChunkShaderTextureSlot;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.terrain.TerrainRenderPass;
|
||||
@@ -15,7 +21,7 @@ class AngelicaChunkRenderer extends DefaultChunkRenderer {
|
||||
private boolean usingIrisProgram;
|
||||
|
||||
public AngelicaChunkRenderer(RenderDevice device, RenderPassConfiguration<?> renderPassConfiguration) {
|
||||
super(device, renderPassConfiguration);
|
||||
super(device, renderPassConfiguration, createEmitter());
|
||||
|
||||
final IrisShaderProvider provider = IrisShaderProviderHolder.getProvider();
|
||||
if (provider != null) {
|
||||
@@ -23,6 +29,24 @@ class AngelicaChunkRenderer extends DefaultChunkRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
private static MultiDrawEmitter createEmitter() {
|
||||
MultiDrawMode mode = AngelicaMod.options().advanced.multiDrawMode;
|
||||
|
||||
if (mode == MultiDrawMode.INDIRECT) {
|
||||
boolean supported = GLStateManager.capabilities != null && (GLStateManager.capabilities.OpenGL43 || GLStateManager.capabilities.GL_ARB_multi_draw_indirect);
|
||||
if (!supported) {
|
||||
AngelicaMod.LOGGER.warn("Indirect multi-draw not supported (requires GL 4.3 / ARB_multi_draw_indirect), falling back to Direct");
|
||||
mode = MultiDrawMode.DIRECT;
|
||||
}
|
||||
}
|
||||
|
||||
return switch (mode) {
|
||||
case DIRECT -> new DirectMultiDrawEmitter();
|
||||
case INDIRECT -> new IndirectMultiDrawEmitter();
|
||||
case INDIVIDUAL -> new IndividualDrawEmitter();
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void begin(TerrainRenderPass pass) {
|
||||
final IrisShaderProvider provider = IrisShaderProviderHolder.getProvider();
|
||||
|
||||
+1
-1
@@ -28,9 +28,9 @@ public class AngelicaMainThreadMeshingTask extends AngelicaChunkBuilderMeshingTa
|
||||
final int minZ = this.render.getOriginZ();
|
||||
|
||||
final var world = Minecraft.getMinecraft().theWorld;
|
||||
this.blockAccess = new ChunkCache(world, minX - 1, minY - 1, minZ - 1, minX + 17, minY + 17, minZ + 17, 1);
|
||||
this.biomeColorCache = ((WorldClientExtension) world).celeritas$getSmoothBiomeColorCache();
|
||||
this.biomeColorCache.update(new SectionPos(this.render.getChunkX(), this.render.getChunkY(), this.render.getChunkZ()));
|
||||
this.blockAccess = new ChunkCache(world, minX - 1, minY - 1, minZ - 1, minX + 17, minY + 17, minZ + 17, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.gtnewhorizons.angelica.rendering.celeritas;
|
||||
|
||||
import static com.mitchej123.lwjgl.LWJGLServiceProvider.LWJGL;
|
||||
import static com.mitchej123.lwjgl.LWJGLServiceProvider.POINTER_SIZE;
|
||||
|
||||
import org.embeddedt.embeddium.impl.gl.device.CommandList;
|
||||
import org.embeddedt.embeddium.impl.gl.device.DrawCommandList;
|
||||
import org.embeddedt.embeddium.impl.gl.device.MultiDrawBatch;
|
||||
import org.embeddedt.embeddium.impl.gl.tessellation.GlIndexType;
|
||||
import org.embeddedt.embeddium.impl.gl.tessellation.GlPrimitiveType;
|
||||
import org.embeddedt.embeddium.impl.gl.tessellation.GlTessellation;
|
||||
import org.embeddedt.embeddium.impl.model.quad.properties.ModelQuadFacing;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.data.SectionRenderDataUnsafe;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.multidraw.MultiDrawEmitter;
|
||||
|
||||
public record IndividualDrawEmitter(MultiDrawBatch batch) implements MultiDrawEmitter {
|
||||
public IndividualDrawEmitter() {
|
||||
this(new MultiDrawBatch(MAX_COMMAND_COUNT));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("IntegerMultiplicationImplicitCastToLong")
|
||||
public void addDrawCommands(long pMeshData, int mask, int indexPointerMask) {
|
||||
var batch = this.batch;
|
||||
final var pBaseVertex = batch.pBaseVertex;
|
||||
final var pElementCount = batch.pElementCount;
|
||||
final var pElementPointer = batch.pElementPointer;
|
||||
|
||||
int size = batch.size;
|
||||
|
||||
for (int facing = 0; facing < ModelQuadFacing.COUNT; facing++) {
|
||||
LWJGL.memPutInt(pBaseVertex + (size << 2), SectionRenderDataUnsafe.getVertexOffset(pMeshData, facing));
|
||||
LWJGL.memPutInt(pElementCount + (size << 2), SectionRenderDataUnsafe.getElementCount(pMeshData, facing));
|
||||
LWJGL.memPutAddress(pElementPointer + (size << 3), SectionRenderDataUnsafe.getIndexOffset(pMeshData, facing) & indexPointerMask);
|
||||
|
||||
size += (mask >> facing) & 1;
|
||||
}
|
||||
|
||||
batch.size = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeBatch(CommandList commandList, GlTessellation tessellation, GlPrimitiveType primitiveType) {
|
||||
try (DrawCommandList _ = commandList.beginTessellating(tessellation)) {
|
||||
final int mode = primitiveType.getId();
|
||||
final int type = GlIndexType.UNSIGNED_INT.getFormatId();
|
||||
|
||||
for (int i = 0; i < batch.size; i++) {
|
||||
final int count = LWJGL.memGetInt(batch.pElementCount + (long) i * Integer.BYTES);
|
||||
if (count > 0) {
|
||||
LWJGL.glDrawElementsBaseVertex(mode, count, type, LWJGL.memGetAddress(batch.pElementPointer + (long) i * POINTER_SIZE), LWJGL.memGetInt(batch.pBaseVertex + (long) i * Integer.BYTES));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndexBufferSize() {
|
||||
return this.batch.getIndexBufferSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.batch.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.batch.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete() {
|
||||
this.batch.delete();
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -54,15 +54,14 @@ public class ThreadedAngelicaChunkBuilderMeshingTask extends AngelicaChunkBuilde
|
||||
final WorldSlice worldSlice = buildContext.getWorldSlice();
|
||||
worldSlice.copyData(this.renderContext);
|
||||
this.blockAccess = worldSlice;
|
||||
this.biomeColorCache = new SmoothBiomeColorCache(worldSlice);
|
||||
this.biomeColorCache.update(new SectionPos(this.render.getChunkX(), this.render.getChunkY(), this.render.getChunkZ()));
|
||||
this.biomeColorCache = worldSlice.getBiomeColorCache();
|
||||
buildContext.setupLightPipeline(minX, minY, minZ);
|
||||
} else {
|
||||
// Fallback: direct world access (main thread only)
|
||||
final var world = Minecraft.getMinecraft().theWorld;
|
||||
this.blockAccess = new ChunkCache(world, minX - 1, minY - 1, minZ - 1, minX + 17, minY + 17, minZ + 17, 1);
|
||||
this.biomeColorCache = ((WorldClientExtension) world).celeritas$getSmoothBiomeColorCache();
|
||||
this.biomeColorCache.update(new SectionPos(this.render.getChunkX(), this.render.getChunkY(), this.render.getChunkZ()));
|
||||
this.blockAccess = new ChunkCache(world, minX - 1, minY - 1, minZ - 1, minX + 17, minY + 17, minZ + 17, 1);
|
||||
buildContext.setupLightPipeline(this.blockAccess, minX, minY, minZ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,13 @@ import com.gtnewhorizons.angelica.compat.mojang.ChunkSectionPos;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.CompatMathHelper;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.IDynamicLightSource;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.SmoothBiomeColorCache;
|
||||
|
||||
import java.util.List;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.world.cloned.ChunkRenderContext;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.world.cloned.ClonedChunkSection;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.world.cloned.ClonedChunkSectionCache;
|
||||
import org.embeddedt.embeddium.impl.util.position.SectionPos;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import mega.fluidlogged.api.FLBlockAccess;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -98,6 +100,8 @@ public class WorldSlice implements IBlockAccessExtended, FLBlockAccess {
|
||||
private ChunkSectionPos origin;
|
||||
private StructureBoundingBox volume;
|
||||
|
||||
private final SmoothBiomeColorCache biomeColorCache;
|
||||
|
||||
private List<IDynamicLightSource> chunkLightSources;
|
||||
private DynamicLights dynamicLightsInstance;
|
||||
|
||||
@@ -175,6 +179,8 @@ public class WorldSlice implements IBlockAccessExtended, FLBlockAccess {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.biomeColorCache = new SmoothBiomeColorCache(this);
|
||||
}
|
||||
|
||||
public void copyData(ChunkRenderContext context) {
|
||||
@@ -182,6 +188,8 @@ public class WorldSlice implements IBlockAccessExtended, FLBlockAccess {
|
||||
this.sections = context.getSections();
|
||||
this.volume = context.getVolume();
|
||||
|
||||
this.biomeColorCache.update(new SectionPos(origin.x, origin.y, origin.z));
|
||||
|
||||
this.baseX = (this.origin.x - NEIGHBOR_CHUNK_RADIUS) << 4;
|
||||
this.baseY = (this.origin.y - NEIGHBOR_CHUNK_RADIUS) << 4;
|
||||
this.baseZ = (this.origin.z - NEIGHBOR_CHUNK_RADIUS) << 4;
|
||||
@@ -221,6 +229,10 @@ public class WorldSlice implements IBlockAccessExtended, FLBlockAccess {
|
||||
return this.origin;
|
||||
}
|
||||
|
||||
public SmoothBiomeColorCache getBiomeColorCache() {
|
||||
return this.biomeColorCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightBrightnessForSkyBlocks(int x, int y, int z, int min) {
|
||||
if (y < 0 || y >= 256 || x < -30_000_000 || z < -30_000_000 || x >= 30_000_000 || z >= 30_000_000) {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class CyclingControlElement<T extends Enum<T>> extends NotFineControlElem
|
||||
@Override
|
||||
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
||||
if(super.mousePressed(mc, mouseX, mouseY)) {
|
||||
currentIndex = (option.getValue().ordinal() + 1) % allowedValues.length;
|
||||
currentIndex = (currentIndex + 1) % allowedValues.length;
|
||||
option.setValue(allowedValues[currentIndex]);
|
||||
onOptionValueChanged();
|
||||
return true;
|
||||
|
||||
@@ -18,6 +18,7 @@ import me.jellysquid.mods.sodium.client.gui.options.control.TickBoxControl;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.GraphicsMode;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.GraphicsQuality;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.LightingQuality;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.MultiDrawMode;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.ParticleMode;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.storage.AngelicaOptionsStorage;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.storage.MinecraftOptionsStorage;
|
||||
@@ -266,6 +267,19 @@ public class SodiumGameOptionPages {
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.setImpact(OptionImpact.LOW)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(MultiDrawMode.class, sodiumOpts)
|
||||
.setName(I18n.format("sodium.options.multidraw_mode.name"))
|
||||
.setTooltip(I18n.format("sodium.options.multidraw_mode.tooltip"))
|
||||
.setControl(o -> {
|
||||
boolean indirectSupported = GLStateManager.capabilities != null && (GLStateManager.capabilities.OpenGL43 || GLStateManager.capabilities.GL_ARB_multi_draw_indirect);
|
||||
MultiDrawMode[] allowed = indirectSupported ? MultiDrawMode.values() : new MultiDrawMode[]{MultiDrawMode.DIRECT, MultiDrawMode.INDIVIDUAL};
|
||||
return new CyclingControl<>(o, MultiDrawMode.class, allowed);
|
||||
})
|
||||
.setBinding((opts, value) -> opts.advanced.multiDrawMode = value, opts -> opts.advanced.multiDrawMode)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.setImpact(OptionImpact.VARIES)
|
||||
.setEnabled(GLStateManager.capabilities != null)
|
||||
.build())
|
||||
.build());
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
@@ -440,6 +454,14 @@ public class SodiumGameOptionPages {
|
||||
.build());
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(OptionImpl.createBuilder(boolean.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.hudCaching"))
|
||||
.setTooltip(I18n.format("options.angelica.hudCaching.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> AngelicaConfig.hudCachingActive = value, opts -> AngelicaConfig.hudCachingActive)
|
||||
.setEnabled(AngelicaConfig.enableHudCaching)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(int.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.droppedItemLimit"))
|
||||
.setTooltip(I18n.format("options.angelica.droppedItemLimit.tooltip"))
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.google.gson.JsonSyntaxException;
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.GraphicsQuality;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.MultiDrawMode;
|
||||
import net.coderbot.iris.Iris;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.occlusion.AsyncOcclusionMode;
|
||||
|
||||
@@ -27,6 +28,7 @@ public class SodiumGameOptions {
|
||||
public static class AdvancedSettings {
|
||||
public boolean useVertexArrayObjects = true;
|
||||
public boolean useChunkMultidraw = true;
|
||||
public MultiDrawMode multiDrawMode = MultiDrawMode.DIRECT;
|
||||
|
||||
public boolean useParticleCulling = true;
|
||||
public boolean allowDirectMemoryAccess = true;
|
||||
@@ -96,6 +98,10 @@ public class SodiumGameOptions {
|
||||
config.performance.cpuRenderAheadLimit = 0;
|
||||
}
|
||||
|
||||
if (config.advanced.multiDrawMode == MultiDrawMode.INDIRECT && (GLStateManager.capabilities == null || (!GLStateManager.capabilities.OpenGL43 && !GLStateManager.capabilities.GL_ARB_multi_draw_indirect))) {
|
||||
config.advanced.multiDrawMode = MultiDrawMode.DIRECT;
|
||||
}
|
||||
|
||||
try {
|
||||
if(resaveConfig)
|
||||
config.writeChanges();
|
||||
|
||||
+2
-2
@@ -59,7 +59,7 @@ public class SodiumControlElementFactory implements ControlElementFactory {
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
if(AngelicaConfig.enableReesesSodiumOptions) {
|
||||
if (this.option.isAvailable() && this.dim.containsCursor(mouseX, mouseY) && (button == 0 || button == 1)) {
|
||||
this.currentIndex = Math.floorMod(this.option.getValue().ordinal() + (button == 0 ? 1 : -1), this.allowedValues.length);
|
||||
this.currentIndex = Math.floorMod(this.currentIndex + (button == 0 ? 1 : -1), this.allowedValues.length);
|
||||
this.option.setValue(this.allowedValues[this.currentIndex]);
|
||||
this.playClickSound();
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SodiumControlElementFactory implements ControlElementFactory {
|
||||
}
|
||||
} else {
|
||||
if (this.option.isAvailable() && button == 0 && this.dim.containsCursor(mouseX, mouseY)) {
|
||||
this.currentIndex = (this.option.getValue().ordinal() + 1) % this.allowedValues.length;
|
||||
this.currentIndex = (this.currentIndex + 1) % this.allowedValues.length;
|
||||
this.option.setValue(this.allowedValues[this.currentIndex]);
|
||||
this.playClickSound();
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package me.jellysquid.mods.sodium.client.gui.options.named;
|
||||
|
||||
public enum MultiDrawMode implements NamedState {
|
||||
DIRECT("sodium.options.multidraw_mode.direct"),
|
||||
INDIRECT("sodium.options.multidraw_mode.indirect"),
|
||||
INDIVIDUAL("sodium.options.multidraw_mode.individual");
|
||||
|
||||
private final String key;
|
||||
|
||||
MultiDrawMode(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return this.key;
|
||||
}
|
||||
}
|
||||
@@ -201,6 +201,8 @@ options.angelica.fontconfig.glyph_spacing.tooltip=The spacing between each indiv
|
||||
options.angelica.fontconfig.font_aa_strength.tooltip=The spacing of samples used in font antialiasing. High values may cause fonts to look blurry, low values may cause aliasing. See what works best with your settings.
|
||||
options.angelica.fontconfig.aamode.tooltip=The font antialiasing mode. Can significantly improve the appearance and readability of text that's being scaled or viewed at oblique angles, at the expense of some performance.
|
||||
options.angelica.fontconfig.custom_font_scale.tooltip=A multiplier that affects the scale of custom fonts. Adjust this if text in your font of choice looks under-/over-sized relative to text that does not use custom fonts.
|
||||
options.angelica.hudCaching=HUD Caching
|
||||
options.angelica.hudCaching.tooltip=Caches the HUD to a framebuffer and reuses it across frames to reduce rendering overhead. Requires HUD Caching to be enabled at startup. [Experimental]
|
||||
options.angelica.droppedItemLimit=Dropped Item Render Limit
|
||||
options.angelica.droppedItemLimit.tooltip=The maximum number of dropped items that will be rendered. Lower values can improve performance.
|
||||
options.angelica.mobSpawnerRenderDistance=Mob spawner render distance
|
||||
@@ -224,3 +226,9 @@ options.angelica.aggressiveChunkLoading=Aggressive Chunk Loading
|
||||
options.angelica.aggressiveChunkLoading.tooltip=Renders chunks immediately when loaded, even if neighbors aren't ready yet. Improves perceived loading speed at render distance edges. Chunks rebuild automatically when neighbors load. Useful for low render distance servers.
|
||||
options.angelica.disablef3=Disable F3 Additions
|
||||
options.angelica.disablef3.tooltip=Disables Angelica's additions to the F3 debug screen.
|
||||
|
||||
sodium.options.multidraw_mode.name=Multi-Draw Mode
|
||||
sodium.options.multidraw_mode.tooltip=Controls how draw commands are dispatched for terrain rendering. §lDirect§r uses glMultiDrawElementsBaseVertex (default, GL 3.2+). §lIndirect§r uses GPU indirect rendering (GL 4.3+), may reduce CPU overhead on some hardware. §lIndividual§r issues individual draw calls.
|
||||
sodium.options.multidraw_mode.direct=Direct
|
||||
sodium.options.multidraw_mode.indirect=Indirect
|
||||
sodium.options.multidraw_mode.individual=Individual
|
||||
Reference in new issue
Block a user