Java Code Examples for org.joml.Matrix4f#identity()

The following examples show how to use org.joml.Matrix4f#identity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Transformation.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
private Matrix4f updateGenericViewMatrix(Vector3f position, Vector3f rotation, Matrix4f matrix) {
    matrix.identity();
    // First do the rotation so camera rotates over its position
    matrix.rotate((float)Math.toRadians(rotation.x), new Vector3f(1, 0, 0))
            .rotate((float)Math.toRadians(rotation.y), new Vector3f(0, 1, 0));
    // Then do the translation
    matrix.translate(-position.x, -position.y, -position.z);
    return matrix;
}
 
Example 2
Source File: Transformation.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
private Matrix4f updateGenericViewMatrix(Vector3f position, Vector3f rotation, Matrix4f matrix) {
    matrix.identity();
    // First do the rotation so camera rotates over its position
    matrix.rotate((float)Math.toRadians(rotation.x), new Vector3f(1, 0, 0))
            .rotate((float)Math.toRadians(rotation.y), new Vector3f(0, 1, 0));
    // Then do the translation
    matrix.translate(-position.x, -position.y, -position.z);
    return matrix;
}
 
Example 3
Source File: Transformation.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
private Matrix4f updateGenericViewMatrix(Vector3f position, Vector3f rotation, Matrix4f matrix) {
    matrix.identity();
    // First do the rotation so camera rotates over its position
    matrix.rotate((float)Math.toRadians(rotation.x), new Vector3f(1, 0, 0))
            .rotate((float)Math.toRadians(rotation.y), new Vector3f(0, 1, 0));
    // Then do the translation
    matrix.translate(-position.x, -position.y, -position.z);
    return matrix;
}
 
Example 4
Source File: Transformation.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
private Matrix4f updateGenericViewMatrix(Vector3f position, Vector3f rotation, Matrix4f matrix) {
    matrix.identity();
    // First do the rotation so camera rotates over its position
    matrix.rotate((float)Math.toRadians(rotation.x), X_AXIS)
            .rotate((float)Math.toRadians(rotation.y), Y_AXIS);
    // Then do the translation
    matrix.translate(-position.x, -position.y, -position.z);
    return matrix;
}
 
Example 5
Source File: Transformation.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
private Matrix4f updateGenericViewMatrix(Vector3f position, Vector3f rotation, Matrix4f matrix) {
    matrix.identity();
    // First do the rotation so camera rotates over its position
    matrix.rotate((float)Math.toRadians(rotation.x), X_AXIS)
            .rotate((float)Math.toRadians(rotation.y), Y_AXIS);
    // Then do the translation
    matrix.translate(-position.x, -position.y, -position.z);
    return matrix;
}
 
Example 6
Source File: Transformation.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
private Matrix4f updateGenericViewMatrix(Vector3f position, Vector3f rotation, Matrix4f matrix) {
    matrix.identity();
    // First do the rotation so camera rotates over its position
    matrix.rotate((float)Math.toRadians(rotation.x), X_AXIS)
            .rotate((float)Math.toRadians(rotation.y), Y_AXIS);
    // Then do the translation
    matrix.translate(-position.x, -position.y, -position.z);
    return matrix;
}
 
Example 7
Source File: Transformation.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
private Matrix4f updateGenericViewMatrix(Vector3f position, Vector3f rotation, Matrix4f matrix) {
    matrix.identity();
    // First do the rotation so camera rotates over its position
    matrix.rotate((float)Math.toRadians(rotation.x), X_AXIS)
            .rotate((float)Math.toRadians(rotation.y), Y_AXIS);
    // Then do the translation
    matrix.translate(-position.x, -position.y, -position.z);
    return matrix;
}
 
Example 8
Source File: Transform3D.java    From WraithEngine with Apache License 2.0 5 votes vote down vote up
/**
 * Calculates the local matrix for this transform, and stores it in the output
 * matrix parameter.
 *
 * @param out
 *     - The matrix to store the output into.
 */
public void getLocalMatrix(Matrix4f out)
{
    out.identity();
    out.translate(position);
    out.rotate(rotation);
    out.scale(size);
}
 
Example 9
Source File: Transform3D.java    From WraithEngine with Apache License 2.0 5 votes vote down vote up
/**
 * Calculates the local matrix for this transform, and stores it in the output
 * matrix parameter.
 *
 * @param out
 *     - The matrix to store the output into.
 */
public void getLocalMatrix(Matrix4f out)
{
    out.identity();
    out.translate(position);
    out.rotate(rotation);
    out.scale(size);
}