123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <base href="../../" />
- <script src="list.js"></script>
- <script src="page.js"></script>
- <link type="text/css" rel="stylesheet" href="page.css" />
- </head>
- <body>
- [page:Object3D] → [page:Camera] →
- <h1>[name]</h1>
- <div class="desc">Camera with perspective projection.</div>
- <h2>Example</h2>
- <div>[example:canvas_geometry_birds geometry / birds ]</div>
- <div>[example:canvas_geometry_cube geometry / cube ]</div>
- <div>[example:webgl_animation_skinning_blending animation / skinning / blending ]</div>
- <div>[example:webgl_animation_skinning_morph animation / skinning / blending ]</div>
- <div>[example:webgl_effects_stereo effects / stereo ]</div>
- <div>[example:webgl_interactive_cubes interactive / cubes ]</div>
- <div>[example:webgl_loader_collada_skinning loader / collada / skinning ]</div>
- <code>var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 );
- scene.add( camera );</code>
- <h2>Constructor</h2>
- <h3>[name]( [page:Float fov], [page:Float aspect], [page:Float near], [page:Float far] )</h3>
- <div>
- fov — Camera frustum vertical field of view.<br />
- aspect — Camera frustum aspect ratio.<br />
- near — Camera frustum near plane.<br />
- far — Camera frustum far plane.
- </div>
- <h2>Properties</h2>
- <h3>[property:Float fov]</h3>
- <div>Camera frustum vertical field of view, from bottom to top of view, in degrees.</div>
- <h3>[property:number zoom]</h3>
- <div>Gets or sets the zoom factor of the camera. </div>
- <h3>[property:Float near]</h3>
- <div>Camera frustum near plane.</div>
- <h3>[property:Float far]</h3>
- <div>Camera frustum far plane.</div>
- <h3>[property:Float focus]</h3>
- <div>Object distance used for stereoscopy and depth-of-field effects. This parameter does not influence the projection matrix unless a StereoCamera is being used.</div>
- <h3>[property:Float aspect]</h3>
- <div>Camera frustum aspect ratio, window width divided by window height.</div>
- <h3>[property:Object view]</h3>
- <div>Frustum window specification or null.</div>
- <h3>[property:Float filmGauge]</h3>
- <div>Film size used for the larger axis. Default is 35 (millimeters). This parameter does not influence the projection matrix unless .filmOffset is set to a nonzero value.</div>
- <h3>[property:Float filmOffset]</h3>
- <div>Horizontal off-center offset in the same unit as .filmGauge.</div>
- <h2>Methods</h2>
- <h3>[method:Float getEffectiveFOV]()</h3>
- <div>
- Returns the current vertical field of view angle in degrees considering .zoom.
- </div>
- <h3>[method:Float getFocalLength]()</h3>
- <div>
- Returns the focal length of the current .fov in respect to .filmGauge.
- </div>
- <h3>[method:Float getFilmWidth]()</h3>
- <div>
- Returns the width of the image on the film. If .aspect is greater than or equal to one (landscape format), the result equals .filmGauge.
- </div>
- <h3>[method:Float getFilmHeight]()</h3>
- <div>
- Returns the height of the image on the film. If .aspect is less than or equal to one (portrait format), the result equals .filmGauge.
- </div>
- <h3>[method:null setFocalLength]( [page:Float focalLength] )</h3>
- <div>
- Sets the FOV by focal length in respect to the current .filmGauge.
- </div>
- <div>
- By default, the focal length is specified for a 35mm (full frame) camera.
- </div>
- <h3>[method:null setLens]( [page:Float focalLength], [page:Float filmGauge] )</h3>
- <div>
- focalLength — focal length<br />
- frameGauge — film gauge
- </div>
- <div>
- Sets .fov by focal length. Optionally also sets .filmGauge.
- This method is deprecated, please use .setFocalLength instead.
- </div>
- <h3>[method:null setViewOffset]( [page:Float fullWidth], [page:Float fullHeight], [page:Float x], [page:Float y], [page:Float width], [page:Float height] )</h3>
- <div>
- fullWidth — full width of multiview setup<br />
- fullHeight — full height of multiview setup<br />
- x — horizontal offset of subcamera<br />
- y — vertical offset of subcamera<br />
- width — width of subcamera<br />
- height — height of subcamera
- </div>
- <div>
- Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups.
- </div>
- <div>
- 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.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
- // B
- camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
- // C
- camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
- // D
- camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
- // E
- camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
- // F
- camera.setViewOffset( 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>[method:null clearViewOffset]()</h3>
- <div>
- Removes any offset set by the .setViewOffset method.
- </div>
- <h3>[method:null updateProjectionMatrix]()</h3>
- <div>
- Updates the camera projection matrix. Must be called after change of parameters.
- </div>
- <h3>[method:PerspectiveCamera clone]()</h3>
- <div>
- <br />
- It returns a clone of PerspectiveCamera.
- </div>
- <h3>[method:JSON toJSON]()</h3>
- <div>
- Return camera data in JSON format.
- </div>
- <h2>Source</h2>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </body>
- </html>
|