List of usage examples for com.badlogic.gdx.math Matrix4 M21
int M21
To view the source code for com.badlogic.gdx.math Matrix4 M21.
Click Source Link
From source file:CB_UI_Base.graphics.GL_Matrix.java
License:Open Source License
@Override public void setValues(float[] fs) { matrix4.val[Matrix4.M00] = fs[0]; matrix4.val[Matrix4.M01] = fs[1]; matrix4.val[Matrix4.M03] = fs[2]; matrix4.val[Matrix4.M10] = fs[3]; matrix4.val[Matrix4.M11] = fs[4]; matrix4.val[Matrix4.M13] = fs[5]; matrix4.val[Matrix4.M20] = fs[6]; matrix4.val[Matrix4.M21] = fs[7]; matrix4.val[Matrix4.M22] = fs[8]; }
From source file:CB_UI_Base.graphics.GL_Matrix.java
License:Open Source License
@Override public void getValues(float[] mValues) { mValues[0] = matrix4.val[Matrix4.M00]; mValues[1] = matrix4.val[Matrix4.M01]; mValues[2] = matrix4.val[Matrix4.M03]; mValues[3] = matrix4.val[Matrix4.M10]; mValues[4] = matrix4.val[Matrix4.M11]; mValues[5] = matrix4.val[Matrix4.M13]; mValues[6] = matrix4.val[Matrix4.M20]; mValues[7] = matrix4.val[Matrix4.M21]; mValues[8] = matrix4.val[Matrix4.M22]; }
From source file:CB_UI_Base.graphics.GL_Matrix.java
License:Open Source License
@Override public String toString() { return "[" + this.matrix4.val[Matrix4.M00] + "|" + this.matrix4.val[Matrix4.M01] + "|" + this.matrix4.val[Matrix4.M03] + "]\n" + "[" + this.matrix4.val[Matrix4.M10] + "|" + this.matrix4.val[Matrix4.M11] + "|" + this.matrix4.val[Matrix4.M13] + "]\n" + "[" + this.matrix4.val[Matrix4.M20] + "|" + this.matrix4.val[Matrix4.M21] + "|" + this.matrix4.val[Matrix4.M22] + "]"; }
From source file:gaia.cu9.ari.gaiaorbit.util.g3d.MeshBuilder2.java
License:Apache License
@Override public void arrow(float x1, float y1, float z1, float x2, float y2, float z2, float capLength, float stemThickness, int divisions) { Vector3 begin = tmp(x1, y1, z1), end = tmp(x2, y2, z2); float length = begin.dst(end); float coneHeight = length * capLength; float coneDiameter = 2 * (float) (coneHeight * Math.sqrt(1f / 3)); float stemLength = length - coneHeight; float stemDiameter = coneDiameter * stemThickness; Vector3 up = tmp(end).sub(begin).nor(); Vector3 forward = tmp(up).crs(Vector3.Z); if (forward.isZero()) forward.set(Vector3.X);/* w ww .j a v a 2 s . c o m*/ forward.crs(up).nor(); Vector3 left = tmp(up).crs(forward).nor(); Vector3 direction = tmp(end).sub(begin).nor(); // Matrices Matrix4 userTransform = getVertexTransform(tmp()); Matrix4 transform = tmp(); float[] val = transform.val; val[Matrix4.M00] = left.x; val[Matrix4.M01] = up.x; val[Matrix4.M02] = forward.x; val[Matrix4.M10] = left.y; val[Matrix4.M11] = up.y; val[Matrix4.M12] = forward.y; val[Matrix4.M20] = left.z; val[Matrix4.M21] = up.z; val[Matrix4.M22] = forward.z; Matrix4 temp = tmp(); // Stem transform.setTranslation(tmp(direction).scl(stemLength / 2).add(x1, y1, z1)); setVertexTransform(temp.set(transform).mul(userTransform)); cylinder(stemDiameter, stemLength, stemDiameter, divisions); // Cap transform.setTranslation(tmp(direction).scl(stemLength).add(x1, y1, z1)); setVertexTransform(temp.set(transform).mul(userTransform)); cone(coneDiameter, coneHeight, coneDiameter, divisions); setVertexTransform(userTransform); cleanup(); }
From source file:MeshBoneUtil.dualQuat.java
License:Open Source License
public void convertToMat(Matrix4 m) { float cur_length = (float) real.dot(real); float w = (float) real.w, x = (float) real.x, y = (float) real.y, z = (float) real.z; float t0 = (float) imaginary.w, t1 = (float) imaginary.x, t2 = (float) imaginary.y, t3 = (float) imaginary.z; m.val[Matrix4.M01] = w * w + x * x - y * y - z * z; m.val[Matrix4.M02] = 2 * x * y - 2 * w * z; m.val[Matrix4.M03] = 2 * x * z + 2 * w * y; m.val[Matrix4.M11] = 2 * x * y + 2 * w * z; m.val[Matrix4.M12] = w * w + y * y - x * x - z * z; m.val[Matrix4.M13] = 2 * y * z - 2 * w * x; m.val[Matrix4.M21] = 2 * x * z - 2 * w * y; m.val[Matrix4.M22] = 2 * y * z + 2 * w * x; m.val[Matrix4.M23] = w * w + z * z - x * x - y * y; m.val[Matrix4.M31] = -2 * t0 * x + 2 * w * t1 - 2 * t2 * z + 2 * y * t3; m.val[Matrix4.M32] = -2 * t0 * y + 2 * t1 * z - 2 * x * t3 + 2 * w * t2; m.val[Matrix4.M33] = -2 * t0 * z + 2 * x * t2 + 2 * w * t3 - 2 * t1 * y; // ??/*from w w w . ja v a 2 s .com*/ m.val[Matrix4.M03] = 0; m.val[Matrix4.M13] = 0; m.val[Matrix4.M23] = 0; m.val[Matrix4.M33] = cur_length; for (int i = 0; i < 16; i++) { m.val[i] /= cur_length; } //m /= cur_length; }
From source file:ve.ucv.ciens.ccg.nxtar.graphics.CustomPerspectiveCamera.java
License:Apache License
public void setCustomARProjectionMatrix(final float focalPointX, final float focalPointY, final float cameraCenterX, final float cameraCenterY, final float near, final float far, final float w, final float h) { final float FAR_PLUS_NEAR = far + near; final float FAR_LESS_NEAR = far - near; projection.val[Matrix4.M00] = -2.0f * focalPointX / w; projection.val[Matrix4.M10] = 0.0f; projection.val[Matrix4.M20] = 0.0f; projection.val[Matrix4.M30] = 0.0f; projection.val[Matrix4.M01] = 0.0f; projection.val[Matrix4.M11] = 2.0f * focalPointY / h; projection.val[Matrix4.M21] = 0.0f; projection.val[Matrix4.M31] = 0.0f; projection.val[Matrix4.M02] = 2.0f * cameraCenterX / w - 1.0f; projection.val[Matrix4.M12] = 2.0f * cameraCenterY / h - 1.0f; projection.val[Matrix4.M22] = -FAR_PLUS_NEAR / FAR_LESS_NEAR; projection.val[Matrix4.M32] = -1.0f; projection.val[Matrix4.M03] = 0.0f; projection.val[Matrix4.M13] = 0.0f; projection.val[Matrix4.M23] = -2.0f * far * near / FAR_LESS_NEAR; projection.val[Matrix4.M33] = 0.0f; }
From source file:ve.ucv.ciens.ccg.nxtar.systems.GeometrySystem.java
License:Apache License
private void applyWorldTransform(ModelInstance model, GeometryComponent geometry) { translationMatrix.setToTranslation(geometry.position); rotationMatrix.val[Matrix4.M00] = geometry.rotation.val[0]; rotationMatrix.val[Matrix4.M10] = geometry.rotation.val[1]; rotationMatrix.val[Matrix4.M20] = geometry.rotation.val[2]; rotationMatrix.val[Matrix4.M30] = 0; rotationMatrix.val[Matrix4.M01] = geometry.rotation.val[3]; rotationMatrix.val[Matrix4.M11] = geometry.rotation.val[4]; rotationMatrix.val[Matrix4.M21] = geometry.rotation.val[5]; rotationMatrix.val[Matrix4.M31] = 0; rotationMatrix.val[Matrix4.M02] = geometry.rotation.val[6]; rotationMatrix.val[Matrix4.M12] = geometry.rotation.val[7]; rotationMatrix.val[Matrix4.M22] = geometry.rotation.val[8]; rotationMatrix.val[Matrix4.M32] = 0; rotationMatrix.val[Matrix4.M03] = 0; rotationMatrix.val[Matrix4.M13] = 0; rotationMatrix.val[Matrix4.M23] = 0; rotationMatrix.val[Matrix4.M33] = 1; scalingMatrix.setToScaling(geometry.scaling); model.transform.idt().mul(translationMatrix).mul(rotationMatrix).mul(scalingMatrix); model.calculateTransforms();// w ww .j a v a 2 s. co m }