MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / Camera

Class Camera

src/main/java/field/graphics/Camera.java:20–467  ·  view source on GitHub ↗

A (Perspective and stereo capable) Camera class for Field graphics. The state of a camera is kept in a separate, serializable, immutable class called "state". In contemporary OpenGL all a camera is is something that can produce two Mat4's which were customarily multiplied together anyway. The vi

Source from the content-addressed store, hash-verified

18 * <p>
19 * To tie this to OpenGL, conspire to load these matrices into shader uniforms.
20 */
21public class Camera {
22
23
24 // inglorious vr hack
25 static public float cameraScale = 1f;
26
27 public void setCameraScale(float cameraScale) {
28 Camera.cameraScale = cameraScale;
29 }
30
31 static public class State implements Serializable_safe {
32
33 static final long serialVersionUID = -3003261492097861789L;
34
35 /**
36 * the position of the camera
37 */
38 public Vec3 position = new Vec3(0, 0, -10);
39
40 /**
41 * the target or lookAt position of the camera
42 */
43 public Vec3 target = new Vec3(0, 0, 0);
44
45 /**
46 * the up direction of the camera
47 */
48 public Vec3 up = new Vec3(0, 1, 0);
49
50 /**
51 * the field of view of the camera (in degrees)
52 */
53 public float fov = 45;
54
55 /**
56 * the near clipping plane of the camera
57 */
58 public float near = 0.1f;
59
60 /**
61 * the far clipping plane of the camera
62 */
63 public float far = 1000;
64
65 /**
66 * the horizontal shift of the camera
67 */
68 public float sx = 0;
69
70 /**
71 * the vertical shift of the camera
72 */
73 public float sy = 0;
74
75 /**
76 * the x - fustrum scale of the camera
77 */

Callers 2

ShaderGroupClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected