-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCamera.java
More file actions
78 lines (65 loc) · 1.4 KB
/
Camera.java
File metadata and controls
78 lines (65 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Camera.java
* Project Disconnect
*
* Created by Drew Malin on 8/27/2011.
* Copyright 2011 Drew Malin. All rights reserved.
*
*/
public class Camera {
private float position[];
private float target[];
private float angle[];
private float up[];
public Camera() {
position = new float[3];
target = new float[3];
angle = new float[3];
up = new float[3];
}
public void setPosition(float x, float y, float z) {
position[0] = x;
position[1] = y;
position[2] = z;
}
public void setTarget(float x, float y, float z) {
target[0] = x;
target[1] = y;
target[2] = z;
}
public void setAngle(float x, float y, float z) {
angle[0] = x;
angle[1] = y;
angle[2] = z;
}
public void setUp(float x, float y, float z) {
up[0] = x;
up[1] = y;
up[2] = z;
}
public float getPosition(int index) {
assert ((index >= 0) && index <3);
return position[index];
}
public float getTarget(int index) {
assert ((index >= 0) && index <3);
return target[index];
}
public float getAngle(int index) {
assert ((index >= 0) && index <3);
return angle[index];
}
public float getUp(int index) {
assert ((index >= 0) && index <3);
return up[index];
}
public void changePositionX(float delta) {
position[0] += delta;
}
public void changePositionY(float delta) {
position[1] += delta;
}
public void changePositionZ(float delta) {
position[2] += delta;
}
}