List of usage examples for com.badlogic.gdx.math Matrix4 M11
int M11
To view the source code for com.badlogic.gdx.math Matrix4 M11.
Click Source Link
From source file:CB_UI_Base.graphics.GL_Matrix.java
License:Open Source License
/** * Preconcats the matrix with the specified scale. M' = M * S(sx, sy, px, py) */// w w w . ja v a 2s . co m @Override public void preScale(float sx, float sy, float px, float py) { Matrix4 m = new Matrix4(); // set Scale sx,sy,px,py { m.val[Matrix4.M00] = sx; m.val[Matrix4.M11] = sy; m.val[Matrix4.M03] = px - sx * px; m.val[Matrix4.M13] = py - sy * py; } this.matrix4.mul(m); }
From source file:CB_UI_Base.graphics.GL_Matrix.java
License:Open Source License
@Override public void mapPoints(float[] src) { float[] dst = new float[src.length]; for (int i = 0; i * 2 < src.length; i++) { int j = i * 2; float x = src[j] * matrix4.val[Matrix4.M00] + src[j + 1] * matrix4.val[Matrix4.M01] + matrix4.val[Matrix4.M03]; float y = src[j] * matrix4.val[Matrix4.M10] + src[j + 1] * matrix4.val[Matrix4.M11] + matrix4.val[Matrix4.M13]; dst[j] = x;//ww w . jav a 2 s . c om dst[j + 1] = y; } System.arraycopy(dst, 0, src, 0, src.length); }
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:CB_UI_Base.graphics.GL_Matrix.java
License:Open Source License
public static void MapPoints(float[] values, Matrix4 matrix4) { int index = 0; while (index < values.length) { float x0 = values[index] * matrix4.val[Matrix4.M00] + values[index + 1] * matrix4.val[Matrix4.M01] + matrix4.val[Matrix4.M03]; float y0 = values[index] * matrix4.val[Matrix4.M10] + values[index + 1] * matrix4.val[Matrix4.M11] + matrix4.val[Matrix4.M13]; values[index] = x0;//from www . j a v a2 s . c om values[index + 1] = y0; index += 2; } }
From source file:CB_UI_Base.graphics.GL_Matrix.java
License:Open Source License
public static void MapPoint(float x, float y, Matrix4 matrix4, float[] mapedPoint) { mapedPoint[0] = x * matrix4.val[Matrix4.M00] + y * matrix4.val[Matrix4.M01] + matrix4.val[Matrix4.M03]; mapedPoint[1] = x * matrix4.val[Matrix4.M10] + y * matrix4.val[Matrix4.M11] + matrix4.val[Matrix4.M13]; }
From source file:com.box2dLight.box2dLight.RayHandler.java
License:Apache License
/** Set combined camera matrix. Matrix will be copied and used for rendering lights, culling. Matrix must be set to work in * box2d coordinates. Matrix has to be updated every frame(if camera is changed) * //from w w w . jav a 2s . c o m * * NOTE: Matrix4 is assumed to be orthogonal for culling and directional lights. * * If any problems detected Use: [public void setCombinedMatrix(Matrix4 combined, float x, float y, float viewPortWidth, float * viewPortHeight)] Instead * * * @param combined matrix that include projection and translation matrices */ public void setCombinedMatrix(Matrix4 combined) { System.arraycopy(combined.val, 0, this.combined.val, 0, 16); // updateCameraCorners float invWidth = combined.val[Matrix4.M00]; final float halfViewPortWidth = 1f / invWidth; final float x = -halfViewPortWidth * combined.val[Matrix4.M03]; x1 = x - halfViewPortWidth; x2 = x + halfViewPortWidth; float invHeight = combined.val[Matrix4.M11]; final float halfViewPortHeight = 1f / invHeight; final float y = -halfViewPortHeight * combined.val[Matrix4.M13]; y1 = y - halfViewPortHeight; y2 = y + halfViewPortHeight; }
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 . ja va 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; // ??/* w w w. j a v a 2s . c o m*/ 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; }