| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <h1>PerspectiveCamera ← [page:Camera] ← [page:Object3D]</h1>
- <div>Camera with perspective projection.</div>
- <h2>Example</h2>
- <code>var camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );
- scene.add( camera );
- </code>
- <h2>Constructor</h2>
- <h3>PerspectiveCamera( fov [page:Number], aspect [page:Number], near [page:Number], far [page:Number] )</h3>
- <h2>Properties</h2>
- <h3>fov [page:Number]</h3>
- <div>Camera frustum vertical field of view.</div>
- <h3>aspect [page:Number]</h3>
- <div>Camera frustum aspect ratio.</div>
- <h3>near [page:Number]</h3>
- <div>Camera frustum near plane.</div>
- <h3>far [page:Number]</h3>
- <div>Camera frustum far plane.</div>
- <h2>Methods</h2>
- <h3>setLens( focalLength [page:Number], frameSize [page:Number] )</h3>
- <div>
- Uses focal length (in mm) to estimate and set FOV 35mm (fullframe) camera is used if frame size is not specified.<br />
- Formula based on <a href="http://www.bobatkins.com/photography/technical/field_of_view.html" target="_blank">http://www.bobatkins.com/photography/technical/field_of_view.html</a>
- </div>
- <h3>setViewOffset( fullWidth [page:Number], fullHeight [page:Number], x [page:Number], y [page:Number], width [page:Number], height [page:Number] )</h3>
- <div>
- Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups.<br /><br />
- For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this:<br />
- <pre>+---+---+---+
- | A | B | C |
- +---+---+---+
- | D | E | F |
- +---+---+---+
- </pre>
- then for each monitor you would call it like this:<br />
- <code>var w = 1920;
- var h = 1080;
- var fullWidth = w * 3;
- var fullHeight = h * 2;
- // --A--
- camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
- //--B--
- camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
- //--C--
- camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
- //--D--
- camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
- //--E--
- camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
- //--F--
- camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
- </code>
- Note there is no reason monitors have to be the same size or in a grid.
- </div>
- <h3>updateProjectionMatrix()</h3>
- <div>
- Updates camera's projection matrix. Must be called after change of parameters.
- </div>
- <h2>Source</h2>
- <div><a href="https://github.com/mrdoob/three.js/blob/master/src/[path].js" target="_blank">src/[path].js</a></div>
|