OrthographicCamera.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Object3D] &rarr; [page:Camera] &rarr;
  11. <h1>正交相机([name])</h1>
  12. <p class="desc">
  13. 这一摄像机使用[link:https://en.wikipedia.org/wiki/Orthographic_projection orthographic projection](正交投影)来进行投影。<br /><br />
  14. 在这种投影模式下,无论物体距离相机距离远或者近,在最终渲染的图片中物体的大小都保持不变。
  15. <br /><br />
  16. 这对于渲染2D场景或者UI元素是非常有用的。
  17. </p>
  18. <h2>代码示例</h2>
  19. <code>
  20. const camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
  21. scene.add( camera );
  22. </code>
  23. <h2>例子</h2>
  24. <p>
  25. [example:webgl_camera camera ]<br />
  26. [example:webgl_interactive_cubes_ortho interactive / cubes / ortho ]<br />
  27. [example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]<br />
  28. [example:webgl_postprocessing_advanced postprocessing / advanced ]<br />
  29. [example:webgl_postprocessing_dof2 postprocessing / dof2 ]<br />
  30. [example:webgl_postprocessing_godrays postprocessing / godrays ]<br />
  31. [example:webgl_rtt rtt ]<br />
  32. [example:webgl_shaders_tonemapping shaders / tonemapping ]<br />
  33. [example:webgl_shadowmap shadowmap ]
  34. </p>
  35. <h2>构造器</h2>
  36. <h3>[name]( [param:Number left], [param:Number right], [param:Number top], [param:Number bottom], [param:Number near], [param:Number far] )</h3>
  37. <p>
  38. left — 摄像机视锥体左侧面。<br />
  39. right — 摄像机视锥体右侧面。<br />
  40. top — 摄像机视锥体上侧面。<br />
  41. bottom — 摄像机视锥体下侧面。<br />
  42. near — 摄像机视锥体近端面。<br />
  43. far — 摄像机视锥体远端面。<br /><br />
  44. 这些参数一起定义了摄像机的[link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum](视锥体)。
  45. </p>
  46. <h2>属性</h2>
  47. <p>
  48. 共有属性请参见其基类[page:Camera]。
  49. <br>
  50. 请注意,在大多数属性发生改变之后,你将需要调用[page:OrthographicCamera.updateProjectionMatrix .updateProjectionMatrix]来使得这些改变生效。
  51. </p>
  52. <h3>[property:Float bottom]</h3>
  53. <p>摄像机视锥体下侧面。</p>
  54. <h3>[property:Float far]</h3>
  55. <p>
  56. 摄像机视锥体远端面,其默认值为*2000*。<br /><br />
  57. 该值必须大于[page:.near near] plane(摄像机视锥体近端面)的值。
  58. </p>
  59. <h3>[property:Float left]</h3>
  60. <p>摄像机视锥体左侧面。</p>
  61. <h3>[property:Float near]</h3>
  62. <p>
  63. 摄像机视锥体近端面。其默认值为*0.1*.<br /><br />
  64. 其值的有效范围介于0和[page:.far far](摄像机视锥体远端面)之间。
  65. <br>
  66. 请注意,和[page:PerspectiveCamera]不同,*0*对于OrthographicCamera的近端面来说是一个有效值。
  67. </p>
  68. <h3>[property:Float right]</h3>
  69. <p>摄像机视锥体右侧面。</p>
  70. <h3>[property:Float top]</h3>
  71. <p>摄像机视锥体上侧面。</p>
  72. <h3>[property:Object view]</h3>
  73. <p>这个值是由[page:OrthographicCamera.setViewOffset setViewOffset]来设置的,其默认值为*null*。</p>
  74. <h3>[property:number zoom]</h3>
  75. <p>获取或者设置摄像机的缩放倍数,其默认值为*1*。</p>
  76. <h2>方法</h2>
  77. <p>共有方法请参见其基类[page:Camera]。</p>
  78. <h3>[method:null setViewOffset]( [param:Float fullWidth], [param:Float fullHeight], [param:Float x], [param:Float y], [param:Float width], [param:Float height] )</h3>
  79. <p>
  80. fullWidth — 多视图的全宽设置<br />
  81. fullHeight — 多视图的全高设置<br />
  82. x — 副摄像机的水平偏移<br />
  83. y — 副摄像机的垂直偏移<br />
  84. width — 副摄像机的宽度<br />
  85. height — 副摄像机的高度<br /><br />
  86. 在较大的[link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum](视锥体)中设置偏移量,对于多窗口或者多显示器的设置是很有用的。
  87. 对于如何使用它,请查看[page:PerspectiveCamera.setViewOffset PerspectiveCamera]中的示例。
  88. </p>
  89. <h3>[method:null clearViewOffset]()</h3>
  90. <p>
  91. 清除任何由.setViewOffset设置的偏移量。
  92. </p>
  93. <h3>[method:null updateProjectionMatrix]()</h3>
  94. <p>
  95. 更新摄像机投影矩阵。在任何参数被改变以后必须被调用。
  96. </p>
  97. <h3>[method:Object toJSON]([param:Object meta])</h3>
  98. <p>
  99. meta -- 包含有元数据的对象,例如对象后代中的纹理或图像<br />
  100. 将摄像机转换为 three.js [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 JSON Object/Scene format](three.js JSON 物体/场景格式)。
  101. </p>
  102. <h2>源代码</h2>
  103. <p>
  104. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  105. </p>
  106. </body>
  107. </html>