Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent loss of precision in OrthographicCamera.update #7255

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion gdx/src/com/badlogic/gdx/graphics/OrthographicCamera.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public OrthographicCamera (float viewportWidth, float viewportHeight) {
}

private final Vector3 tmp = new Vector3();
private final Matrix4 tmpMat = new Matrix4();

@Override
public void update () {
Expand All @@ -55,7 +56,8 @@ public void update () {
public void update (boolean updateFrustum) {
projection.setToOrtho(zoom * -viewportWidth / 2, zoom * (viewportWidth / 2), zoom * -(viewportHeight / 2),
zoom * viewportHeight / 2, near, far);
view.setToLookAt(position, tmp.set(position).add(direction), up);
view.setToLookAt(direction, up);
view.mul(tmpMat.setToTranslation(-position.x, -position.y, -position.z));
combined.set(projection);
Matrix4.mul(combined.val, view.val);

Expand Down