mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-19 03:49:22 +00:00
Fix some small things
* Bump nhlib dep due to crash when Iris is disabled * Use jabel for tests * use joml isIdentity * remove Integer usage
This commit is contained in:
1 parent
33de1de9c4
commit
2fc2e2e38d
9 files changed
+36
-39
No files matched your search
@@ -18,7 +18,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
name = "Angelica",
|
||||
version = Tags.VERSION,
|
||||
dependencies = """
|
||||
required-after:gtnhlib@[0.8.18,);\
|
||||
required-after:gtnhlib@[0.8.19,);\
|
||||
before:lwjgl3ify@[1.5.3,);\
|
||||
after:hodgepodge@[2.4.4,);\
|
||||
after:CodeChickenCore@[1.2.0,);\
|
||||
|
||||
@@ -101,7 +101,7 @@ public class DisplayListManager {
|
||||
return currentRenderingList != -1;
|
||||
}
|
||||
|
||||
static boolean isIdentity(Matrix4f m) {
|
||||
public static boolean isIdentity(Matrix4f m) {
|
||||
return (m.properties() & Matrix4f.PROPERTY_IDENTITY) != 0;
|
||||
}
|
||||
|
||||
|
||||
+3
-13
@@ -1,5 +1,6 @@
|
||||
package com.gtnewhorizons.angelica.glsm.recording;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.DisplayListManager;
|
||||
import com.gtnewhorizons.angelica.glsm.recording.commands.DisplayListCommand;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -255,17 +256,6 @@ public final class CommandBufferProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a matrix is identity (within epsilon).
|
||||
*/
|
||||
public static boolean isIdentity(Matrix4f m) {
|
||||
final float eps = 1e-6f;
|
||||
return Math.abs(m.m00() - 1) < eps && Math.abs(m.m01()) < eps && Math.abs(m.m02()) < eps && Math.abs(m.m03()) < eps
|
||||
&& Math.abs(m.m10()) < eps && Math.abs(m.m11() - 1) < eps && Math.abs(m.m12()) < eps && Math.abs(m.m13()) < eps
|
||||
&& Math.abs(m.m20()) < eps && Math.abs(m.m21()) < eps && Math.abs(m.m22() - 1) < eps && Math.abs(m.m23()) < eps
|
||||
&& Math.abs(m.m30()) < eps && Math.abs(m.m31()) < eps && Math.abs(m.m32()) < eps && Math.abs(m.m33() - 1) < eps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lightweight transform optimizer for buffer-to-buffer processing.
|
||||
* Tracks accumulated MODELVIEW transform and emits MultMatrix commands when needed.
|
||||
@@ -316,7 +306,7 @@ public final class CommandBufferProcessor {
|
||||
}
|
||||
|
||||
public boolean isIdentity() {
|
||||
return CommandBufferProcessor.isIdentity(accumulated);
|
||||
return DisplayListManager.isIdentity(accumulated);
|
||||
}
|
||||
|
||||
public void markAbsoluteMatrix() {
|
||||
@@ -340,7 +330,7 @@ public final class CommandBufferProcessor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (CommandBufferProcessor.isIdentity(lastEmitted)) {
|
||||
if (DisplayListManager.isIdentity(lastEmitted)) {
|
||||
out.writeMultMatrix(GL11.GL_MODELVIEW, target);
|
||||
} else {
|
||||
final Matrix4f delta = new Matrix4f(lastEmitted).invert().mul(target);
|
||||
|
||||
@@ -2,12 +2,12 @@ package com.gtnewhorizons.angelica.glsm.recording;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vbo.VertexBuffer;
|
||||
import com.gtnewhorizons.angelica.glsm.recording.commands.DisplayListCommand;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.bytebuf.MemoryUtilities.memAddress;
|
||||
import static com.gtnewhorizon.gtnhlib.bytebuf.MemoryUtilities.memFree;
|
||||
@@ -96,8 +96,8 @@ public final class CompiledDisplayList {
|
||||
* Get counts of each command type in the buffer.
|
||||
* Used for testing to verify optimization results.
|
||||
*/
|
||||
public Map<Integer, Integer> getCommandCounts() {
|
||||
Map<Integer, Integer> counts = new HashMap<>();
|
||||
public Int2IntMap getCommandCounts() {
|
||||
Int2IntMap counts = new Int2IntOpenHashMap();
|
||||
if (commandBuffer == null || commandBuffer.limit() == 0) {
|
||||
return counts;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public final class CompiledDisplayList {
|
||||
long end = ptr + commandBuffer.limit();
|
||||
while (ptr < end) {
|
||||
int cmd = memGetInt(ptr);
|
||||
counts.merge(cmd, 1, Integer::sum);
|
||||
counts.mergeInt(cmd, 1, Integer::sum);
|
||||
ptr += getCommandSize(cmd, ptr);
|
||||
}
|
||||
return counts;
|
||||
@@ -115,8 +115,8 @@ public final class CompiledDisplayList {
|
||||
* Get the sequence of command opcodes in order.
|
||||
* Used for testing to verify command ordering.
|
||||
*/
|
||||
public List<Integer> getCommandOpcodes() {
|
||||
List<Integer> opcodes = new ArrayList<>();
|
||||
public IntList getCommandOpcodes() {
|
||||
IntList opcodes = new IntArrayList();
|
||||
if (commandBuffer == null || commandBuffer.limit() == 0) {
|
||||
return opcodes;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user