/** Rotates the direction and up vector of this camera by the given angle around the given axis. The direction and up vector * will not be orthogonalized. * * @param axis the axis to rotate around * @param angle the angle, in degrees */ public void rotate (Vector3 axis, float angle) { direction.rotate(axis, angle); up.rotate(axis, angle); }
/** Rotates the direction and up vector of this camera by the given angle around the given axis. The direction and up vector * will not be orthogonalized. * * @param axis the axis to rotate around * @param angle the angle, in degrees */ public void rotate (Vector3 axis, float angle) { direction.rotate(axis, angle); up.rotate(axis, angle); }
/** Rotates the direction and up vector of this camera by the given angle around the given axis. The direction and up vector * will not be orthogonalized. * * @param angle the angle * @param axisX the x-component of the axis * @param axisY the y-component of the axis * @param axisZ the z-component of the axis */ public void rotate (float angle, float axisX, float axisY, float axisZ) { direction.rotate(angle, axisX, axisY, axisZ); up.rotate(angle, axisX, axisY, axisZ); }
/** Rotates the direction and up vector of this camera by the given angle around the given axis. The direction and up vector * will not be orthogonalized. * * @param angle the angle * @param axisX the x-component of the axis * @param axisY the y-component of the axis * @param axisZ the z-component of the axis */ public void rotate (float angle, float axisX, float axisY, float axisZ) { direction.rotate(angle, axisX, axisY, axisZ); up.rotate(angle, axisX, axisY, axisZ); }
@Override protected void render (ModelBatch batch, Array<ModelInstance> instances) { final float delta = Gdx.graphics.getDeltaTime(); dirLight.direction.rotate(Vector3.X, delta * 45f); dirLight.direction.rotate(Vector3.Y, delta * 25f); dirLight.direction.rotate(Vector3.Z, delta * 33f); pointLight.position.sub(transformedCenter); pointLight.position.rotate(Vector3.X, delta * 50f); pointLight.position.rotate(Vector3.Y, delta * 13f); pointLight.position.rotate(Vector3.Z, delta * 3f); pointLight.position.add(transformedCenter.set(center).mul(transform)); pLight.worldTransform.setTranslation(pointLight.position); batch.render(pLight); super.render(batch, instances); }
@Override public boolean touchDragged (int screenX, int screenY, int pointer) { float deltaX = -Gdx.input.getDeltaX() * degreesPerPixel; float deltaY = -Gdx.input.getDeltaY() * degreesPerPixel; camera.direction.rotate(camera.up, deltaX); tmp.set(camera.direction).crs(camera.up).nor(); camera.direction.rotate(tmp, deltaY); // camera.up.rotate(tmp, deltaY); return true; }
@Override public boolean touchDragged (int screenX, int screenY, int pointer) { float deltaX = -Gdx.input.getDeltaX() * degreesPerPixel; float deltaY = -Gdx.input.getDeltaY() * degreesPerPixel; camera.direction.rotate(camera.up, deltaX); tmp.set(camera.direction).crs(camera.up).nor(); camera.direction.rotate(tmp, deltaY); // camera.up.rotate(tmp, deltaY); return true; }
/** Rotates the direction and up vector of this camera by the given angle around the given axis, with the axis attached to given * point. The direction and up vector will not be orthogonalized. * * @param point the point to attach the axis to * @param axis the axis to rotate around * @param angle the angle, in degrees */ public void rotateAround (Vector3 point, Vector3 axis, float angle) { tmpVec.set(point); tmpVec.sub(position); translate(tmpVec); rotate(axis, angle); tmpVec.rotate(axis, angle); translate(-tmpVec.x, -tmpVec.y, -tmpVec.z); }
/** Rotates the direction and up vector of this camera by the given angle around the given axis, with the axis attached to given * point. The direction and up vector will not be orthogonalized. * * @param point the point to attach the axis to * @param axis the axis to rotate around * @param angle the angle, in degrees */ public void rotateAround (Vector3 point, Vector3 axis, float angle) { tmpVec.set(point); tmpVec.sub(position); translate(tmpVec); rotate(axis, angle); tmpVec.rotate(axis, angle); translate(-tmpVec.x, -tmpVec.y, -tmpVec.z); }
@Override public void render (Array<ModelInstance> instances) { dirLight.direction.rotate(dirLightRotAxis, Gdx.graphics.getDeltaTime() * 45f); super.render(null); for (ObjectMap.Entry<ModelInstance, AnimationController> e : animationControllers.entries()) e.value.update(Gdx.graphics.getDeltaTime()); shaderBatch.begin(cam); shaderBatch.render(instances, environment); shaderBatch.end(); }
/** Rotates the direction and up vector of this camera by the given angle around the given axis. The direction and up vector * will not be orthogonalized. * * @param angle the angle * @param axisX the x-component of the axis * @param axisY the y-component of the axis * @param axisZ the z-component of the axis */ public void rotate (float angle, float axisX, float axisY, float axisZ) { direction.rotate(angle, axisX, axisY, axisZ); up.rotate(angle, axisX, axisY, axisZ); }
/** Rotates the direction and up vector of this camera by the given angle around the given axis. The direction and up vector * will not be orthogonalized. * * @param axis the axis to rotate around * @param angle the angle, in degrees */ public void rotate (Vector3 axis, float angle) { direction.rotate(axis, angle); up.rotate(axis, angle); }
/** * Spin by angle based on http://ca.answers.yahoo.com/question/index?qid=20100403151916AAbJHxV * * @param angle */ public void rotate(Vector3 axis, float degrees) { for (Vector3 point : points) { point.rotate(axis, degrees); } }
public void rotate(Vector3 axis, float angle) { for (Vector3 v : vertices) { v.rotate(axis, angle); } }
public void rotate(Vector3 axis, float angle, Vector3 origin) { for (Vector3 v : vertices) { v.sub(origin); v.rotate(axis, angle); v.add(origin); } }
/** * Rotate a point around an anchor point based on axis and angle in degrees * @param point * @param anchor * @param axis * @param angleInDegrees */ public static void rotateAround(Vector3 point, Vector3 anchor, Vector3 axis, float angleInDegrees) { point.sub(anchor); point.rotate(axis, angleInDegrees); point.add(anchor); }
@Override public boolean touchDragged (int screenX, int screenY, int pointer) { float deltaX = -Gdx.input.getDeltaX() * degreesPerPixel; float deltaY = -Gdx.input.getDeltaY() * degreesPerPixel; camera.direction.rotate(camera.up, deltaX); tmp.set(camera.direction).crs(camera.up).nor(); camera.direction.rotate(tmp, deltaY); // camera.up.rotate(tmp, deltaY); return true; }
@Override protected void process(int e) { final Pos pos = pm.get(e); cameraSystem.camera.position.x = (int)(pos.xy.x); cameraSystem.camera.position.y = (int)(pos.xy.y); if ( mAngle.has(e)) { cameraSystem.camera.up.set(0, 1, 0).rotate(cameraSystem.camera.direction, -mAngle.get(e).rotation); } cameraSystem.camera.update(); } }
@Override protected void process(int e) { final Pos pos = pm.get(e); cameraSystem.camera.position.x = (int)(pos.xy.x); cameraSystem.camera.position.y = (int)(pos.xy.y); if ( mAngle.has(e)) { cameraSystem.camera.up.set(0, 1, 0).rotate(cameraSystem.camera.direction, -mAngle.get(e).rotation); } cameraSystem.camera.update(); } }