fix(rendering): fix move and moveTo method behavior
@@ -9,7 +9,7 @@ public class FreeCamera implements Camera {
private final Vector3f position = new Vector3f();
private final Vector3f lookAt = new Vector3f();
- private final Vector3f frontVector = new Vector3f();
+ private final Vector3f front = new Vector3f();
private final Matrix4f viewMatrix = new Matrix4f();
private ChangeListener changeListener;
@@ -18,32 +18,32 @@ public class FreeCamera implements Camera {
this(new Vector3f(0, 0, 0), new Vector3f(0, 0, -1));
}
- public FreeCamera(Vector3fc position, Vector3fc frontVector) {
- look(position, frontVector);
+ public FreeCamera(Vector3fc position, Vector3fc front) {
+ look(position, front);
}
- public void look(Vector3fc position, Vector3fc frontVector) {
+ public void look(Vector3fc position, Vector3fc front) {
this.position.set(position);
- this.frontVector.set(frontVector);
- this.lookAt.set(position).add(frontVector);
+ this.front.set(front);
+ this.lookAt.set(position).add(front);
this.viewMatrix.setLookAt(this.position, this.lookAt, UP_VECTOR);
if (changeListener != null) changeListener.onChanged(this);
}
public void lookAt(Vector3fc position, Vector3fc lookAt) {
this.position.set(position);
- this.frontVector.set(lookAt).sub(position);
+ this.front.set(lookAt).sub(position);
this.lookAt.set(lookAt);
this.viewMatrix.setLookAt(this.position, this.lookAt, UP_VECTOR);
if (changeListener != null) changeListener.onChanged(this);
}
public void move(Vector3fc offset) {
- lookAt(this.position.add(offset), this.lookAt);
+ look(this.position.add(offset), this.front);
}
public void moveTo(Vector3fc position) {
- lookAt(position, this.lookAt);
+ look(position, this.front);
}
@Override
@@ -58,7 +58,7 @@ public class FreeCamera implements Camera {
@Override
public Vector3fc getFront() {
- return frontVector;
+ return front;
}
@Override
