mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-21 04:42:17 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b75a5d8f7d | ||
|
|
8d3ab41c53 | ||
|
|
48d032e654 | ||
|
|
1968914582 | ||
|
|
a70bd76ff3 | ||
|
|
db919b5f37 | ||
|
|
cde47ea423 | ||
|
|
5ef6cb11c0 |
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.0:dev")
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.9.6:dev")
|
||||
shadowImplementation("org.anarres:jcpp:1.4.14") // Apache 2.0
|
||||
shadowImplementation("org.taumc:glsl-transformation-lib:0.2.0-25.g3a943bb") {
|
||||
exclude module: "antlr4" // we only want to shadow the runtime module
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gtnewhorizons.angelica.compat.iris;
|
||||
|
||||
import com.gtnewhorizons.angelica.compat.ModStatus;
|
||||
import net.coderbot.iris.parsing.BiomeCategories;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
@@ -8,7 +9,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* Detects and categorizes biomes from popular modded biome mods using cached class checks.
|
||||
* Currently supports: BiomesOPlenty (BOP), Realistic World Gen (RWG)
|
||||
* Currently supports: BiomesOPlenty (BOP), Realistic World Gen (RWG), lotr (b36.15)
|
||||
*/
|
||||
public class ModdedBiomeDetector {
|
||||
private static boolean initialized = false;
|
||||
@@ -23,12 +24,15 @@ public class ModdedBiomeDetector {
|
||||
// LinkedHashMap maintains insertion order for deterministic behavior
|
||||
private static final Map<Class<?>, BiomeCategories> rwgClassMap = new LinkedHashMap<>();
|
||||
|
||||
private static Class<?> lotrBiomeClass = null;
|
||||
|
||||
private static synchronized void initialize() {
|
||||
if (initialized) return;
|
||||
initialized = true;
|
||||
|
||||
initializeBOP();
|
||||
initializeRWG();
|
||||
initializeLOTR();
|
||||
}
|
||||
|
||||
private static void initializeBOP() {
|
||||
@@ -59,6 +63,16 @@ public class ModdedBiomeDetector {
|
||||
tryAddRWGClass("rwg.biomes.base.BaseBiomeSnowForest", BiomeCategories.TAIGA); // Snow forests are taiga
|
||||
}
|
||||
|
||||
private static void initializeLOTR() {
|
||||
if (ModStatus.isLotrLoaded) {
|
||||
try {
|
||||
lotrBiomeClass = Class.forName("lotr.common.world.biome.LOTRBiome");
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
// lotr not installed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void tryAddRWGClass(String className, BiomeCategories category) {
|
||||
try {
|
||||
final Class<?> clazz = Class.forName(className);
|
||||
@@ -91,12 +105,64 @@ public class ModdedBiomeDetector {
|
||||
// fall through to name/property-based detection
|
||||
|
||||
// Realistic World Gen detection
|
||||
for (Map.Entry<Class<?>, BiomeCategories> entry : rwgClassMap.entrySet()) {
|
||||
if (entry.getKey().isInstance(biome)) {
|
||||
return entry.getValue();
|
||||
if (biome.getBiomeClass().getName().contains("rwg.biomes")) {
|
||||
for (Map.Entry<Class<?>, BiomeCategories> entry : rwgClassMap.entrySet()) {
|
||||
if (entry.getKey().isInstance(biome)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// lotr
|
||||
if (lotrBiomeClass!= null && lotrBiomeClass.isInstance(biome)) {
|
||||
return detectLOTRBiome(biome);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static BiomeCategories detectLOTRBiome(BiomeGenBase biome) {
|
||||
return switch (biome.biomeName) {
|
||||
case "river", "farHaradJungleLake", "lake" -> BiomeCategories.RIVER;
|
||||
case "rohan", "rivendell", "rhunIsland", "rhunLandHills", "rhunLandSteppe", "rhunLand", "andrast",
|
||||
"blackrootVale", "lamedon", "imlothMelui", "towerHills", "dorwinion", "dale", "shireMoors", "wold",
|
||||
"anduinVale", "rhun", "lebennin", "pertorogwaith", "breeland", "island", "pinnathGelin",
|
||||
"minhiriath", "pelennor", "adornland", "nanCurunir", "ithilienWasteland", "fangornClearing",
|
||||
"barrowDowns", "dorEnErnilHills", "dorEnErnil", "nurn", "wilderland", "eastBight", "lindon",
|
||||
"eregion", "enedwaith", "meneltarma", "anduinHills", "eriador", "angle", "loneLandsHills",
|
||||
"loneLands", "pelargir", "rohanUrukHighlands", "celebrant", "gondor", "shire", "nurnen", "farHarad" ->
|
||||
BiomeCategories.PLAINS;
|
||||
case "mistyMountains", "windMountains", "farHaradVolcano", "redMountains", "haradMountains",
|
||||
"angmarMountains", "blueMountains", "greyMountains", "whiteMountains", "mordorMountains" ->
|
||||
BiomeCategories.MOUNTAIN;
|
||||
case "shireWoodlands", "rhunIslandForest", "rhunRedForest", "pukel", "lossarnach", "gulfHaradForest",
|
||||
"nearHaradFertileForest", "dolGuldur", "rhunForest", "tauredainClearing", "umbarForest",
|
||||
"farHaradForest", "chetwood", "woodlandRealmHills", "mirkwoodNorth", "whiteDowns", "ithilienHills",
|
||||
"gondorWoodlands", "rohanWoodlands", "fangornWasteland", "mirkwoodMountains", "lindonWoodlands",
|
||||
"lothlorienEdge", "erynVorn", "oldForest", "fangorn", "dunland", "ithilien", "mirkwoodCorrupted",
|
||||
"woodlandRealm", "trollshaws", "lothlorien", "farHaradKanuka" -> BiomeCategories.FOREST;
|
||||
case "mordor", "lastDesert", "harnedor", "easternDesolation", "morgulVale", "gorgoroth", "udun",
|
||||
"nearHaradRedDesert", "nearHaradSemiDesert", "lostladen",
|
||||
"nearHaradHills", "nearHarad", "nanUngol", "dagorlad", "brownLands" -> BiomeCategories.DESERT;
|
||||
case "ironHills", "rivendellHills", "windMountainsFoothills", "lamedonHills", "redMountainsFoothills",
|
||||
"tolfalas", "dorwinionHills", "whiteMountainsFoothills", "blueMountainsFoothills",
|
||||
"greyMountainsFoothills", "mistyMountainsFoothills", "erebor", "angmar", "eriadorDowns",
|
||||
"ettenmoors", "emynMuil" -> BiomeCategories.EXTREME_HILLS;
|
||||
case "deadMarshes", "shireMarshes", "farHaradMangrove", "farHaradSwamp", "swanfleet", "nindalf",
|
||||
"longMarshes", "entwashMouth", "nurnMarshes", "gladdenFields", "midgewater", "anduinMouth" ->
|
||||
BiomeCategories.SWAMP;
|
||||
case "harondor", "nearHaradOasis", "nearHaradRiverbank", "farHaradBushlandHills", "farHaradBushland",
|
||||
"gulfHarad", "nearHaradFertile", "umbarHills", "umbar", "farHaradAridHills", "farHaradArid" ->
|
||||
BiomeCategories.SAVANNA;
|
||||
case "ocean" -> BiomeCategories.OCEAN;
|
||||
case "forodwaith", "forodwaithGlacier", "tundra", "forodwaithMountains" -> BiomeCategories.ICY;
|
||||
case "lindonCoast", "beachWhite", "farHaradCoast", "forodwaithCoast", "beachGravel", "beach" ->
|
||||
BiomeCategories.BEACH;
|
||||
case "coldfells", "wilderlandNorth", "taiga" -> BiomeCategories.TAIGA;
|
||||
case "farHaradJungle", "halfTrollForest", "farHaradJungleMountains",
|
||||
"farHaradCloudForest", "farHaradJungleEdge" -> BiomeCategories.JUNGLE;
|
||||
case "utumno" -> BiomeCategories.NONE;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public class Camera {
|
||||
public static final Camera INSTANCE = new Camera();
|
||||
|
||||
private final Vector3d pos = new Vector3d();
|
||||
private final Vector3d entityPos = new Vector3d();
|
||||
private final BlockPos blockPos = new BlockPos();
|
||||
private final Vector3f offset = new Vector3f();
|
||||
private final Matrix4f inverseModelView = new Matrix4f();
|
||||
@@ -42,12 +43,14 @@ public class Camera {
|
||||
this.partialTicks = partialTicks;
|
||||
this.entity = entity;
|
||||
|
||||
// Entity position (interpolated, at feet level)
|
||||
// Entity position (interpolated, at eye level)
|
||||
final double entityX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks;
|
||||
final double entityY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks;
|
||||
final double entityZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks;
|
||||
final double eyeHeight = entity.getEyeHeight();
|
||||
|
||||
entityPos.set(entityX, entityY + eyeHeight, entityZ);
|
||||
|
||||
thirdPerson = Minecraft.getMinecraft().gameSettings.thirdPersonView > 0;
|
||||
|
||||
final double camX, camY, camZ;
|
||||
|
||||
@@ -200,7 +200,7 @@ public class AngelicaConfig {
|
||||
"net.minecraft.block.BlockStairs"
|
||||
})
|
||||
public static String[] blockCrackFixBlacklist;
|
||||
|
||||
|
||||
@Config.Comment({"Block classes that have render pass other than 0 but still need to be manipulated.",
|
||||
"Add a block class here if you see flickering (z-fighting) with fixBlockCrack enabled"
|
||||
})
|
||||
@@ -221,4 +221,8 @@ public class AngelicaConfig {
|
||||
@Config.DefaultBoolean(false)
|
||||
public static boolean useVanillaChunkTracking;
|
||||
|
||||
@Config.Comment("Disables additional F3 information added by Angelica.")
|
||||
@Config.DefaultBoolean(false)
|
||||
public static boolean disableF3Additions;
|
||||
|
||||
}
|
||||
@@ -19,9 +19,6 @@ import org.lwjgl.opengl.GL43;
|
||||
import org.lwjgl.opengl.KHRDebug;
|
||||
import org.lwjgl.opengl.KHRDebugCallback;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
|
||||
import static org.lwjgl.opengl.ARBDebugOutput.glDebugMessageCallbackARB;
|
||||
|
||||
@@ -35,20 +32,9 @@ public final class GLDebug {
|
||||
LOGGER.warn("setupDebugMessageCallback called from non-main thread!");
|
||||
return 0;
|
||||
}
|
||||
return setupDebugMessageCallback(System.err);
|
||||
return setupDebugMessageCallbackImpl();
|
||||
}
|
||||
|
||||
private static void trace(Consumer<String> output) {
|
||||
/*
|
||||
* We can not just use a fixed stacktrace element offset, because some methods
|
||||
* are intercepted and some are not. So, check the package name.
|
||||
*/
|
||||
StackTraceElement[] elems = filterStackTrace(new Throwable(), 4).getStackTrace();
|
||||
for (StackTraceElement ste : elems) {
|
||||
output.accept(ste.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static Throwable filterStackTrace(Throwable throwable, int offset) {
|
||||
StackTraceElement[] elems = throwable.getStackTrace();
|
||||
StackTraceElement[] filtered = new StackTraceElement[elems.length];
|
||||
@@ -66,36 +52,48 @@ public final class GLDebug {
|
||||
return throwable;
|
||||
}
|
||||
|
||||
public static void printTrace(PrintStream stream) {
|
||||
trace(new Consumer<String>() {
|
||||
boolean first = true;
|
||||
private static String buildStackTrace() {
|
||||
StackTraceElement[] elems = filterStackTrace(new Throwable(), 4).getStackTrace();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (StackTraceElement elem : elems) {
|
||||
sb.append("\n\t").append(elem.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void accept(String str) {
|
||||
if (first) {
|
||||
printDetail(stream, "Stacktrace", str);
|
||||
first = false;
|
||||
} else {
|
||||
printDetailLine(stream, "Stacktrace", str);
|
||||
}
|
||||
}
|
||||
});
|
||||
private static void logDebugMessage(int id, String source, String type, String severity, String message) {
|
||||
String fullMessage = String.format("[GL] %s %s (0x%X) from %s: %s%s", severity, type, id, source, message, buildStackTrace());
|
||||
|
||||
if ("HIGH".equals(severity)) {
|
||||
LOGGER.error(fullMessage);
|
||||
} else if ("MEDIUM".equals(severity)) {
|
||||
LOGGER.warn(fullMessage);
|
||||
} else {
|
||||
LOGGER.info(fullMessage);
|
||||
}
|
||||
}
|
||||
|
||||
private static void logDebugMessageAMD(int id, String category, String severity, String message) {
|
||||
String fullMessage = String.format("[GL] %s %s (0x%X): %s%s", severity, category, id, message, buildStackTrace());
|
||||
|
||||
if ("HIGH".equals(severity)) {
|
||||
LOGGER.error(fullMessage);
|
||||
} else if ("MEDIUM".equals(severity)) {
|
||||
LOGGER.warn(fullMessage);
|
||||
} else {
|
||||
LOGGER.info(fullMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up debug callbacks
|
||||
* @return 0 for failure, 1 for success, 2 for restart required.
|
||||
*/
|
||||
public static int setupDebugMessageCallback(PrintStream stream) {
|
||||
private static int setupDebugMessageCallbackImpl() {
|
||||
if (GLStateManager.capabilities.OpenGL43 || GLStateManager.capabilities.GL_KHR_debug) {
|
||||
LOGGER.info("[GL] Using OpenGL 4.3 for error logging.");
|
||||
KHRDebugCallback proc = new KHRDebugCallback((source, type, id, severity, message) -> {
|
||||
stream.println("[LWJGL] OpenGL debug message");
|
||||
printDetail(stream, "ID", String.format("0x%X", id));
|
||||
printDetail(stream, "Source", getDebugSource(source));
|
||||
printDetail(stream, "Type", getDebugType(type));
|
||||
printDetail(stream, "Severity", getDebugSeverity(severity));
|
||||
printDetail(stream, "Message", message);
|
||||
printTrace(stream);
|
||||
final KHRDebugCallback proc = new KHRDebugCallback((source, type, id, severity, message) -> {
|
||||
logDebugMessage(id, getDebugSource(source), getDebugType(type), getDebugSeverity(severity), message);
|
||||
});
|
||||
GL43.glDebugMessageControl(GL11.GL_DONT_CARE, GL11.GL_DONT_CARE, GL43.GL_DEBUG_SEVERITY_HIGH, null, true);
|
||||
GL43.glDebugMessageControl(GL11.GL_DONT_CARE, GL11.GL_DONT_CARE, GL43.GL_DEBUG_SEVERITY_MEDIUM, null, false);
|
||||
@@ -114,14 +112,8 @@ public final class GLDebug {
|
||||
return 1;
|
||||
} else if (GLStateManager.capabilities.GL_ARB_debug_output) {
|
||||
LOGGER.info("[GL] Using ARB_debug_output for error logging.");
|
||||
ARBDebugOutputCallback proc = new ARBDebugOutputCallback((source, type, id, severity, message) -> {
|
||||
stream.println("[LWJGL] ARB_debug_output message");
|
||||
printDetail(stream, "ID", String.format("0x%X", id));
|
||||
printDetail(stream, "Source", getSourceARB(source));
|
||||
printDetail(stream, "Type", getTypeARB(type));
|
||||
printDetail(stream, "Severity", getSeverityARB(severity));
|
||||
printDetail(stream, "Message", message);
|
||||
printTrace(stream);
|
||||
final ARBDebugOutputCallback proc = new ARBDebugOutputCallback((source, type, id, severity, message) -> {
|
||||
logDebugMessage(id, getSourceARB(source), getTypeARB(type), getSeverityARB(severity), message);
|
||||
});
|
||||
ARBDebugOutput.glDebugMessageControlARB(GL11.GL_DONT_CARE, GL11.GL_DONT_CARE, GL43.GL_DEBUG_SEVERITY_HIGH, null, true);
|
||||
ARBDebugOutput.glDebugMessageControlARB(GL11.GL_DONT_CARE, GL11.GL_DONT_CARE, GL43.GL_DEBUG_SEVERITY_MEDIUM, null, false);
|
||||
@@ -134,13 +126,8 @@ public final class GLDebug {
|
||||
return 1;
|
||||
} else if (GLStateManager.capabilities.GL_AMD_debug_output) {
|
||||
LOGGER.info("[GL] Using AMD_debug_output for error logging.");
|
||||
AMDDebugOutputCallback proc = new AMDDebugOutputCallback((id, category, severity, message) -> {
|
||||
stream.println("[LWJGL] AMD_debug_output message");
|
||||
printDetail(stream, "ID", String.format("0x%X", id));
|
||||
printDetail(stream, "Category", getCategoryAMD(category));
|
||||
printDetail(stream, "Severity", getSeverityAMD(severity));
|
||||
printDetail(stream, "Message", message);
|
||||
printTrace(stream);
|
||||
final AMDDebugOutputCallback proc = new AMDDebugOutputCallback((id, category, severity, message) -> {
|
||||
logDebugMessageAMD(id, getCategoryAMD(category), getSeverityAMD(severity), message);
|
||||
});
|
||||
AMDDebugOutput.glDebugMessageEnableAMD(0, GL43.GL_DEBUG_SEVERITY_HIGH, null, true);
|
||||
AMDDebugOutput.glDebugMessageEnableAMD(0, GL43.GL_DEBUG_SEVERITY_MEDIUM, null, false);
|
||||
@@ -176,17 +163,6 @@ public final class GLDebug {
|
||||
}
|
||||
}
|
||||
|
||||
private static void printDetail(PrintStream stream, String type, String message) {
|
||||
stream.printf("\t%s: %s\n", type, message);
|
||||
}
|
||||
|
||||
private static void printDetailLine(PrintStream stream, String type, String message) {
|
||||
stream.append(" ");
|
||||
for (int i = 0; i < type.length(); i++) {
|
||||
stream.append(" ");
|
||||
}
|
||||
stream.append(message).append("\n");
|
||||
}
|
||||
|
||||
private static String getDebugSource(int source) {
|
||||
return switch (source) {
|
||||
|
||||
+6
-1
@@ -45,6 +45,7 @@ public final class AngelicaRedirector {
|
||||
private static final String GL13 = "org/lwjgl/opengl/GL13";
|
||||
private static final String GL14 = "org/lwjgl/opengl/GL14";
|
||||
private static final String GL20 = "org/lwjgl/opengl/GL20";
|
||||
private static final String GL30 = "org/lwjgl/opengl/GL30";
|
||||
private static final String Project = "org/lwjgl/util/glu/Project";
|
||||
private static final String OpenGlHelper = "net/minecraft/client/renderer/OpenGlHelper";
|
||||
private static final String EXTBlendFunc = "org/lwjgl/opengl/EXTBlendFuncSeparate";
|
||||
@@ -231,6 +232,9 @@ public final class AngelicaRedirector {
|
||||
.add("glStencilOpSeparate")
|
||||
.add("glUseProgram")
|
||||
);
|
||||
methodRedirects.put(GL30, RedirectMap.newMap()
|
||||
.add("glBindFramebuffer")
|
||||
);
|
||||
methodRedirects.put(OpenGlHelper, RedirectMap.newMap()
|
||||
.add("glBlendFunc", "tryBlendFuncSeparate")
|
||||
.add("func_148821_a", "tryBlendFuncSeparate")
|
||||
@@ -241,7 +245,8 @@ public final class AngelicaRedirector {
|
||||
.add("func_153188_a", "glFramebufferTexture2D")
|
||||
.add("setActiveTexture")
|
||||
.add("setLightmapTextureCoords")
|
||||
.add("isFramebufferEnabled"));
|
||||
.add("isFramebufferEnabled")
|
||||
);
|
||||
methodRedirects.put(EXTBlendFunc, RedirectMap.newMap().add("glBlendFuncSeparateEXT", "tryBlendFuncSeparate"));
|
||||
methodRedirects.put(ARBMultiTexture, RedirectMap.newMap().add("glActiveTextureARB"));
|
||||
methodRedirects.put(Project, RedirectMap.newMap().add("gluPerspective"));
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package com.gtnewhorizons.angelica.rendering.celeritas;
|
||||
|
||||
import com.gtnewhorizons.angelica.Tags;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.states.FogState;
|
||||
@@ -20,7 +21,7 @@ public class CeleritasDebugScreenHandler {
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void onRenderGameOverlayTextEvent(RenderGameOverlayEvent.Text event) {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
if (!mc.gameSettings.showDebugInfo) {
|
||||
if (!mc.gameSettings.showDebugInfo || AngelicaConfig.disableF3Additions) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -233,7 +233,7 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
|
||||
|
||||
if (!teCache.angelica$isInfiniteExtent()) {
|
||||
final AxisAlignedBB aabb = teCache.angelica$getCachedRenderBoundingBox();
|
||||
if (!TileEntityRenderBoundsRegistry.isInfiniteExtentsBox(aabb) && !this.currentViewport.isBoxVisible(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ)) {
|
||||
if (aabb != null && !this.currentViewport.isBoxVisible(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -37,6 +39,7 @@ public class CTMUtils {
|
||||
private static TileLoader tileLoader;
|
||||
|
||||
private static TileOverride lastOverride;
|
||||
private static final Lock lock = new ReentrantLock();
|
||||
|
||||
private static final TileOverrideIterator.IJK ijkIterator = newIJKIterator();
|
||||
private static final TileOverrideIterator.Metadata metadataIterator = newMetadataIterator();
|
||||
@@ -52,64 +55,76 @@ public class CTMUtils {
|
||||
} catch (Exception ignore) {}
|
||||
|
||||
TexturePackChangeHandler.register(new TexturePackChangeHandler(MCPatcherUtils.CONNECTED_TEXTURES, 3) {
|
||||
|
||||
@Override
|
||||
public void initialize() {}
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeChange() {
|
||||
RenderPassAPI.instance.clear();
|
||||
lock.lock();
|
||||
try {
|
||||
GlassPaneRenderer.clear();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
renderBlockState.clear();
|
||||
ijkIterator.clear();
|
||||
metadataIterator.clear();
|
||||
allOverrides.clear();
|
||||
blockOverrides.clear();
|
||||
tileOverrides.clear();
|
||||
lastOverride = null;
|
||||
RenderBlocksUtils.blankIcon = null;
|
||||
tileLoader = new TileLoader("textures/blocks", logger);
|
||||
RenderPassAPI.instance.refreshBlendingOptions();
|
||||
|
||||
if (MCPatcherForgeConfig.ConnectedTextures.standard || MCPatcherForgeConfig.ConnectedTextures.nonStandard) {
|
||||
for (ResourceLocation resource : ResourceList.getInstance()
|
||||
.listResources(TexturePackAPI.MCPATCHER_SUBDIR + "ctm", ".properties", true)) {
|
||||
registerOverride(TileOverride.create(resource, tileLoader));
|
||||
RenderPassAPI.instance.clear();
|
||||
try {
|
||||
GlassPaneRenderer.clear();
|
||||
} catch (NoClassDefFoundError e) {
|
||||
// nothing
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
for (ResourceLocation resource : BlendMethod.getAllBlankResources()) {
|
||||
tileLoader.preloadTile(resource, false);
|
||||
renderBlockState.clear();
|
||||
ijkIterator.clear();
|
||||
metadataIterator.clear();
|
||||
allOverrides.clear();
|
||||
blockOverrides.clear();
|
||||
tileOverrides.clear();
|
||||
lastOverride = null;
|
||||
RenderBlocksUtils.blankIcon = null;
|
||||
tileLoader = new TileLoader("textures/blocks", logger);
|
||||
RenderPassAPI.instance.refreshBlendingOptions();
|
||||
|
||||
if (MCPatcherForgeConfig.ConnectedTextures.standard || MCPatcherForgeConfig.ConnectedTextures.nonStandard) {
|
||||
for (ResourceLocation resource : ResourceList.getInstance()
|
||||
.listResources(TexturePackAPI.MCPATCHER_SUBDIR + "ctm", ".properties", true)) {
|
||||
registerOverride(TileOverride.create(resource, tileLoader));
|
||||
}
|
||||
}
|
||||
for (ResourceLocation resource : BlendMethod.getAllBlankResources()) {
|
||||
tileLoader.preloadTile(resource, false);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterChange() {
|
||||
for (TileOverride override : allOverrides) {
|
||||
override.registerIcons();
|
||||
}
|
||||
for (Map.Entry<Block, List<BlockStateMatcher>> entry : blockOverrides.entrySet()) {
|
||||
for (BlockStateMatcher matcher : entry.getValue()) {
|
||||
TileOverride override = (TileOverride) matcher.getData();
|
||||
if (override.getRenderPass() >= 0) {
|
||||
RenderPassAPI.instance.setRenderPassForBlock(entry.getKey(), override.getRenderPass());
|
||||
lock.lock();
|
||||
try {
|
||||
for (TileOverride override : allOverrides) {
|
||||
override.registerIcons();
|
||||
}
|
||||
for (Map.Entry<Block, List<BlockStateMatcher>> entry : blockOverrides.entrySet()) {
|
||||
for (BlockStateMatcher matcher : entry.getValue()) {
|
||||
TileOverride override = (TileOverride) matcher.getData();
|
||||
if (override.getRenderPass() >= 0) {
|
||||
RenderPassAPI.instance.setRenderPassForBlock(entry.getKey(), override.getRenderPass());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (List<BlockStateMatcher> overrides : blockOverrides.values()) {
|
||||
overrides.sort((m1, m2) -> {
|
||||
TileOverride o1 = (TileOverride) m1.getData();
|
||||
TileOverride o2 = (TileOverride) m2.getData();
|
||||
return o1.compareTo(o2);
|
||||
});
|
||||
}
|
||||
for (List<TileOverride> overrides : tileOverrides.values()) {
|
||||
Collections.sort(overrides);
|
||||
}
|
||||
setBlankResource();
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
for (List<BlockStateMatcher> overrides : blockOverrides.values()) {
|
||||
overrides.sort((m1, m2) -> {
|
||||
TileOverride o1 = (TileOverride) m1.getData();
|
||||
TileOverride o2 = (TileOverride) m2.getData();
|
||||
return o1.compareTo(o2);
|
||||
});
|
||||
}
|
||||
for (List<TileOverride> overrides : tileOverrides.values()) {
|
||||
Collections.sort(overrides);
|
||||
}
|
||||
setBlankResource();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -118,40 +133,53 @@ public class CTMUtils {
|
||||
haveBlockFace = false;
|
||||
}
|
||||
|
||||
public static synchronized IIcon getBlockIcon(IIcon icon, Block block, IBlockAccess blockAccess,
|
||||
int x, int y, int z, int face) {
|
||||
lastOverride = null;
|
||||
if (blockAccess != null && checkFace(face)) {
|
||||
if (!haveBlockFace) {
|
||||
renderBlockState.setBlock(block, blockAccess, x, y, z);
|
||||
renderBlockState.setFace(face);
|
||||
}
|
||||
lastOverride = ijkIterator.go(renderBlockState, icon);
|
||||
if (lastOverride != null) {
|
||||
icon = ijkIterator.getIcon();
|
||||
public static IIcon getBlockIcon(IIcon icon, Block block, IBlockAccess blockAccess,
|
||||
int x, int y, int z, int face) {
|
||||
lock.lock();
|
||||
try {
|
||||
lastOverride = null;
|
||||
if (blockAccess != null && checkFace(face)) {
|
||||
if (!haveBlockFace) {
|
||||
renderBlockState.setBlock(block, blockAccess, x, y, z);
|
||||
renderBlockState.setFace(face);
|
||||
}
|
||||
lastOverride = ijkIterator.go(renderBlockState, icon);
|
||||
if (lastOverride != null) {
|
||||
icon = ijkIterator.getIcon();
|
||||
}
|
||||
}
|
||||
clearBlockFace();
|
||||
IIcon result = lastOverride == null && skipDefaultRendering(block) ? RenderBlocksUtils.blankIcon : icon;
|
||||
return result;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
clearBlockFace();
|
||||
return lastOverride == null && skipDefaultRendering(block) ? RenderBlocksUtils.blankIcon : icon;
|
||||
}
|
||||
|
||||
public static synchronized IIcon getBlockIcon(IIcon icon, Block block, int face, int metadata) {
|
||||
lastOverride = null;
|
||||
if (checkFace(face) && checkRenderType(block)) {
|
||||
renderBlockState.setBlockMetadata(block, metadata, face);
|
||||
lastOverride = metadataIterator.go(renderBlockState, icon);
|
||||
if (lastOverride != null) {
|
||||
icon = metadataIterator.getIcon();
|
||||
public static IIcon getBlockIcon(IIcon icon, Block block, int face, int metadata) {
|
||||
lock.lock();
|
||||
try {
|
||||
lastOverride = null;
|
||||
if (checkFace(face) && checkRenderType(block)) {
|
||||
renderBlockState.setBlockMetadata(block, metadata, face);
|
||||
lastOverride = metadataIterator.go(renderBlockState, icon);
|
||||
if (lastOverride != null) {
|
||||
icon = metadataIterator.getIcon();
|
||||
}
|
||||
}
|
||||
return icon;
|
||||
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
public static IIcon getBlockIcon(IIcon icon, Block block, int face) {
|
||||
return getBlockIcon(icon, block, face, 0);
|
||||
}
|
||||
|
||||
public static void reset() {}
|
||||
public static void reset() {
|
||||
}
|
||||
|
||||
private static boolean checkFace(int face) {
|
||||
return face < 0 ? MCPatcherForgeConfig.ConnectedTextures.nonStandard : MCPatcherForgeConfig.ConnectedTextures.standard;
|
||||
@@ -165,50 +193,60 @@ public class CTMUtils {
|
||||
};
|
||||
}
|
||||
|
||||
private static synchronized boolean skipDefaultRendering(Block block) {
|
||||
private static boolean skipDefaultRendering(Block block) {
|
||||
return RenderPassAPI.instance.skipDefaultRendering(block);
|
||||
}
|
||||
|
||||
private static synchronized void registerOverride(TileOverride override) {
|
||||
if (override != null && !override.isDisabled()) {
|
||||
boolean registered = false;
|
||||
List<BlockStateMatcher> matchingBlocks = override.getMatchingBlocks();
|
||||
if (!MCPatcherUtils.isNullOrEmpty(matchingBlocks)) {
|
||||
for (BlockStateMatcher matcher : matchingBlocks) {
|
||||
if (matcher == null) {
|
||||
continue;
|
||||
private static void registerOverride(TileOverride override) {
|
||||
lock.lock();
|
||||
try {
|
||||
if (override != null && !override.isDisabled()) {
|
||||
boolean registered = false;
|
||||
List<BlockStateMatcher> matchingBlocks = override.getMatchingBlocks();
|
||||
if (!MCPatcherUtils.isNullOrEmpty(matchingBlocks)) {
|
||||
for (BlockStateMatcher matcher : matchingBlocks) {
|
||||
if (matcher == null) {
|
||||
continue;
|
||||
}
|
||||
Block block = matcher.getBlock();
|
||||
List<BlockStateMatcher> list = blockOverrides.computeIfAbsent(block, k -> new ArrayList<>());
|
||||
list.add(matcher);
|
||||
logger.fine("using %s for block %s", override, BlockAPI.getBlockName(block));
|
||||
registered = true;
|
||||
}
|
||||
Block block = matcher.getBlock();
|
||||
List<BlockStateMatcher> list = blockOverrides.computeIfAbsent(block, k -> new ArrayList<>());
|
||||
list.add(matcher);
|
||||
logger.fine("using %s for block %s", override, BlockAPI.getBlockName(block));
|
||||
registered = true;
|
||||
}
|
||||
Set<String> matchingTiles = override.getMatchingTiles();
|
||||
if (!MCPatcherUtils.isNullOrEmpty(matchingTiles)) {
|
||||
for (String name : matchingTiles) {
|
||||
List<TileOverride> list = tileOverrides.computeIfAbsent(name, k -> new ArrayList<>());
|
||||
list.add(override);
|
||||
logger.fine("using %s for tile %s", override, name);
|
||||
registered = true;
|
||||
}
|
||||
}
|
||||
if (registered) {
|
||||
allOverrides.add(override);
|
||||
}
|
||||
}
|
||||
Set<String> matchingTiles = override.getMatchingTiles();
|
||||
if (!MCPatcherUtils.isNullOrEmpty(matchingTiles)) {
|
||||
for (String name : matchingTiles) {
|
||||
List<TileOverride> list = tileOverrides.computeIfAbsent(name, k -> new ArrayList<>());
|
||||
list.add(override);
|
||||
logger.fine("using %s for tile %s", override, name);
|
||||
registered = true;
|
||||
}
|
||||
}
|
||||
if (registered) {
|
||||
allOverrides.add(override);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void setBlankResource() {
|
||||
RenderBlocksUtils.blankIcon = tileLoader.getIcon(RenderPassAPI.instance.getBlankResource());
|
||||
public static void setBlankResource() {
|
||||
lock.lock();
|
||||
try {
|
||||
RenderBlocksUtils.blankIcon = tileLoader.getIcon(RenderPassAPI.instance.getBlankResource());
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public static TileOverrideIterator.IJK newIJKIterator() {
|
||||
private static TileOverrideIterator.IJK newIJKIterator() {
|
||||
return new TileOverrideIterator.IJK(blockOverrides, tileOverrides);
|
||||
}
|
||||
|
||||
public static TileOverrideIterator.Metadata newMetadataIterator() {
|
||||
private static TileOverrideIterator.Metadata newMetadataIterator() {
|
||||
return new TileOverrideIterator.Metadata(blockOverrides, tileOverrides);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ abstract public class TileOverrideIterator implements Iterator<TileOverride> {
|
||||
this.allTileOverrides = allTileOverrides;
|
||||
}
|
||||
|
||||
synchronized void clear() {
|
||||
void clear() {
|
||||
currentIcon = null;
|
||||
blockOverrides = null;
|
||||
tileOverrides = null;
|
||||
@@ -46,7 +46,7 @@ abstract public class TileOverrideIterator implements Iterator<TileOverride> {
|
||||
skipOverrides.clear();
|
||||
}
|
||||
|
||||
private synchronized void resetForNextPass() {
|
||||
private void resetForNextPass() {
|
||||
blockOverrides = null;
|
||||
tileOverrides = allTileOverrides.get(currentIcon.getIconName());
|
||||
blockPos = 0;
|
||||
@@ -55,7 +55,7 @@ abstract public class TileOverrideIterator implements Iterator<TileOverride> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean hasNext() {
|
||||
public boolean hasNext() {
|
||||
if (foundNext) {
|
||||
return true;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ abstract public class TileOverrideIterator implements Iterator<TileOverride> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized TileOverride next() {
|
||||
public TileOverride next() {
|
||||
if (!foundNext) {
|
||||
throw new IllegalStateException("next called before hasNext() == true");
|
||||
}
|
||||
@@ -89,11 +89,11 @@ abstract public class TileOverrideIterator implements Iterator<TileOverride> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void remove() {
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("remove not supported");
|
||||
}
|
||||
|
||||
private synchronized boolean checkOverride(TileOverride override) {
|
||||
private boolean checkOverride(TileOverride override) {
|
||||
if (override != null && !override.isDisabled() && !skipOverrides.contains(override)) {
|
||||
foundNext = true;
|
||||
nextOverride = override;
|
||||
@@ -103,7 +103,7 @@ abstract public class TileOverrideIterator implements Iterator<TileOverride> {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized TileOverride go(RenderBlockState renderBlockState, IIcon origIcon) {
|
||||
public TileOverride go(RenderBlockState renderBlockState, IIcon origIcon) {
|
||||
this.renderBlockState = renderBlockState;
|
||||
renderBlockState.setFilter(null);
|
||||
currentIcon = origIcon;
|
||||
@@ -133,7 +133,7 @@ abstract public class TileOverrideIterator implements Iterator<TileOverride> {
|
||||
return lastMatchedOverride;
|
||||
}
|
||||
|
||||
public synchronized IIcon getIcon() {
|
||||
public IIcon getIcon() {
|
||||
return currentIcon;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ abstract public class TileOverrideIterator implements Iterator<TileOverride> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized IIcon getTile(TileOverride override, RenderBlockState renderBlockState, IIcon origIcon) {
|
||||
protected IIcon getTile(TileOverride override, RenderBlockState renderBlockState, IIcon origIcon) {
|
||||
return override.getTileWorld(renderBlockState, origIcon);
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ abstract public class TileOverrideIterator implements Iterator<TileOverride> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected synchronized IIcon getTile(TileOverride override, RenderBlockState renderBlockState, IIcon origIcon) {
|
||||
protected IIcon getTile(TileOverride override, RenderBlockState renderBlockState, IIcon origIcon) {
|
||||
return override.getTileHeld(renderBlockState, origIcon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,6 +397,12 @@ public class SodiumGameOptionPages {
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(Settings.MODE_GUI_BACKGROUND.option)
|
||||
.add(Settings.GUI_BACKGROUND.option)
|
||||
.add(OptionImpl.createBuilder(boolean.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.disablef3"))
|
||||
.setTooltip(I18n.format("options.angelica.disablef3.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> AngelicaConfig.disableF3Additions = value, opts -> AngelicaConfig.disableF3Additions)
|
||||
.build())
|
||||
.build());
|
||||
|
||||
return new OptionPage(I18n.format("sodium.options.pages.advanced"), ImmutableList.copyOf(groups));
|
||||
|
||||
@@ -390,6 +390,9 @@ public class Iris {
|
||||
// Warm up the threadpool so shader transformations are faster when we need them
|
||||
ShaderTransformExecutor.warmup();
|
||||
|
||||
// Initialize version hoisting pattern based on GL capabilities
|
||||
ShaderTransformer.init();
|
||||
|
||||
PBRTextureManager.INSTANCE.init();
|
||||
|
||||
// Only load the shader pack when we can access OpenGL
|
||||
|
||||
@@ -37,7 +37,7 @@ public class IrisDebugScreenHandler {
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void onRenderGameOverlayTextEvent(RenderGameOverlayEvent.Text event) {
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
if (mc.gameSettings.showDebugInfo) {
|
||||
if (mc.gameSettings.showDebugInfo && !AngelicaConfig.disableF3Additions) {
|
||||
event.right.add(Math.min(event.right.size(), 2), "Direct Buffers: +" + iris$humanReadableByteCountBin(iris$directPool.getMemoryUsed()));
|
||||
|
||||
if (Iris.getIrisConfig().areShadersEnabled()) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.Locale;
|
||||
* A compiled OpenGL shader object.
|
||||
*/
|
||||
public class GlShader extends GlResource {
|
||||
private static final Logger LOGGER = LogManager.getLogger(GlShader.class);
|
||||
private static final Logger LOGGER = LogManager.getLogger("GlShader");
|
||||
|
||||
private final String name;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public enum PixelType {
|
||||
UNSIGNED_SHORT_4_4_4_4_REV(GL12.GL_UNSIGNED_SHORT_4_4_4_4_REV, GlVersion.GL_12),
|
||||
UNSIGNED_SHORT_5_5_5_1(GL12.GL_UNSIGNED_SHORT_5_5_5_1, GlVersion.GL_12),
|
||||
UNSIGNED_SHORT_1_5_5_5_REV(GL12.GL_UNSIGNED_SHORT_1_5_5_5_REV, GlVersion.GL_12),
|
||||
UNSIGNED_INT(GL11.GL_UNSIGNED_BYTE, GlVersion.GL_11),
|
||||
UNSIGNED_INT(GL11.GL_UNSIGNED_INT, GlVersion.GL_11),
|
||||
UNSIGNED_INT_8_8_8_8(GL12.GL_UNSIGNED_INT_8_8_8_8, GlVersion.GL_12),
|
||||
UNSIGNED_INT_8_8_8_8_REV(GL12.GL_UNSIGNED_INT_8_8_8_8_REV, GlVersion.GL_12),
|
||||
UNSIGNED_INT_10_10_10_2(GL12.GL_UNSIGNED_INT_10_10_10_2, GlVersion.GL_12),
|
||||
|
||||
@@ -754,6 +754,10 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
|
||||
IrisSamplers.addNoiseSampler(customTextureSamplerInterceptor, customTextureManager.getNoiseTexture());
|
||||
|
||||
IrisSamplers.addCustomImages(customTextureSamplerInterceptor, customImages);
|
||||
IrisSamplers.addCustomTextures(customTextureSamplerInterceptor, customTextureManager.getIrisCustomTextures());
|
||||
IrisImages.addCustomImages(builder, customImages);
|
||||
|
||||
if (IrisSamplers.hasShadowSamplers(customTextureSamplerInterceptor)) {
|
||||
if (!shadow) {
|
||||
shadowTargetsSupplier.get();
|
||||
@@ -1130,6 +1134,9 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
|
||||
IrisSamplers.addNoiseSampler(customTextureSamplerInterceptor, customTextureManager.getNoiseTexture());
|
||||
|
||||
IrisSamplers.addCustomImages(customTextureSamplerInterceptor, customImages);
|
||||
IrisSamplers.addCustomTextures(customTextureSamplerInterceptor, customTextureManager.getIrisCustomTextures());
|
||||
|
||||
if (IrisSamplers.hasShadowSamplers(customTextureSamplerInterceptor)) {
|
||||
if (shadowRenderTargets != null) {
|
||||
IrisSamplers.addShadowSamplers(customTextureSamplerInterceptor, shadowRenderTargets, null, true);
|
||||
@@ -1137,6 +1144,8 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
|
||||
}
|
||||
}
|
||||
|
||||
IrisImages.addCustomImages(builder, customImages);
|
||||
|
||||
programs[i] = builder.buildCompute();
|
||||
|
||||
this.customUniforms.mapholderToPass(builder, programs[i]);
|
||||
|
||||
@@ -48,7 +48,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.GameModeUtil;
|
||||
import org.embeddedt.embeddium.impl.render.viewport.ViewportProvider;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3dc;
|
||||
import org.joml.Vector3d;
|
||||
import org.joml.Vector3f;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.BufferUtils;
|
||||
@@ -162,24 +162,21 @@ public class ShadowRenderer {
|
||||
}
|
||||
|
||||
public static MatrixStack createShadowModelView(float sunPathRotation, float intervalSize) {
|
||||
// Determine the camera position
|
||||
final Vector3dc cameraPos = CameraUniforms.getUnshiftedCameraPosition();
|
||||
|
||||
final double cameraX = cameraPos.x();
|
||||
final double cameraY = cameraPos.y();
|
||||
final double cameraZ = cameraPos.z();
|
||||
// Use entity position for shadow matrix
|
||||
final Vector3d entityPos = Camera.INSTANCE.getEntityPos();
|
||||
|
||||
// Set up our modelview matrix stack
|
||||
final MatrixStack modelView = new MatrixStack();
|
||||
ShadowMatrices.createModelViewMatrix(modelView, getShadowAngle(), intervalSize, sunPathRotation, cameraX, cameraY, cameraZ);
|
||||
ShadowMatrices.createModelViewMatrix(modelView, getShadowAngle(), intervalSize, sunPathRotation, entityPos.x, entityPos.y, entityPos.z);
|
||||
|
||||
return modelView;
|
||||
}
|
||||
|
||||
private MatrixStack getShadowModelView() {
|
||||
final Vector3dc cameraPos = CameraUniforms.getUnshiftedCameraPosition();
|
||||
final Vector3d entityPos = Camera.INSTANCE.getEntityPos();
|
||||
|
||||
shadowModelView.reset();
|
||||
ShadowMatrices.createModelViewMatrix(shadowModelView, getShadowAngle(), this.intervalSize, this.sunPathRotation, cameraPos.x(), cameraPos.y(), cameraPos.z());
|
||||
ShadowMatrices.createModelViewMatrix(shadowModelView, getShadowAngle(), this.intervalSize, this.sunPathRotation, entityPos.x, entityPos.y, entityPos.z);
|
||||
return shadowModelView;
|
||||
}
|
||||
|
||||
@@ -635,15 +632,14 @@ public class ShadowRenderer {
|
||||
|
||||
terrainFrustumHolder = createShadowFrustum(renderDistanceMultiplier, terrainFrustumHolder);
|
||||
|
||||
// Determine the player camera position
|
||||
final Vector3dc cameraPos = CameraUniforms.getUnshiftedCameraPosition();
|
||||
// Use the player/entity position for shadow rendering
|
||||
final Vector3d entityPos = playerCamera.getEntityPos();
|
||||
final double entityX = entityPos.x;
|
||||
final double entityY = entityPos.y;
|
||||
final double entityZ = entityPos.z;
|
||||
|
||||
final double cameraX = cameraPos.x();
|
||||
final double cameraY = cameraPos.y();
|
||||
final double cameraZ = cameraPos.z();
|
||||
|
||||
// Center the frustum on the player camera position
|
||||
terrainFrustumHolder.getFrustum().setPosition(cameraX, cameraY, cameraZ);
|
||||
// Center the frustum on the player position
|
||||
terrainFrustumHolder.getFrustum().setPosition(entityX, entityY, entityZ);
|
||||
|
||||
profiler.endSection();
|
||||
|
||||
@@ -699,7 +695,7 @@ public class ShadowRenderer {
|
||||
}
|
||||
|
||||
Frustrum entityShadowFrustum = entityFrustumHolder.getFrustum();
|
||||
entityShadowFrustum.setPosition(cameraX, cameraY, cameraZ);
|
||||
entityShadowFrustum.setPosition(entityX, entityY, entityZ);
|
||||
|
||||
// Set viewport for entity visibility checks during shadow pass (matches modern Celeritas)
|
||||
if (AngelicaConfig.enableCeleritas) {
|
||||
@@ -709,13 +705,13 @@ public class ShadowRenderer {
|
||||
// Render nearby entities
|
||||
|
||||
if (shouldRenderEntities) {
|
||||
renderEntities(levelRenderer, entityShadowFrustum, null, modelView, cameraX, cameraY, cameraZ, tickDelta);
|
||||
renderEntities(levelRenderer, entityShadowFrustum, null, modelView, entityX, entityY, entityZ, tickDelta);
|
||||
} else if (shouldRenderPlayer) {
|
||||
renderPlayerEntity(levelRenderer, entityShadowFrustum, null, modelView, cameraX, cameraY, cameraZ, tickDelta);
|
||||
renderPlayerEntity(levelRenderer, entityShadowFrustum, null, modelView, entityX, entityY, entityZ, tickDelta);
|
||||
}
|
||||
|
||||
if (shouldRenderBlockEntities) {
|
||||
renderTileEntities(null, modelView, cameraX, cameraY, cameraZ, tickDelta, hasEntityFrustum);
|
||||
renderTileEntities(null, modelView, entityX, entityY, entityZ, tickDelta, hasEntityFrustum);
|
||||
}
|
||||
|
||||
profiler.endStartSection("draw entities");
|
||||
|
||||
@@ -2,6 +2,8 @@ package net.coderbot.iris.pipeline.transform;
|
||||
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.iris.IrisExtendedChunkVertexType;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.gl.shader.ShaderType;
|
||||
@@ -15,13 +17,15 @@ import org.taumc.glsl.ShaderParser;
|
||||
import org.taumc.glsl.Transformer;
|
||||
import org.taumc.glsl.grammar.GLSLLexer;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -58,7 +62,63 @@ public class ShaderTransformer {
|
||||
fullReservedWords.add("texture");
|
||||
|
||||
// sample was added as a keyword in GLSL 400, many shaders use it
|
||||
versionedReservedWords.put(400, Arrays.asList("sample"));
|
||||
versionedReservedWords.put(400, List.of("sample"));
|
||||
}
|
||||
|
||||
private record VersionRequirement(String keyword, int minVersion, BooleanSupplier supported) {}
|
||||
|
||||
// Sorted descending by minVersion for early exit in getRequiredVersion
|
||||
private static final VersionRequirement[] VERSION_REQUIREMENTS = {
|
||||
new VersionRequirement("std430", 430, RenderSystem::supportsSSBO),
|
||||
new VersionRequirement("iimage", 420, RenderSystem::supportsImageLoadStore),
|
||||
new VersionRequirement("uimage", 420, RenderSystem::supportsImageLoadStore),
|
||||
new VersionRequirement("imageLoad", 420, RenderSystem::supportsImageLoadStore),
|
||||
new VersionRequirement("imageStore", 420, RenderSystem::supportsImageLoadStore)
|
||||
};
|
||||
|
||||
private static Pattern hoistPattern;
|
||||
private static Object2IntMap<String> keywordToVersion;
|
||||
private static int maxSupportedHoistVersion;
|
||||
|
||||
public static void init() {
|
||||
final StringBuilder patternBuilder = new StringBuilder();
|
||||
final Object2IntOpenHashMap<String> versionMap = new Object2IntOpenHashMap<>();
|
||||
int maxVersion = 0;
|
||||
|
||||
for (VersionRequirement req : VERSION_REQUIREMENTS) {
|
||||
if (req.supported.getAsBoolean()) {
|
||||
if (!patternBuilder.isEmpty()) patternBuilder.append('|');
|
||||
|
||||
patternBuilder.append(Pattern.quote(req.keyword));
|
||||
versionMap.put(req.keyword, req.minVersion);
|
||||
maxVersion = Math.max(maxVersion, req.minVersion);
|
||||
}
|
||||
}
|
||||
|
||||
if (!patternBuilder.isEmpty()) {
|
||||
hoistPattern = Pattern.compile(patternBuilder.toString());
|
||||
keywordToVersion = versionMap;
|
||||
}
|
||||
maxSupportedHoistVersion = maxVersion;
|
||||
|
||||
Iris.logger.info("Shader version hoisting: {} feature(s) GLSL {}", versionMap.size(), maxVersion > 0 ? maxVersion : "N/A");
|
||||
}
|
||||
|
||||
private static int getRequiredVersion(String shaderSource, int declaredVersion) {
|
||||
if (hoistPattern == null || declaredVersion >= maxSupportedHoistVersion) {
|
||||
return declaredVersion;
|
||||
}
|
||||
|
||||
final Matcher m = hoistPattern.matcher(shaderSource);
|
||||
int required = declaredVersion;
|
||||
while (m.find()) {
|
||||
final int ver = keywordToVersion.getInt(m.group());
|
||||
if (ver > required) {
|
||||
required = ver;
|
||||
if (required >= maxSupportedHoistVersion) break;
|
||||
}
|
||||
}
|
||||
return required;
|
||||
}
|
||||
|
||||
private static final class TransformKey<P extends Parameters> {
|
||||
@@ -164,10 +224,19 @@ public class ShaderTransformer {
|
||||
|
||||
String profile = "";
|
||||
int versionInt = Integer.parseInt(versionString);
|
||||
|
||||
// Check if shader uses features requiring a higher GLSL version
|
||||
int requiredVersion = getRequiredVersion(input, versionInt);
|
||||
if (requiredVersion > versionInt) {
|
||||
Iris.logger.debug("Shader requires GLSL {} for detected features, hoisting from {}", requiredVersion, versionInt);
|
||||
versionInt = requiredVersion;
|
||||
versionString = String.valueOf(versionInt);
|
||||
}
|
||||
|
||||
if (versionInt >= 150) {
|
||||
profile = matcher.group(2);
|
||||
if (profile == null) {
|
||||
profile = "core";
|
||||
profile = "compatibility";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ public class ShaderPack {
|
||||
IncludeProcessor includeProcessor = new IncludeProcessor(graph);
|
||||
|
||||
// Set up our source provider for creating ProgramSets
|
||||
Iterable<StringPair> finalEnvironmentDefines1 = environmentDefines;
|
||||
Iterable<StringPair> finalEnvironmentDefines1 = finalEnvironmentDefines;
|
||||
this.sourceProvider = (path) -> {
|
||||
String pathString = path.getPathString();
|
||||
// Removes the first "/" in the path if present, and the file
|
||||
|
||||
@@ -25,9 +25,11 @@ import net.minecraft.world.biome.BiomeGenSnow;
|
||||
import net.minecraft.world.biome.BiomeGenStoneBeach;
|
||||
import net.minecraft.world.biome.BiomeGenSwamp;
|
||||
import net.minecraft.world.biome.BiomeGenTaiga;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -107,6 +109,9 @@ public class BiomeUniforms {
|
||||
return biome != null ? biome.temperature : 0.0F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Biome ids in 1.7.10 are not unique, instead of this the biome category should be used
|
||||
*/
|
||||
public static int getBiomeId() {
|
||||
final BiomeGenBase biome = getCachedBiome();
|
||||
return biome != null ? biome.biomeID : 0;
|
||||
@@ -142,36 +147,51 @@ public class BiomeUniforms {
|
||||
}
|
||||
|
||||
private static int determineBiomeCategory(BiomeGenBase biome) {
|
||||
// Tier 1: Hardcoded vanilla biome IDs
|
||||
BiomeGenBase lookupBiome = biome;
|
||||
if (biome instanceof BiomeGenMutated mutated && mutated.baseBiome != null) {
|
||||
lookupBiome = mutated.baseBiome;
|
||||
}
|
||||
|
||||
BiomeCategories category = getVanillaBiomeCategory(lookupBiome.biomeID);
|
||||
BiomeCategories category = null;
|
||||
|
||||
// Tier 1: Hardcoded vanilla biome IDs
|
||||
// biomes not in the biomeGenArray are also not registered to the forge biomeDictionary
|
||||
if (Arrays.asList(BiomeGenBase.getBiomeGenArray()).contains(biome)) {
|
||||
category = getVanillaBiomeCategory(lookupBiome.biomeID);
|
||||
|
||||
if (category != null) {
|
||||
return category.ordinal();
|
||||
}
|
||||
|
||||
// Tier 2: forge BiomeDictionary detection
|
||||
if (BiomeDictionary.isBiomeRegistered(biome)) {
|
||||
category = detectBiomeByBiomeDictionary(biome);
|
||||
}
|
||||
}
|
||||
|
||||
if (category != null) {
|
||||
return category.ordinal();
|
||||
}
|
||||
|
||||
// Tier 2: Class-based detection for vanilla biome types
|
||||
// Tier 3: Class-based detection for vanilla biome types
|
||||
category = detectVanillaBiomeByClass(biome);
|
||||
if (category != null) {
|
||||
return category.ordinal();
|
||||
}
|
||||
|
||||
// Tier 3: Modded biome detection (BiomesOPlenty, Realistic World Gen)
|
||||
// Tier 4: Modded biome detection (BiomesOPlenty, Realistic World Gen, lotr)
|
||||
category = detectModdedBiome(biome);
|
||||
if (category != null) {
|
||||
return category.ordinal();
|
||||
}
|
||||
|
||||
// Tier 4: Name pattern matching
|
||||
// Tier 5: Name pattern matching
|
||||
category = detectBiomeByName(biome);
|
||||
if (category != null) {
|
||||
return category.ordinal();
|
||||
}
|
||||
|
||||
// Tier 5: Temperature/rainfall heuristics
|
||||
// Tier 6: Temperature/rainfall heuristics
|
||||
category = detectBiomeByProperties(biome);
|
||||
if (category != null) {
|
||||
return category.ordinal();
|
||||
@@ -366,4 +386,42 @@ public class BiomeUniforms {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the forge BiomeDictionary when available
|
||||
*/
|
||||
private static BiomeCategories detectBiomeByBiomeDictionary(BiomeGenBase biome) {
|
||||
|
||||
var biomeDictTypes = Arrays.asList(BiomeDictionary.getTypesForBiome(biome));
|
||||
|
||||
if (biomeDictTypes.contains(BiomeDictionary.Type.SAVANNA)) {
|
||||
return BiomeCategories.SAVANNA;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.JUNGLE)) {
|
||||
return BiomeCategories.JUNGLE;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.NETHER)) {
|
||||
return BiomeCategories.NETHER;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.END)) {
|
||||
return BiomeCategories.THE_END;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.MUSHROOM)) {
|
||||
return BiomeCategories.MUSHROOM;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.OCEAN)) {
|
||||
return BiomeCategories.OCEAN;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.RIVER)) {
|
||||
return BiomeCategories.RIVER;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.MESA)) {
|
||||
return BiomeCategories.MESA;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.FOREST)) {
|
||||
return BiomeCategories.FOREST;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.PLAINS)) {
|
||||
return BiomeCategories.PLAINS;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.MOUNTAIN)) {
|
||||
return BiomeCategories.MOUNTAIN;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.SWAMP)) {
|
||||
return BiomeCategories.SWAMP;
|
||||
} else if (biomeDictTypes.contains(BiomeDictionary.Type.SANDY)) {
|
||||
return BiomeCategories.DESERT;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ options.chunks=%s chunks
|
||||
options.entityShadows=Entity Shadows
|
||||
options.droppedItems=%s items
|
||||
options.droppedItems.max=Unlimited
|
||||
|
||||
sodium.option_impact.low=Low
|
||||
sodium.option_impact.medium=Medium
|
||||
sodium.option_impact.high=High
|
||||
@@ -90,11 +91,14 @@ sodium.options.default=Default
|
||||
sodium.options.buttons.undo=Undo
|
||||
sodium.options.buttons.apply=Apply
|
||||
sodium.options.buttons.donate=Buy coffee for JellySquid!
|
||||
|
||||
options.dynamic_fov=Dynamic FOV
|
||||
options.dynamic_fov.tooltip=If enabled, the game's field of view will change based on the player's speed.
|
||||
options.framerate=%s FPS
|
||||
|
||||
iris.shaders.toggled=Toggled shaders to %s!
|
||||
iris.shaders.disabled=Shaders disabled!
|
||||
|
||||
options.iris.apply=Apply
|
||||
options.iris.refresh=Refresh
|
||||
options.iris.openShaderPackFolder=Open Shader Pack Folder...
|
||||
@@ -131,6 +135,7 @@ options.iris.shadowDistance.enabled=Allows you to change the maximum distance fo
|
||||
options.iris.shadowDistance.disabled=Your current shader pack has already set a render distance for shadows; you cannot change it.
|
||||
options.iris.gui.hide=Hide GUI
|
||||
options.iris.gui.show=Show GUI
|
||||
|
||||
options.dynamic_lights=Dynamic Lights
|
||||
options.dynamic_lights.tooltip=Enables dynamic lights. Modes: OFF - off, FASTEST - 500ms delay, FAST - 250ms delay, FANCY - 50ms delay, REALTIME - no delay.
|
||||
options.dynamic_lights_shader_force=Dynamic Lights - Forced With Shaders
|
||||
@@ -153,6 +158,7 @@ options.dynamiclights.entities.title=Dynamic Lights - Entities
|
||||
options.dynamiclights.entities.info=Toggle which entity types emit dynamic light. Some entries are for mod compatibility.
|
||||
options.dynamiclights.entities.search=Search (@mod, $on, $off)
|
||||
options.dynamiclights.entity.tooltip=Toggle dynamic lighting for %s entities. Disable to improve performance if this entity type emits unwanted lights.
|
||||
|
||||
options.angelica.search.no_results=No matching options
|
||||
options.angelica.fontconfig=Font Configuration...
|
||||
options.angelica.fontconfig.title=Font Configuration
|
||||
@@ -199,9 +205,13 @@ 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.
|
||||
options.angelica.threadedChunkBuilding=Threaded Chunk Building
|
||||
options.angelica.threadedChunkBuilding.tooltip=If enabled, chunk meshing will be performed on multiple threads in parallel, significantly improving chunk build speed. Disable if you experience rendering issues with mods that have custom block renderers. Requires renderer reload to take effect.
|
||||
|
||||
pack.iris.select.title=Select
|
||||
pack.iris.configure.title=Configure
|
||||
label.iris.true=On
|
||||
label.iris.false=Off
|
||||
|
||||
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.
|
||||
Reference in new issue
Block a user