mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-16 18:54:45 +00:00
Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19635e20ec | ||
|
|
ead4e11376 | ||
|
|
b0ceb5306a | ||
|
|
99a81369f0 | ||
|
|
e2ee822948 | ||
|
|
9fe7e800f6 | ||
|
|
debfcdfda0 | ||
|
|
df662188f4 | ||
|
|
842916405f | ||
|
|
09afe81290 | ||
|
|
292809d8e8 | ||
|
|
47503ce254 | ||
|
|
f738adbdef |
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package com.gtnewhorizons.angelica.api;
|
||||
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.IPatchedTextureAtlasSprite;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ITexturesCache;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
/**
|
||||
* Exposes a method to the API that allow mods to add texture update compat
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class TextureServices {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static void updateBlockTextureAnimation(IIcon icon, RenderBlocks renderBlocks) {
|
||||
if (renderBlocks instanceof ITexturesCache texturesCache) {
|
||||
texturesCache.getRenderedTextures().add(icon);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static void updateTextureAnimation(IIcon icon) {
|
||||
if(icon instanceof IPatchedTextureAtlasSprite patchedSprite) {
|
||||
patchedSprite.markNeedsAnimationUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,10 +138,10 @@ public class AngelicaConfig {
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean enableZoom;
|
||||
|
||||
@Config.Comment("Optimizes in-world item rendering")
|
||||
@Config.DefaultBoolean(true)
|
||||
@Config.Comment("Optimizes in-world item rendering [Experimental]")
|
||||
@Config.DefaultBoolean(false)
|
||||
@Config.RequiresMcRestart
|
||||
public static boolean optimizeInWorldItemRendering;
|
||||
public static boolean optimizeInWorldItemRendering_WIP;
|
||||
|
||||
@Config.Comment("Max amount of display lists to cache for optimized item rendering. Higher number will use more VRAM")
|
||||
@Config.DefaultInt(256)
|
||||
@@ -153,4 +153,8 @@ public class AngelicaConfig {
|
||||
@Config.RangeDouble(min = 16D, max = 64D)
|
||||
public static double mobSpawnerRenderDistance;
|
||||
|
||||
@Config.Comment("Switches to an alternate FPS limiter that gives more stable frametimes, in exchange for slightly " +
|
||||
"more latency. Will never introduce more than one frame of latency, and has a lower impact at higher framerates.")
|
||||
@Config.DefaultBoolean(false)
|
||||
public static boolean sleepBeforeSwap;
|
||||
}
|
||||
@@ -136,6 +136,10 @@ public class HUDCaching {
|
||||
guiForge.callRenderPortal(width, height, partialTicks);
|
||||
}
|
||||
if (renderCrosshairsCaptured) {
|
||||
if (ModStatus.isXaerosMinimapLoaded){
|
||||
// this fixes the crosshair going invisible when no lines are being drawn under the minimap
|
||||
GLStateManager.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
guiForge.callRenderCrosshairs(width, height);
|
||||
}
|
||||
if (ModStatus.isThaumcraftLoaded || ModStatus.isThaumicHorizonsLoaded){
|
||||
|
||||
@@ -80,7 +80,7 @@ public enum Mixins {
|
||||
|
||||
ANGELICA_ITEM_DISPLAY_LIST_OPTIMIZATION(new Builder("Optimized item rendering by wrapping them with display lists")
|
||||
.setPhase(Phase.EARLY).addMixinClasses("angelica.itemrenderer.MixinItemRenderer").setSide(Side.CLIENT)
|
||||
.setApplyIf(() -> AngelicaConfig.optimizeInWorldItemRendering)
|
||||
.setApplyIf(() -> AngelicaConfig.optimizeInWorldItemRendering_WIP)
|
||||
.addTargetedMod(TargetedMod.VANILLA)),
|
||||
|
||||
// Not compatible with the lwjgl debug callbacks, so disable if that's enabled
|
||||
|
||||
@@ -127,6 +127,15 @@ public class SodiumGameOptionPages {
|
||||
}
|
||||
}, (opts) -> opts.fullScreen)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(boolean.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.sleepbeforeswap"))
|
||||
.setTooltip(I18n.format("options.angelica.sleepbeforeswap.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> {
|
||||
AngelicaConfig.sleepBeforeSwap = value;
|
||||
}, opts -> AngelicaConfig.sleepBeforeSwap)
|
||||
.setImpact(OptionImpact.VARIES)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(boolean.class, vanillaOpts)
|
||||
.setName(I18n.format("options.vsync"))
|
||||
.setTooltip(I18n.format("sodium.options.v_sync.tooltip"))
|
||||
|
||||
@@ -35,6 +35,7 @@ import me.jellysquid.mods.sodium.client.world.ChunkStatusListener;
|
||||
import me.jellysquid.mods.sodium.common.util.IdTable;
|
||||
import me.jellysquid.mods.sodium.common.util.collections.FutureDequeDrain;
|
||||
import net.coderbot.iris.shadows.ShadowRenderingState;
|
||||
import net.coderbot.iris.sodium.shadow_map.SwappableChunkRenderManager;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -47,7 +48,7 @@ import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ChunkRenderManager<T extends ChunkGraphicsState> implements ChunkStatusListener {
|
||||
public class ChunkRenderManager<T extends ChunkGraphicsState> implements ChunkStatusListener, SwappableChunkRenderManager {
|
||||
/**
|
||||
* The maximum distance a chunk can be from the player's camera in order to be eligible for blocking updates.
|
||||
*/
|
||||
@@ -249,7 +250,11 @@ public class ChunkRenderManager<T extends ChunkGraphicsState> implements ChunkSt
|
||||
}
|
||||
|
||||
private void addChunk(ChunkRenderContainer<T> render) {
|
||||
final boolean canRebuild = AngelicaConfig.enableIris ? !ShadowRenderingState.areShadowsCurrentlyBeingRendered() : render.canRebuild();
|
||||
boolean canRebuild = render.canRebuild();
|
||||
|
||||
if (AngelicaConfig.enableIris && ShadowRenderingState.areShadowsCurrentlyBeingRendered()) {
|
||||
canRebuild = false;
|
||||
}
|
||||
|
||||
if (render.needsRebuild() && canRebuild) {
|
||||
if (!this.alwaysDeferChunkUpdates && render.needsImportantRebuild()) {
|
||||
@@ -366,9 +371,7 @@ public class ChunkRenderManager<T extends ChunkGraphicsState> implements ChunkSt
|
||||
private void reset() {
|
||||
if(!AngelicaConfig.enableIris || !ShadowRenderingState.areShadowsCurrentlyBeingRendered()) this.rebuildQueue.clear();
|
||||
if(!AngelicaConfig.enableIris || !ShadowRenderingState.areShadowsCurrentlyBeingRendered()) this.importantRebuildQueue.clear();
|
||||
|
||||
|
||||
this.sortQueue.clear();
|
||||
if(!AngelicaConfig.enableIris || !ShadowRenderingState.areShadowsCurrentlyBeingRendered()) this.sortQueue.clear();
|
||||
|
||||
this.visibleTileEntities.clear();
|
||||
|
||||
|
||||
+2
-13
@@ -5,6 +5,7 @@ import it.unimi.dsi.fastutil.ints.IntArrays;
|
||||
import me.jellysquid.mods.sodium.client.model.vertex.type.ChunkVertexType;
|
||||
import me.jellysquid.mods.sodium.client.render.chunk.format.hfp.HFPModelVertexType;
|
||||
import me.jellysquid.mods.sodium.client.render.chunk.format.sfp.SFPModelVertexType;
|
||||
import net.coderbot.iris.sodium.vertex_format.terrain_xhfp.XHFPModelVertexType;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -14,22 +15,10 @@ import java.util.BitSet;
|
||||
|
||||
public class ChunkBufferSorter {
|
||||
|
||||
private static final Class<?> OCULUS_VERTEX_TYPE;
|
||||
|
||||
static {
|
||||
Class<?> clz;
|
||||
try {
|
||||
clz = Class.forName("net.coderbot.iris.compat.sodium.impl.vertex_format.terrain_xhfp.XHFPModelVertexType");
|
||||
} catch(Throwable e) {
|
||||
clz = null;
|
||||
}
|
||||
OCULUS_VERTEX_TYPE = clz;
|
||||
}
|
||||
|
||||
public static void sortStandardFormat(ChunkVertexType vertexType, ByteBuffer buffer, int bufferLen, float x, float y, float z) {
|
||||
boolean isCompact;
|
||||
|
||||
if(vertexType.getClass() == HFPModelVertexType.class || vertexType.getClass() == OCULUS_VERTEX_TYPE) {
|
||||
if(vertexType.getClass() == HFPModelVertexType.class || vertexType.getClass() == XHFPModelVertexType.class) {
|
||||
isCompact = true;
|
||||
} else if(vertexType.getClass() == SFPModelVertexType.class) {
|
||||
isCompact = false;
|
||||
|
||||
+2
@@ -142,6 +142,8 @@ public class ChunkBuildBuffers implements ChunkBuildBuffersExt {
|
||||
|
||||
if (sortTranslucent && pass.isTranslucent()) {
|
||||
ChunkBufferSorter.sortStandardFormat(vertexType, buffer, bufferLen, x, y, z);
|
||||
meshData.clearSlices();
|
||||
meshData.setModelSlice(ModelQuadFacing.UNASSIGNED, new BufferSlice(0, bufferLen));
|
||||
}
|
||||
|
||||
meshData.setVertexData(new VertexData(buffer, this.vertexType.getCustomVertexFormat()));
|
||||
|
||||
@@ -17,6 +17,10 @@ public class ChunkMeshData {
|
||||
this.vertexData = vertexData;
|
||||
}
|
||||
|
||||
public void clearSlices() {
|
||||
this.parts.clear();
|
||||
}
|
||||
|
||||
public void setModelSlice(ModelQuadFacing facing, BufferSlice slice) {
|
||||
this.parts.put(facing, slice);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockRenderer {
|
||||
private static final BlockPos POS_ZERO = new BlockPos(0, 0, 0);
|
||||
|
||||
private final Random random = new XoRoShiRoRandom();
|
||||
|
||||
@@ -97,9 +98,10 @@ public class BlockRenderer {
|
||||
TessellatorManager.startCapturing();
|
||||
final CapturingTessellator tess = (CapturingTessellator) TessellatorManager.get();
|
||||
tess.startDrawingQuads();
|
||||
// RenderBlocks adds the subchunk-relative coordinates as the offset, cancel it out here
|
||||
|
||||
tess.setOffset(pos);
|
||||
// Use setTranslation rather than setOffset so that the float data written to the internal buffer
|
||||
// is done in subchunk-relative coordinates
|
||||
tess.setOffset(POS_ZERO);
|
||||
tess.setTranslation(-pos.x, -pos.y, -pos.z);
|
||||
renderBlocks.renderBlockByRenderType(block, pos.x, pos.y, pos.z);
|
||||
final List<QuadView> quads = TessellatorManager.stopCapturingToPooledQuads();
|
||||
tess.resetOffset();
|
||||
|
||||
@@ -137,10 +137,12 @@ options.dynamic_lights_shader_force=Dynamic Lights - Forced With Shaders
|
||||
options.dynamic_lights_shader_force.tooltip=Enabled - Dynamic Lights are shown even when a shader is active, Disabled - Dynamic Lights are disabled when a shader is active.
|
||||
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=Mod spawner render distance
|
||||
options.angelica.mobSpawnerRenderDistance=Mob spawner render distance
|
||||
options.angelica.mobSpawnerRenderDistance.tooltip=Render distance for the spinning mob inside mod spawners
|
||||
options.angelica.itemdisplaylistcount=Item Renderer Display List Cache Size
|
||||
options.angelica.itemdisplaylistcount.tooltip=The maximum number of display lists to cache in the optimized item renderer. Higher values will increase performance but increase VRAM usage.
|
||||
options.angelica.sleepbeforeswap=Alternate FPS Limiter
|
||||
options.angelica.sleepbeforeswap.tooltip=Switches to an alternate FPS limiter that gives more stable frametimes, in exchange for slightly more latency. Will never introduce more than one frame of latency, and has a lower impact at higher framerates.
|
||||
pack.iris.select.title=Select
|
||||
pack.iris.configure.title=Configure
|
||||
label.iris.true=On
|
||||
|
||||
+30
-1
@@ -1,7 +1,10 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.angelica;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.IGameSettingsExt;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@@ -14,10 +17,16 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
public class MixinMinecraft {
|
||||
public abstract class MixinMinecraft {
|
||||
@Shadow
|
||||
public GameSettings gameSettings;
|
||||
|
||||
@Shadow
|
||||
public abstract boolean isFramerateLimitBelowMax();
|
||||
|
||||
@Shadow
|
||||
public abstract int getLimitFramerate();
|
||||
|
||||
@Unique
|
||||
private long angelica$lastFrameTime = 0;
|
||||
|
||||
@@ -29,6 +38,20 @@ public class MixinMinecraft {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "func_147120_f",
|
||||
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;update()V", shift = At.Shift.BEFORE, remap = false)
|
||||
)
|
||||
private void angelica$limitFPS(CallbackInfo ci) {
|
||||
if (!AngelicaConfig.sleepBeforeSwap) return;
|
||||
if (isFramerateLimitBelowMax()) {
|
||||
final long target = angelica$lastFrameTime + (long) (1.0 / getLimitFramerate() * 1_000_000) * 1_000;
|
||||
while (target - System.nanoTime() > 100) {
|
||||
Thread.yield();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "func_147120_f",
|
||||
at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;update()V", shift = At.Shift.AFTER, remap = false)
|
||||
@@ -41,6 +64,12 @@ public class MixinMinecraft {
|
||||
angelica$lastFrameTime = time;
|
||||
}
|
||||
|
||||
@WrapOperation(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;sync(I)V"))
|
||||
private void angelica$noopFPSLimiter(int fps, Operation<Void> original) {
|
||||
if (AngelicaConfig.sleepBeforeSwap) return;
|
||||
original.call(fps);
|
||||
}
|
||||
|
||||
@Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreen;isShiftKeyDown()Z", shift = At.Shift.AFTER))
|
||||
private void angelica$setShowFpsGraph(CallbackInfo ci) {
|
||||
((IGameSettingsExt) gameSettings).angelica$setShowFpsGraph(Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU));
|
||||
|
||||
Reference in new issue
Block a user