本文整理汇总了Java中com.badlogic.gdx.math.Matrix4.rotate方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4.rotate方法的具体用法?Java Matrix4.rotate怎么用?Java Matrix4.rotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.math.Matrix4
的用法示例。
在下文中一共展示了Matrix4.rotate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
@Override
public void draw(Batch batch) {
age += Gdx.graphics.getDeltaTime();
final float progress = age * INV_LIFETIME;
final float currentSize = Interpolation.pow2In.apply(size, 0, progress);
final float currentRotation = Interpolation.sine.apply(0, TOTAL_ROTATION, progress);
final Matrix4 original = batch.getTransformMatrix().cpy();
final Matrix4 rotated = batch.getTransformMatrix();
final float disp =
+ 0.5f * (size - currentSize) // the smaller, the more we need to "push" to center
+ currentSize * 0.5f; // center the cell for rotation
rotated.translate(pos.x + disp, pos.y + disp, 0);
rotated.rotate(0, 0, 1, currentRotation);
rotated.translate(currentSize * -0.5f, currentSize * -0.5f, 0); // revert centering for rotation
batch.setTransformMatrix(rotated);
Cell.draw(color, batch, 0, 0, currentSize);
batch.setTransformMatrix(original);
}
示例2: createRotate
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
/**
* Create new Matrix that rotate around three axis-x, axis-y, axis-z in
* value of x, y, z parameters from the existing Matrix: matrixToRotate
* matrixToRotate will not be changed. The value of parameter is in degree
*
* @param x
* @param y
* @param z
* @param matrixToRotate
* @return
*/
public static Matrix4 createRotate(float x, float y, float z,
Matrix4 matrixToRotate) {
Matrix4 mx1 = matrixToRotate.rotate(1, 0, 0, x);
Matrix4 mx2 = matrixToRotate.rotate(0, 1, 0, y);
Matrix4 mx3 = matrixToRotate.rotate(0, 0, 1, z);
Matrix4 matrix = new Matrix4(mulMatrix(mx3, mx2));
Matrix4 finalMatrix = new Matrix4(mulMatrix(matrix, mx1));
return finalMatrix;
}
示例3: createRotateX
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
/**
* Create completely new Matrix that rotate around axis-x, value of input
* parameter is in Degree
*
* @param angle
* Angle to rotate
* @return
*/
public static Matrix4 createRotateX(float angle) {
Matrix4 mx = new Matrix4();
return mx.rotate(1, 0, 0, angle);
}
示例4: createRotateY
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
/**
* Create completely new Matrix that rotate around axis-y, value of input
* parameter is in Degree
*
* @param angle
* Angle to rotate
* @return
*/
public static Matrix4 createRotateY(float angle) {
Matrix4 mx = new Matrix4();
return mx.rotate(0, 1, 0, angle);
}
示例5: createRotateZ
import com.badlogic.gdx.math.Matrix4; //导入方法依赖的package包/类
/**
* Create completely new Matrix that rotate around axis-z, value of input
* parameter is in Degree
*
* @param angle
* Angle to rotate
* @return
*/
public static Matrix4 createRotateZ(float angle) {
Matrix4 mx = new Matrix4();
return mx.rotate(0, 0, 1, angle);
}