mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-19 11:59:40 +00:00
Normalize Rotation vector
Also add cache bypass to matrix caching
This commit is contained in:
1 parent
de0a600163
commit
46164ebac7
1 file changed
+11
-2
@@ -36,6 +36,7 @@ import org.joml.Matrix4d;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Matrix4fStack;
|
||||
import org.joml.Vector3d;
|
||||
import org.joml.Vector3f;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.opengl.ARBMultitexture;
|
||||
@@ -160,6 +161,11 @@ public class GLStateManager {
|
||||
}
|
||||
|
||||
public static void glGetFloat(int pname, FloatBuffer params) {
|
||||
if(GLStateManager.BYPASS_CACHE) {
|
||||
GL11.glGetFloat(pname, params);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (pname) {
|
||||
case GL11.GL_MODELVIEW_MATRIX -> modelViewMatrix.get(params);
|
||||
case GL11.GL_PROJECTION_MATRIX -> projectionMatrix.get(params);
|
||||
@@ -808,14 +814,17 @@ public class GLStateManager {
|
||||
getMatrixStack().mul(conersionMatrix4f);
|
||||
}
|
||||
|
||||
private static final Vector3f rotation = new Vector3f();
|
||||
public static void glRotatef(float angle, float x, float y, float z) {
|
||||
GL11.glRotatef(angle, x, y, z);
|
||||
getMatrixStack().rotate((float)Math.toRadians(angle), x, y, z);
|
||||
rotation.set(x, y, z).normalize();
|
||||
getMatrixStack().rotate((float)Math.toRadians(angle), rotation);
|
||||
}
|
||||
|
||||
public static void glRotated(double angle, double x, double y, double z) {
|
||||
GL11.glRotated(angle, x, y, z);
|
||||
getMatrixStack().rotate((float)Math.toRadians(angle), (float) x, (float) y, (float) z);
|
||||
rotation.set(x, y, z).normalize();
|
||||
getMatrixStack().rotate((float)Math.toRadians(angle), rotation);
|
||||
}
|
||||
|
||||
public static void glOrtho(double left, double right, double bottom, double top, double zNear, double zFar) {
|
||||
|
||||
Reference in new issue
Block a user