feat(rendering): update FixedCamera
@@ -7,21 +7,34 @@ import org.joml.Vector3fc;
public class FixedCamera implements Camera {
- private final Vector3fc position;
- private final Vector3fc lookAt;
- private final Vector3fc frontVector;
- private final Matrix4fc viewMatrix;
+ private Vector3fc position;
+ private Vector3fc lookAt;
+ private Vector3fc frontVector;
+ private Matrix4fc viewMatrix;
+
+ public FixedCamera() {
+ }
public FixedCamera(Vector3fc position, Vector3fc frontVector) {
+ look(position, frontVector);
+ }
+
+ public void look(Vector3fc position, Vector3fc frontVector) {
this.position = position;
this.frontVector = frontVector;
this.lookAt = position.add(frontVector, new Vector3f());
this.viewMatrix = new Matrix4f().lookAt(this.position, this.lookAt, UP_VECTOR);
}
+ public void lookAt(Vector3fc position, Vector3fc lookAt) {
+ this.position = position;
+ this.frontVector = lookAt.sub(position, new Vector3f());
+ this.lookAt = lookAt;
+ this.viewMatrix = new Matrix4f().lookAt(this.position, this.lookAt, UP_VECTOR);
+ }
+
@Override
public void update(float partial) {
-
}
@Override
