123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <!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>
- <p class="desc">
- 使用[link:https://en.wikipedia.org/wiki/Perspective_(graphical) perspective projection]的摄像机。<br /><br />
- 这种投影模式旨在模仿人眼看到的方式。它是用于渲染3D场景的最常见投影模式。
- </p>
- <h2>例子</h2>
- <p>[example:canvas_geometry_birds geometry / birds ]</p>
- <p>[example:canvas_geometry_cube geometry / cube ]</p>
- <p>[example:webgl_animation_skinning_blending animation / skinning / blending ]</p>
- <p>[example:webgl_animation_skinning_morph animation / skinning / blending ]</p>
- <p>[example:webgl_effects_stereo effects / stereo ]</p>
- <p>[example:webgl_interactive_cubes interactive / cubes ]</p>
- <p>[example:webgl_loader_collada_skinning loader / collada / skinning ]</p>
- <code>var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 );
- scene.add( camera );</code>
- <h2>构造函数</h2>
- <h3>[name]( [param:Number fov], [param:Number aspect], [param:Number near], [param:Number far] )</h3>
- <p>
- fov — 摄像机视锥体垂直视野。<br />
- aspect — 摄像机视锥体宽高比。<br />
- near — 摄像机视锥体近平面。<br />
- far — 摄像机视锥体远平面。<br /><br />
- 这些一起定义了摄像机的[link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum]。
- </p>
- <h2>属性</h2>
- <p>
- 参阅基类[page:Camera]的公共属性。<br>
- 请注意,在对大多数这些属性进行更改后,必须调用[page:PerspectiveCamera.updateProjectionMatrix .updateProjectionMatrix]才能使更改生效。.
- </p>
- <h3>[property:Float aspect]</h3>
- <p>摄像机视锥体宽高比。默认是画布宽度/画布高度。默认值为*1*(方形画布)。</p>
- <h3>[property:Float far]</h3>
- <p>
- 摄像机视锥体远平面。 默认值为*2000*。<br /><br />
- 有效范围介于[page:.near]平面的当前值和无穷远之间。
- </p>
- <h3>[property:Float filmGauge]</h3>
- <p>用于较大轴的胶片尺寸。默认值为35 (毫米)。 除非.filmOffset设置为非零值,否则此参数不会影响投影矩阵。</p>
- <h3>[property:Float filmOffset]</h3>
- <p>与.filmGauge相同单位的水平偏中心偏移。默认值为0。</p>
- <h3>[property:Float focus]</h3>
- <p>用于立体视觉和景深效果的物距。
- 除非使用[page:StereoCamera],否则此参数不会影响投影矩阵。默认值为*10*。
- </p>
- <h3>[property:Float fov]</h3>
- <p>摄像机视锥体垂直视野,从底部到顶部,以度为单位。默认值为*50*。</p>
- <h3>[property:Boolean isPerspectiveCamera]</h3>
- <p>
- 用于测试此类或派生类是否为透视摄像机。默认为*true*。<br /><br />
- 这不应该更改,因为渲染器在内部使用它进行优化。
- </p>
- <h3>[property:Float near]</h3>
- <p>
- 摄像机视锥体的近平面,默认值为*0.1*。<br /><br />
- 有效范围大于0且小于远平面的当前值。需要注意的是,与正交摄像机不同,对于透视摄像机的近平面,0不是一个有效值。
- </p>
- <h3>[property:Object view]</h3>
- <p>
- 视锥体窗口规范或null。这是使用[page:PerspectiveCamera.setViewOffset .setViewOffset]方法设置,
- 并使用[page:PerspectiveCamera.clearViewOffset .clearViewOffset]清除。
- </p>
- <h3>[property:number zoom]</h3>
- <p>获取或设置摄像机的缩放系数。默认值为*1*。</p>
- <h2>方法</h2>
- <p>参阅基类[page:Camera]的公共方法。</p>
- <h3>[method:null clearViewOffset]()</h3>
- <p>删除[page:PerspectiveCamera.setViewOffset .setViewOffset]方法设置的任何偏移量。</p>
- <h3>[method:Float getEffectiveFOV]()</h3>
- <p>考虑.zoom,返回当前垂直视角范围(以度为单位)。</p>
- <h3>[method:Float getFilmHeight]()</h3>
- <p>
- 返回胶片上图像的高度。如果.aspect小于或等于1(纵向格式),则结果等于.filmGauge。
- </p>
- <h3>[method:Float getFilmWidth]()</h3>
- <p>
- 返回胶片上图像的宽度。如果.aspect大于或等于1(横向格式),则结果等于.filmGauge。
- </p>
- <h3>[method:Float getFocalLength]()</h3>
- <p>返回.filmGauge当前.fov的焦距。</p>
- <h3>[method:null setFocalLength]( [param:Float focalLength] )</h3>
- <p>
- 根据当前[page:PerspectiveCamera.filmGauge .filmGauge]的焦距设置FOV。<br /><br />
- 默认情况下,焦距是为35mm(全画幅)摄像机指定的。
- </p>
- <h3>[method:null setViewOffset]( [param:Float fullWidth], [param:Float fullHeight], [param:Float x], [param:Float y], [param:Float width], [param:Float height] )</h3>
- <p>
- fullWidth — 多视图设置的全宽度<br />
- fullHeight — 多视图设置的全高度<br />
- x — 子摄像机的水平偏移<br />
- y — 子摄像机的竖直偏移<br />
- width — 子摄像机宽度<br />
- height — 子摄像机高度
- </p>
- <p>
- 在较大的视锥体中设置偏移。
- 这对于多窗口或多显示器/多机器设置很有用。
- </p>
- <p>
- 例如,如果你有3x2显示器,每个显示器是1920x1080,显示器是这样的网格:<br />
- <pre>
- +---+---+---+
- | A | B | C |
- +---+---+---+
- | D | E | F |
- +---+---+---+
- </pre>
- 然后对于每个监视器,你会这样调用它: <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>
- 注意监视器没有理由必须是相同的大小或在一个网格中。
- </p>
- <h3>[method:null updateProjectionMatrix]()</h3>
- <p>
- 更新摄像机的投影矩阵。必须在更改参数后调用。
- </p>
- <h3>[method:JSON toJSON]()</h3>
- <p>
- 以JSON格式返回摄像机的数据。
- </p>
- <h2>源代码</h2>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </body>
- </html>
|