当前位置: 首页>>代码示例>>Java>>正文


Java Matrix4.rotate方法代码示例

本文整理汇总了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);
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:24,代码来源:SpinEffect.java

示例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;
   }
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:22,代码来源:Utils.java

示例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);
   }
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:13,代码来源:Utils.java

示例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);
   }
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:13,代码来源:Utils.java

示例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);
   }
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:13,代码来源:Utils.java


注:本文中的com.badlogic.gdx.math.Matrix4.rotate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。