List of usage examples for com.badlogic.gdx.math Matrix4 M00
int M00
To view the source code for com.badlogic.gdx.math Matrix4 M00.
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 . j a v a 2 s . c o 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;/*from w w w. j a v a2 s. co m*/ 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 preRotate(Float angle, Float px, Float py) { // ## native android ## // const SkScalar oneMinusCosV = 1 - cosV; ////from ww w . j av a 2 s .c o m // fMat[kMScaleX] = cosV; // fMat[kMSkewX] = -sinV; // fMat[kMTransX] = sdot(sinV, py, oneMinusCosV, px); // // fMat[kMSkewY] = sinV; // fMat[kMScaleY] = cosV; // fMat[kMTransY] = sdot(-sinV, px, oneMinusCosV, py); // // fMat[kMPersp0] = fMat[kMPersp1] = 0; // fMat[kMPersp2] = 1; Matrix4 m = new Matrix4(); m.rotate(0, 0, 1, angle); float oneMinusCosV = 1 - m.val[Matrix4.M00]; float sinV = m.val[Matrix4.M10]; m.val[Matrix4.M03] = sdot(sinV, py, oneMinusCosV, px); m.val[Matrix4.M13] = sdot(-sinV, px, oneMinusCosV, py); this.matrix4.mul(m); }
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 ww w. j av a 2 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 ww . j a va 2 s . 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 w w . j a va 2 s. c om*/ 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(); }