use of org.lwjgl.util.vector.Matrix4f in project lwjgl by LWJGL.
the class GLMatrix method gluPerspective.
public static void gluPerspective(final float fovy, final float aspect, final float zNear, final float zFar) {
final float radians = fovy / 2.0f * PI / 180.0f;
final float deltaZ = zFar - zNear;
final float sine = (float) sin(radians);
if ((deltaZ == 0) || (sine == 0) || (aspect == 0)) {
return;
}
final float cotangent = (float) cos(radians) / sine;
final Matrix4f m = m4f;
m.setIdentity();
m.m00 = cotangent / aspect;
m.m11 = cotangent;
m.m22 = -(zFar + zNear) / deltaZ;
m.m23 = -1.0f;
m.m32 = -2 * zNear * zFar / deltaZ;
m.m33 = 0.0f;
glMultMatrix(m);
}
use of org.lwjgl.util.vector.Matrix4f in project lwjgl by LWJGL.
the class GLMatrix method glMultMatrix.
public static void glMultMatrix(final Matrix4f m) {
final Matrix4f c = getCurrentMatrix();
Matrix4f.mul(c, m, c);
}
use of org.lwjgl.util.vector.Matrix4f in project lwjgl by LWJGL.
the class GLMatrix method glFrustum.
public static void glFrustum(final float l, final float r, final float b, final float t, final float n, final float f) {
final Matrix4f m = m4f;
m.setIdentity();
m.m00 = 2.0f * n / (r - l);
m.m20 = (r + l) / (r - l);
m.m11 = 2.0f * n / (t - b);
m.m21 = (t + b) / (t - b);
m.m22 = -(f + n) / (f - n);
m.m32 = -(2.0f * f * n) / (f - n);
m.m23 = -1.0f;
m.m33 = 0.0f;
glMultMatrix(m);
}
use of org.lwjgl.util.vector.Matrix4f in project lwjgl by LWJGL.
the class GLMatrix method glOrtho.
public static void glOrtho(final float l, final float r, final float b, final float t, final float n, final float f) {
final Matrix4f m = m4f;
m.setIdentity();
m.m00 = 2.0f / (r - l);
m.m30 = -(r + l) / (r - l);
m.m11 = 2.0f / (t - b);
m.m31 = -(t + b) / (t - b);
m.m22 = -2.0f / (f - n);
m.m32 = -(f + n) / (f - n);
glMultMatrix(m);
}
use of org.lwjgl.util.vector.Matrix4f in project lwjgl by LWJGL.
the class GLMatrix method glTranslatef.
public static void glTranslatef(final float x, final float y, final float z) {
final Matrix4f m = getCurrentMatrix();
v3f.set(x, y, z);
m.translate(v3f);
}
Aggregations