mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-21 21:02:15 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3d689e806 | ||
|
|
d4e22b6c0c |
No files matched your search
@@ -26,6 +26,7 @@ import net.coderbot.iris.texture.TextureInfoCache;
|
||||
import net.coderbot.iris.texture.TextureTracker;
|
||||
import net.coderbot.iris.texture.pbr.PBRTextureManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import org.joml.Matrix4d;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3d;
|
||||
import org.lwjgl.BufferUtils;
|
||||
@@ -37,6 +38,7 @@ import org.lwjgl.opengl.GL12;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.DoubleBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.stream.IntStream;
|
||||
@@ -739,6 +741,15 @@ public class GLStateManager {
|
||||
matrixState.multiply(matrix);
|
||||
}
|
||||
|
||||
public static final Matrix4d conersionMatrix4d = new Matrix4d();
|
||||
public static final Matrix4f conersionMatrix4f = new Matrix4f();
|
||||
public static void glMultMatrix(DoubleBuffer matrix) {
|
||||
GL11.glMultMatrix(matrix);
|
||||
conersionMatrix4d.set(matrix);
|
||||
conersionMatrix4f.set(conersionMatrix4d);
|
||||
matrixState.multiply(conersionMatrix4f);
|
||||
}
|
||||
|
||||
public static void glRotatef(float angle, float x, float y, float z) {
|
||||
GL11.glRotatef(angle, x, y, z);
|
||||
matrixState.rotate((float)Math.toRadians(angle), x, y, z);
|
||||
|
||||
@@ -8,12 +8,14 @@ import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
|
||||
public class GlStateTracker {
|
||||
private static final int UNASSIGNED_HANDLE = -1;
|
||||
|
||||
private final int[] bufferState = new int[GlBufferTarget.COUNT];
|
||||
//private final int[] bufferRestoreState = new int[GlBufferTarget.COUNT];
|
||||
private final EnumSet<GlBufferTarget> mutatedBuffers = EnumSet.noneOf(GlBufferTarget.class);
|
||||
|
||||
private int vertexArrayState;
|
||||
//private int vertexArrayRestoreState;
|
||||
@@ -31,6 +33,8 @@ public class GlStateTracker {
|
||||
|
||||
this.bufferState[target.ordinal()] = buffer;
|
||||
|
||||
mutatedBuffers.add(target);
|
||||
|
||||
return prevBuffer != buffer;
|
||||
}
|
||||
|
||||
@@ -47,9 +51,10 @@ public class GlStateTracker {
|
||||
}
|
||||
|
||||
public void applyRestoreState() {
|
||||
for (int i = 0; i < GlBufferTarget.COUNT; i++) {
|
||||
GL15.glBindBuffer(GlBufferTarget.VALUES[i].getTargetParameter(), 0);
|
||||
}
|
||||
mutatedBuffers.forEach(target -> {
|
||||
GL15.glBindBuffer(target.getTargetParameter(), 0);
|
||||
});
|
||||
mutatedBuffers.clear();
|
||||
if(GlFunctions.isVertexArraySupported()) {
|
||||
GL30.glBindVertexArray(0);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user