/** * Creates a 4x4 identity matrix * * @return The matrix */ public static float[] createIdentity4x4() { float m[] = new float[16]; setIdentity4x4(m); return m; }
/** * Creates a supplier that provides a 4x4 identity matrix. * * @return The supplier */ private static Supplier<float[]> createIdentitySupplier4x4() { float matrix[] = new float[16]; return () -> { MathUtils.setIdentity4x4(matrix); return matrix; }; }
/** * Fill the given matrix to describe an infinite perspective projection * with the given parameters. * * @param fovyDeg The Field-Of-View, in y-direction, in degrees * @param aspect The aspect ratio * @param zNear The z-value of the near clipping plane * @param m The matrix to fill */ public static void infinitePerspective4x4( float fovyDeg, float aspect, float zNear, float m[]) { setIdentity4x4(m); float fovyRad = (float)Math.toRadians(fovyDeg); float t = (float)Math.tan(0.5 * fovyRad); m[0] = 1.0f / (aspect * t); m[5] = 1.0f / t; m[10] = -1.0f; m[11] = -1.0f; m[14] = 2.0f * zNear; m[15] = 0.0f; }
/** * Fill the given matrix to describe a perspective projection with the * given parameters. * * @param fovyDeg The Field-Of-View, in y-direction, in degrees * @param aspect The aspect ratio * @param zNear The z-value of the near clipping plane * @param zFar The z-value of the far clipping plane * @param m The matrix to fill */ public static void perspective4x4( float fovyDeg, float aspect, float zNear, float zFar, float m[]) { setIdentity4x4(m); float fovyRad = (float)Math.toRadians(fovyDeg); float t = (float)Math.tan(0.5 * fovyRad); m[0] = 1.0f / (aspect * t); m[5] = 1.0f / t; m[10] = (zFar + zNear) / (zNear - zFar); m[11] = -1.0f; m[14] = 2.0f * zFar * zNear / (zNear - zFar); m[15] = 0.0f; }
MathUtils.setIdentity4x4(transform); return transform; };
+ ", returning identity"); setIdentity4x4(inv); return;
/** * Compute the global transform for the given {@link NodeModel}, * and store it in the given result. If the given result is * <code>null</code> or does not have a length of 16, then * a new array will be created and returned. * * @param nodeModel The {@link NodeModel} * @param result The result * @return The result */ private static float[] computeGlobalTransform( NodeModel nodeModel, float result[]) { float localResult[] = Utils.validate(result, 16); float tempLocalTransform[] = TEMP_MATRIX_4x4_IN_GLOBAL.get(); NodeModel currentNode = nodeModel; MathUtils.setIdentity4x4(localResult); while (currentNode != null) { currentNode.computeLocalTransform(tempLocalTransform); MathUtils.mul4x4( tempLocalTransform, localResult, localResult); currentNode = currentNode.getParent(); } return localResult; }
MathUtils.setIdentity4x4(viewMatrix); return viewMatrix;
MathUtils.setIdentity4x4(projectionMatrix); return projectionMatrix;
MathUtils.setIdentity4x4(localResult); if (nodeModel.getTranslation() != null) MathUtils.setIdentity4x4(m); m[ 0] = s[0]; m[ 5] = s[1];
float zNear = cameraOrthographic.getZnear(); float zFar = cameraOrthographic.getZfar(); MathUtils.setIdentity4x4(localResult); localResult[0] = 1.0f / xMag; localResult[5] = 1.0f / yMag; MathUtils.setIdentity4x4(localResult);
float zNear = cameraOrthographic.getZnear(); float zFar = cameraOrthographic.getZfar(); MathUtils.setIdentity4x4(localResult); localResult[0] = 1.0f / xMag; localResult[5] = 1.0f / yMag; MathUtils.setIdentity4x4(localResult);