Search in sources :

Example 1 with Frustum

use of au.gov.asd.tac.constellation.utilities.graphics.Frustum in project constellation by constellation-app.

the class AnaglyphCamera method applyLeftFrustum.

public Matrix44f applyLeftFrustum(final Matrix44f mv) {
    final float sep = eyeSeparation / 2F;
    final float top = nearClippingDistance * (float) Math.tan(fovRadians / 2F);
    final float bottom = -top;
    final float a = aspectRatio * (float) Math.tan(fovRadians / 2F) * convergence;
    final float b = a - sep;
    final float c = a + sep;
    final float left = -c * nearClippingDistance / convergence;
    final float right = b * nearClippingDistance / convergence;
    // Set the projection.
    // 
    frustum = new Frustum(fov, aspectRatio, left, right, bottom, top, nearClippingDistance, farClippingDistance);
    // Displace the world to the left.
    translation = new Matrix44f();
    translation.makeTranslationMatrix(-sep, 0, 0);
    Matrix44f t2 = new Matrix44f();
    t2.multiply(mv, translation);
    return t2;
}
Also used : Frustum(au.gov.asd.tac.constellation.utilities.graphics.Frustum) Matrix44f(au.gov.asd.tac.constellation.utilities.graphics.Matrix44f)

Example 2 with Frustum

use of au.gov.asd.tac.constellation.utilities.graphics.Frustum in project constellation by constellation-app.

the class AnaglyphCamera method applyRightFrustum.

public Matrix44f applyRightFrustum(final Matrix44f mv) {
    final float sep = eyeSeparation / 2F;
    final float top = nearClippingDistance * (float) Math.tan(fovRadians / 2F);
    final float bottom = -top;
    final float a = aspectRatio * (float) Math.tan(fovRadians / 2F) * convergence;
    final float b = a - sep;
    final float c = a + sep;
    final float left = -b * nearClippingDistance / convergence;
    final float right = c * nearClippingDistance / convergence;
    // Set the projection.
    // 
    frustum = new Frustum(fov, aspectRatio, left, right, bottom, top, nearClippingDistance, farClippingDistance);
    // Displace the world to the right.
    // 
    translation = new Matrix44f();
    translation.makeTranslationMatrix(sep, 0, 0);
    Matrix44f t2 = new Matrix44f();
    t2.multiply(translation, mv);
    return t2;
}
Also used : Frustum(au.gov.asd.tac.constellation.utilities.graphics.Frustum) Matrix44f(au.gov.asd.tac.constellation.utilities.graphics.Matrix44f)

Aggregations

Frustum (au.gov.asd.tac.constellation.utilities.graphics.Frustum)2 Matrix44f (au.gov.asd.tac.constellation.utilities.graphics.Matrix44f)2