/** 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; }
/** 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); }
/** 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; }
/** 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); }
/** 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); }
/** 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); }
/** 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); }
/** 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); }
/** 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)); }
/** 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); }
/** 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)); }
/** 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); }
/** 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); }
/** 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); }
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(); }
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(); }
@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); }
@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(); }
@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(); }
@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(); }