1 | <!DOCTYPE html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <meta charset="utf-8" />
|
---|
5 | <script src="../../list.js"></script>
|
---|
6 | <script src="../../page.js"></script>
|
---|
7 | <link type="text/css" rel="stylesheet" href="../../page.css" />
|
---|
8 | </head>
|
---|
9 | <body>
|
---|
10 | [page:Object3D] → [page:Camera] →
|
---|
11 |
|
---|
12 | <h1>[name]</h1>
|
---|
13 |
|
---|
14 | <div class="desc">Camera with perspective projection.</div>
|
---|
15 |
|
---|
16 |
|
---|
17 | <h2>Example</h2>
|
---|
18 |
|
---|
19 | <code>var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 );
|
---|
20 | scene.add( camera );</code>
|
---|
21 |
|
---|
22 |
|
---|
23 | <h2>Constructor</h2>
|
---|
24 |
|
---|
25 | <h3>[name]( [page:Float fov], [page:Float aspect], [page:Float near], [page:Float far] )</h3>
|
---|
26 | <div>
|
---|
27 | fov â Camera frustum vertical field of view.<br />
|
---|
28 | aspect â Camera frustum aspect ratio.<br />
|
---|
29 | near â Camera frustum near plane.<br />
|
---|
30 | far â Camera frustum far plane.
|
---|
31 | </div>
|
---|
32 |
|
---|
33 |
|
---|
34 | <h2>Properties</h2>
|
---|
35 |
|
---|
36 | <h3>.[page:Float fov]</h3>
|
---|
37 | <div>Camera frustum vertical field of view, from bottom to top of view, in degrees.</div>
|
---|
38 |
|
---|
39 | <h3>.[page:Float aspect]</h3>
|
---|
40 | <div>Camera frustum aspect ratio, window width divided by window height.</div>
|
---|
41 |
|
---|
42 | <h3>.[page:Float near]</h3>
|
---|
43 | <div>Camera frustum near plane.</div>
|
---|
44 |
|
---|
45 | <h3>.[page:Float far]</h3>
|
---|
46 | <div>Camera frustum far plane.</div>
|
---|
47 |
|
---|
48 |
|
---|
49 | <h2>Methods</h2>
|
---|
50 |
|
---|
51 | <h3>.setLens( [page:Float focalLength], [page:Float frameSize] )</h3>
|
---|
52 | <div>
|
---|
53 | focalLength â focal length<br />
|
---|
54 | frameSize â frame size
|
---|
55 | </div>
|
---|
56 |
|
---|
57 | <div>
|
---|
58 | Uses focal length (in mm) to estimate and set FOV 35mm (fullframe) camera is used if frame size is not specified.<br />
|
---|
59 | Formula based on [link:http://www.bobatkins.com/photography/technical/field_of_view.html]
|
---|
60 | </div>
|
---|
61 |
|
---|
62 | <h3>.setViewOffset( [page:Float fullWidth], [page:Float fullHeight], [page:Float x], [page:Float y], [page:Float width], [page:Float height] )</h3>
|
---|
63 | <div>
|
---|
64 | fullWidth â full width of multiview setup<br />
|
---|
65 | fullHeight â full height of multiview setup<br />
|
---|
66 | x â horizontal offset of subcamera<br />
|
---|
67 | y â vertical offset of subcamera<br />
|
---|
68 | width â width of subcamera<br />
|
---|
69 | height â height of subcamera
|
---|
70 | </div>
|
---|
71 |
|
---|
72 | <div>
|
---|
73 | Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups.
|
---|
74 | </div>
|
---|
75 |
|
---|
76 | <div>
|
---|
77 | For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this:<br />
|
---|
78 |
|
---|
79 | <pre>+---+---+---+
|
---|
80 | | A | B | C |
|
---|
81 | +---+---+---+
|
---|
82 | | D | E | F |
|
---|
83 | +---+---+---+</pre>
|
---|
84 |
|
---|
85 | then for each monitor you would call it like this:<br />
|
---|
86 |
|
---|
87 | <code>var w = 1920;
|
---|
88 | var h = 1080;
|
---|
89 | var fullWidth = w * 3;
|
---|
90 | var fullHeight = h * 2;
|
---|
91 |
|
---|
92 | // A
|
---|
93 | camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
|
---|
94 | // B
|
---|
95 | camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
|
---|
96 | // C
|
---|
97 | camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
|
---|
98 | // D
|
---|
99 | camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
|
---|
100 | // E
|
---|
101 | camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
|
---|
102 | // F
|
---|
103 | camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
|
---|
104 | </code>
|
---|
105 |
|
---|
106 | Note there is no reason monitors have to be the same size or in a grid.
|
---|
107 | </div>
|
---|
108 |
|
---|
109 | <h3>.updateProjectionMatrix()</h3>
|
---|
110 | <div>
|
---|
111 | Updates the camera projection matrix. Must be called after change of parameters.
|
---|
112 | </div>
|
---|
113 |
|
---|
114 |
|
---|
115 | <h2>Source</h2>
|
---|
116 |
|
---|
117 | [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
---|
118 | </body>
|
---|
119 | </html>
|
---|