本文整理了Java中com.badlogic.gdx.math.Matrix4.rotate()
方法的一些代码示例,展示了Matrix4.rotate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix4.rotate()
方法的具体详情如下:
包路径:com.badlogic.gdx.math.Matrix4
类名称:Matrix4
方法名:rotate
[英]Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x glTranslate/glRotate/glScale
[中]将该矩阵乘以(逆时针)旋转矩阵。OpenGL ES'1也使用了后期复制。GLX平移/glRotate/glScale
代码示例来源:origin: libgdx/libgdx
/** Multiplies the current transformation matrix by a rotation matrix. */
public void rotate (float axisX, float axisY, float axisZ, float degrees) {
transformMatrix.rotate(axisX, axisY, axisZ, degrees);
matrixDirty = true;
}
代码示例来源:origin: libgdx/libgdx
/** Post-multiplies the current transformation with a rotation matrix by the given angle around the given axis.
* @param axis the rotation axis
* @param angle the rotation angle in degrees */
public void rotate (Vector3 axis, float angle) {
this.transform.rotate(axis, angle);
}
代码示例来源:origin: libgdx/libgdx
/** Multiplies the current transformation matrix by a rotation matrix. */
public void rotate (float axisX, float axisY, float axisZ, float degrees) {
transformMatrix.rotate(axisX, axisY, axisZ, degrees);
matrixDirty = true;
}
代码示例来源:origin: libgdx/libgdx
/** Post-multiplies the current transformation with a rotation matrix by the given angle around the given axis.
* @param axis the rotation axis
* @param angle the rotation angle in degrees */
public void rotate (Vector3 axis, float angle) {
this.transform.rotate(axis, angle);
}
代码示例来源:origin: libgdx/libgdx
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x
* glTranslate/glRotate/glScale
* @param axisX The x-axis component of the vector to rotate around.
* @param axisY The y-axis component of the vector to rotate around.
* @param axisZ The z-axis component of the vector to rotate around.
* @param radians The angle in radians
* @return This matrix for the purpose of chaining methods together. */
public Matrix4 rotateRad (float axisX, float axisY, float axisZ, float radians) {
if (radians == 0) return this;
quat.setFromAxisRad(axisX, axisY, axisZ, radians);
return rotate(quat);
}
代码示例来源:origin: libgdx/libgdx
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x
* glTranslate/glRotate/glScale
* @param axisX The x-axis component of the vector to rotate around.
* @param axisY The y-axis component of the vector to rotate around.
* @param axisZ The z-axis component of the vector to rotate around.
* @param radians The angle in radians
* @return This matrix for the purpose of chaining methods together. */
public Matrix4 rotateRad (float axisX, float axisY, float axisZ, float radians) {
if (radians == 0) return this;
quat.setFromAxisRad(axisX, axisY, axisZ, radians);
return rotate(quat);
}
代码示例来源:origin: libgdx/libgdx
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x
* glTranslate/glRotate/glScale.
*
* @param axis The vector axis to rotate around.
* @param radians The angle in radians.
* @return This matrix for the purpose of chaining methods together. */
public Matrix4 rotateRad (Vector3 axis, float radians) {
if (radians == 0) return this;
quat.setFromAxisRad(axis, radians);
return rotate(quat);
}
代码示例来源:origin: libgdx/libgdx
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x
* glTranslate/glRotate/glScale
* @param axisX The x-axis component of the vector to rotate around.
* @param axisY The y-axis component of the vector to rotate around.
* @param axisZ The z-axis component of the vector to rotate around.
* @param degrees The angle in degrees
* @return This matrix for the purpose of chaining methods together. */
public Matrix4 rotate (float axisX, float axisY, float axisZ, float degrees) {
if (degrees == 0) return this;
quat.setFromAxis(axisX, axisY, axisZ, degrees);
return rotate(quat);
}
代码示例来源:origin: libgdx/libgdx
/** Postmultiplies this matrix by the rotation between two vectors.
* @param v1 The base vector
* @param v2 The target vector
* @return This matrix for the purpose of chaining methods together */
public Matrix4 rotate (final Vector3 v1, final Vector3 v2) {
return rotate(quat.setFromCross(v1, v2));
}
代码示例来源:origin: libgdx/libgdx
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x
* glTranslate/glRotate/glScale.
*
* @param axis The vector axis to rotate around.
* @param degrees The angle in degrees.
* @return This matrix for the purpose of chaining methods together. */
public Matrix4 rotate (Vector3 axis, float degrees) {
if (degrees == 0) return this;
quat.set(axis, degrees);
return rotate(quat);
}
代码示例来源:origin: libgdx/libgdx
/** Postmultiplies this matrix by the rotation between two vectors.
* @param v1 The base vector
* @param v2 The target vector
* @return This matrix for the purpose of chaining methods together */
public Matrix4 rotate (final Vector3 v1, final Vector3 v2) {
return rotate(quat.setFromCross(v1, v2));
}
代码示例来源:origin: libgdx/libgdx
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x
* glTranslate/glRotate/glScale.
*
* @param axis The vector axis to rotate around.
* @param degrees The angle in degrees.
* @return This matrix for the purpose of chaining methods together. */
public Matrix4 rotate (Vector3 axis, float degrees) {
if (degrees == 0) return this;
quat.set(axis, degrees);
return rotate(quat);
}
代码示例来源:origin: libgdx/libgdx
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x
* glTranslate/glRotate/glScale.
*
* @param axis The vector axis to rotate around.
* @param radians The angle in radians.
* @return This matrix for the purpose of chaining methods together. */
public Matrix4 rotateRad (Vector3 axis, float radians) {
if (radians == 0) return this;
quat.setFromAxisRad(axis, radians);
return rotate(quat);
}
代码示例来源:origin: libgdx/libgdx
/** Postmultiplies this matrix with a (counter-clockwise) rotation matrix. Postmultiplication is also used by OpenGL ES' 1.x
* glTranslate/glRotate/glScale
* @param axisX The x-axis component of the vector to rotate around.
* @param axisY The y-axis component of the vector to rotate around.
* @param axisZ The z-axis component of the vector to rotate around.
* @param degrees The angle in degrees
* @return This matrix for the purpose of chaining methods together. */
public Matrix4 rotate (float axisX, float axisY, float axisZ, float degrees) {
if (degrees == 0) return this;
quat.setFromAxis(axisX, axisY, axisZ, degrees);
return rotate(quat);
}
代码示例来源:origin: libgdx/libgdx
private void init () {
// create the isometric transform
isoTransform = new Matrix4();
isoTransform.idt();
// isoTransform.translate(0, 32, 0);
isoTransform.scale((float)(Math.sqrt(2.0) / 2.0), (float)(Math.sqrt(2.0) / 4.0), 1.0f);
isoTransform.rotate(0.0f, 0.0f, 1.0f, -45);
// ... and the inverse matrix
invIsotransform = new Matrix4(isoTransform);
invIsotransform.inv();
}
代码示例来源:origin: libgdx/libgdx
private void init () {
// create the isometric transform
isoTransform = new Matrix4();
isoTransform.idt();
// isoTransform.translate(0, 32, 0);
isoTransform.scale((float)(Math.sqrt(2.0) / 2.0), (float)(Math.sqrt(2.0) / 4.0), 1.0f);
isoTransform.rotate(0.0f, 0.0f, 1.0f, -45);
// ... and the inverse matrix
invIsotransform = new Matrix4(isoTransform);
invIsotransform.inv();
}
代码示例来源:origin: libgdx/libgdx
@Override
protected void onLoaded () {
if (currentlyLoading == null || currentlyLoading.length() == 0) return;
final ModelInstance instance = new ModelInstance(assets.get(currentlyLoading, Model.class));
instance.transform = new Matrix4().idt();
instance.transform.setToTranslation(MathUtils.random(-10, 10), MathUtils.random(-10, 10), MathUtils.random(-10, 10));
instance.transform.rotate(Vector3.X, MathUtils.random(-180, 180));
instance.transform.rotate(Vector3.Y, MathUtils.random(-180, 180));
instance.transform.rotate(Vector3.Z, MathUtils.random(-180, 180));
instances.add(instance);
}
代码示例来源:origin: libgdx/libgdx
@Override
public void render () {
movingBox.transform.val[Matrix4.M03] = movingBox.transform.val[Matrix4.M13] = movingBox.transform.val[Matrix4.M23] = 0f;
movingBox.transform.rotate(Vector3.Y, Gdx.graphics.getDeltaTime() * 45f);
movingBox.transform.translate(-5f, 1f, 0f);
movingBox.body.setWorldTransform(movingBox.transform);
super.render();
}
代码示例来源:origin: libgdx/libgdx
@Override
public void render () {
counter = (counter + Gdx.graphics.getDeltaTime()) % 1.f;
blendingAttribute.opacity = 0.25f + Math.abs(0.5f - counter);
Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
modelInstance.transform.rotate(Vector3.Y, 30 * Gdx.graphics.getDeltaTime());
modelBatch.begin(camera);
modelBatch.render(background);
modelBatch.render(modelInstance, environment);
modelBatch.end();
}
代码示例来源:origin: libgdx/libgdx
@Override
public void render () {
counter = (counter + Gdx.graphics.getDeltaTime()) % 1.f;
blendingAttribute.opacity = 0.25f + Math.abs(0.5f - counter);
Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
modelInstance.transform.rotate(Vector3.Y, 30 * Gdx.graphics.getDeltaTime());
modelBatch.begin(camera);
modelBatch.render(background);
modelBatch.render(modelInstance);
modelBatch.end();
}
内容来源于网络,如有侵权,请联系作者删除!