123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <!DOCTYPE html>
- <html lang="zh">
- <head>
- <meta charset="utf-8" />
- <base href="../../../" />
- <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/Orthographic_projection orthographic projection](正交投影)来进行投影。<br /><br />
- 在这种投影模式下,无论物体距离相机距离远或者近,在最终渲染的图片中物体的大小都保持不变。
- <br /><br />
- 这对于渲染2D场景或者UI元素是非常有用的。
- </p>
- <h2>代码示例</h2>
- <code>
- const camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
- scene.add( camera );
- </code>
- <h2>例子</h2>
- <p>
- [example:webgl_camera camera ]<br />
- [example:webgl_interactive_cubes_ortho interactive / cubes / ortho ]<br />
- [example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]<br />
- [example:webgl_postprocessing_advanced postprocessing / advanced ]<br />
- [example:webgl_postprocessing_dof2 postprocessing / dof2 ]<br />
- [example:webgl_postprocessing_godrays postprocessing / godrays ]<br />
- [example:webgl_rtt rtt ]<br />
- [example:webgl_shadowmap shadowmap ]
- </p>
- <h2>构造器</h2>
- <h3>[name]( [param:Number left], [param:Number right], [param:Number top], [param:Number bottom], [param:Number near], [param:Number far] )</h3>
- <p>
- left — 摄像机视锥体左侧面。<br />
- right — 摄像机视锥体右侧面。<br />
- top — 摄像机视锥体上侧面。<br />
- bottom — 摄像机视锥体下侧面。<br />
- near — 摄像机视锥体近端面。<br />
- far — 摄像机视锥体远端面。<br /><br />
- 这些参数一起定义了摄像机的[link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum](视锥体)。
- </p>
- <h2>属性</h2>
- <p>
- 共有属性请参见其基类[page:Camera]。
- <br>
- 请注意,在大多数属性发生改变之后,你将需要调用[page:OrthographicCamera.updateProjectionMatrix .updateProjectionMatrix]来使得这些改变生效。
- </p>
- <h3>[property:Float bottom]</h3>
- <p>摄像机视锥体下侧面。</p>
- <h3>[property:Float far]</h3>
- <p>
- 摄像机视锥体远端面,其默认值为*2000*。<br /><br />
- 该值必须大于[page:.near near] plane(摄像机视锥体近端面)的值。
- </p>
- <h3>[property:Boolean isOrthographicCamera]</h3>
- <p>
- Read-only flag to check if a given object is of type [name].
- </p>
- <h3>[property:Float left]</h3>
- <p>摄像机视锥体左侧面。</p>
- <h3>[property:Float near]</h3>
- <p>
- 摄像机视锥体近端面。其默认值为*0.1*.<br /><br />
- 其值的有效范围介于0和[page:.far far](摄像机视锥体远端面)之间。
- <br>
- 请注意,和[page:PerspectiveCamera]不同,*0*对于OrthographicCamera的近端面来说是一个有效值。
- </p>
- <h3>[property:Float right]</h3>
- <p>摄像机视锥体右侧面。</p>
- <h3>[property:Float top]</h3>
- <p>摄像机视锥体上侧面。</p>
- <h3>[property:Object view]</h3>
- <p>这个值是由[page:OrthographicCamera.setViewOffset setViewOffset]来设置的,其默认值为*null*。</p>
- <h3>[property:number zoom]</h3>
- <p>获取或者设置摄像机的缩放倍数,其默认值为*1*。</p>
- <h2>方法</h2>
- <p>共有方法请参见其基类[page:Camera]。</p>
- <h3>[method:undefined 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 — 副摄像机的高度<br /><br />
- 在较大的[link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum](视锥体)中设置偏移量,对于多窗口或者多显示器的设置是很有用的。
- 对于如何使用它,请查看[page:PerspectiveCamera.setViewOffset PerspectiveCamera]中的示例。
- </p>
- <h3>[method:undefined clearViewOffset]()</h3>
- <p>
- 清除任何由.setViewOffset设置的偏移量。
- </p>
- <h3>[method:undefined updateProjectionMatrix]()</h3>
- <p>
- 更新摄像机投影矩阵。在任何参数被改变以后必须被调用。
- </p>
- <h3>[method:Object toJSON]([param:Object meta])</h3>
- <p>
- meta -- 包含有元数据的对象,例如对象后代中的纹理或图像<br />
- 将摄像机转换为 three.js [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 JSON Object/Scene format](three.js JSON 物体/场景格式)。
- </p>
- <h2>源代码</h2>
- <p>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </p>
- </body>
- </html>
|