Search in sources :

Example 11 with Matrix4f

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);
}
Also used : Matrix4f(org.lwjgl.util.vector.Matrix4f)

Example 12 with Matrix4f

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);
}
Also used : Matrix4f(org.lwjgl.util.vector.Matrix4f)

Example 13 with Matrix4f

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);
}
Also used : Matrix4f(org.lwjgl.util.vector.Matrix4f)

Example 14 with Matrix4f

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);
}
Also used : Matrix4f(org.lwjgl.util.vector.Matrix4f)

Example 15 with Matrix4f

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);
}
Also used : Matrix4f(org.lwjgl.util.vector.Matrix4f)

Aggregations

Matrix4f (org.lwjgl.util.vector.Matrix4f)29 Vector3f (org.lwjgl.util.vector.Vector3f)12 FloatBuffer (java.nio.FloatBuffer)4 Vector2f (org.lwjgl.util.vector.Vector2f)2 Vector4f (org.lwjgl.util.vector.Vector4f)2 GuiRectangle (betterquesting.api2.client.gui.misc.GuiRectangle)1 IGuiRect (betterquesting.api2.client.gui.misc.IGuiRect)1 InterfaceTexture (com.chrisali.javaflightsim.lwjgl.interfaces.ui.InterfaceTexture)1 Particle (com.chrisali.javaflightsim.lwjgl.particles.Particle)1 ParticleTexture (com.chrisali.javaflightsim.lwjgl.particles.ParticleTexture)1 WaterTile (com.chrisali.javaflightsim.lwjgl.water.WaterTile)1 ArabicShapingException (com.ibm.icu.text.ArabicShapingException)1 IOException (java.io.IOException)1 Random (java.util.Random)1 CelestialBodyRenderEvent (micdoodle8.mods.galacticraft.api.event.client.CelestialBodyRenderEvent)1 ScaledResolution (net.minecraft.client.gui.ScaledResolution)1