-
-
Notifications
You must be signed in to change notification settings - Fork 441
Expand file tree
/
Copy pathTestCamera.java
More file actions
70 lines (57 loc) · 1.69 KB
/
Copy pathTestCamera.java
File metadata and controls
70 lines (57 loc) · 1.69 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
import app.f3d.F3D.*;
public class TestCamera {
// On Windows, try to load opengl32 from Java path
// It's only useful in order to force Mesa software OpenGL
static {
if (System.getProperty("os.name").startsWith("Windows"))
{
try {
System.loadLibrary("opengl32");
} catch (UnsatisfiedLinkError e) {
// Ignore if opengl32 is not available
}
}
}
public static void main(String[] args) {
Engine.autoloadPlugins();
Engine engine = Engine.create(true);
Window window = engine.getWindow();
Camera camera = window.getCamera();
camera.setPosition(new double[]{1.0, 2.0, 3.0});
camera.getPosition();
camera.setFocalPoint(new double[]{0.5, 0.6, 0.7});
camera.getFocalPoint();
camera.setViewUp(new double[]{0.0, 1.0, 0.0});
camera.getViewUp();
camera.setViewAngle(45.0);
camera.getViewAngle();
Camera.CameraState state = new Camera.CameraState(
new double[]{2.0, 3.0, 4.0},
new double[]{1.0, 1.0, 1.0},
new double[]{0.0, 1.0, 0.0},
60.0
);
camera.setState(state);
camera.getState();
camera.dolly(1.5);
camera.pan(0.1, 0.2, 0.3);
camera.pan(0.1, 0.2);
camera.zoom(1.2);
camera.roll(10.0);
camera.azimuth(15.0);
camera.yaw(20.0);
camera.elevation(25.0);
camera.pitch(30.0);
camera.setCurrentAsDefault();
camera.resetToDefault();
camera.resetToBounds(0.8);
camera.resetToBounds();
camera.setPosition(new double[]{1.0, 1.0, 1.0})
.setFocalPoint(new double[]{0.0, 0.0, 0.0})
.setViewUp(new double[]{0.0, 1.0, 0.0})
.setViewAngle(30.0)
.dolly(1.0)
.roll(5.0);
engine.close();
}
}