1
0

OrthographicCamera.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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_shadowmap shadowmap ]
  33. </p>
  34. <h2>构造器</h2>
  35. <h3>[name]( [param:Number left], [param:Number right], [param:Number top], [param:Number bottom], [param:Number near], [param:Number far] )</h3>
  36. <p>
  37. left — 摄像机视锥体左侧面。<br />
  38. right — 摄像机视锥体右侧面。<br />
  39. top — 摄像机视锥体上侧面。<br />
  40. bottom — 摄像机视锥体下侧面。<br />
  41. near — 摄像机视锥体近端面。<br />
  42. far — 摄像机视锥体远端面。<br /><br />
  43. 这些参数一起定义了摄像机的[link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum](视锥体)。
  44. </p>
  45. <h2>属性</h2>
  46. <p>
  47. 共有属性请参见其基类[page:Camera]。
  48. <br>
  49. 请注意,在大多数属性发生改变之后,你将需要调用[page:OrthographicCamera.updateProjectionMatrix .updateProjectionMatrix]来使得这些改变生效。
  50. </p>
  51. <h3>[property:Float bottom]</h3>
  52. <p>摄像机视锥体下侧面。</p>
  53. <h3>[property:Float far]</h3>
  54. <p>
  55. 摄像机视锥体远端面,其默认值为*2000*。<br /><br />
  56. 该值必须大于[page:.near near] plane(摄像机视锥体近端面)的值。
  57. </p>
  58. <h3>[property:Boolean isOrthographicCamera]</h3>
  59. <p>
  60. Read-only flag to check if a given object is of type [name].
  61. </p>
  62. <h3>[property:Float left]</h3>
  63. <p>摄像机视锥体左侧面。</p>
  64. <h3>[property:Float near]</h3>
  65. <p>
  66. 摄像机视锥体近端面。其默认值为*0.1*.<br /><br />
  67. 其值的有效范围介于0和[page:.far far](摄像机视锥体远端面)之间。
  68. <br>
  69. 请注意,和[page:PerspectiveCamera]不同,*0*对于OrthographicCamera的近端面来说是一个有效值。
  70. </p>
  71. <h3>[property:Float right]</h3>
  72. <p>摄像机视锥体右侧面。</p>
  73. <h3>[property:Float top]</h3>
  74. <p>摄像机视锥体上侧面。</p>
  75. <h3>[property:Object view]</h3>
  76. <p>这个值是由[page:OrthographicCamera.setViewOffset setViewOffset]来设置的,其默认值为*null*。</p>
  77. <h3>[property:number zoom]</h3>
  78. <p>获取或者设置摄像机的缩放倍数,其默认值为*1*。</p>
  79. <h2>方法</h2>
  80. <p>共有方法请参见其基类[page:Camera]。</p>
  81. <h3>[method:undefined setViewOffset]( [param:Float fullWidth], [param:Float fullHeight], [param:Float x], [param:Float y], [param:Float width], [param:Float height] )</h3>
  82. <p>
  83. fullWidth — 多视图的全宽设置<br />
  84. fullHeight — 多视图的全高设置<br />
  85. x — 副摄像机的水平偏移<br />
  86. y — 副摄像机的垂直偏移<br />
  87. width — 副摄像机的宽度<br />
  88. height — 副摄像机的高度<br /><br />
  89. 在较大的[link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum](视锥体)中设置偏移量,对于多窗口或者多显示器的设置是很有用的。
  90. 对于如何使用它,请查看[page:PerspectiveCamera.setViewOffset PerspectiveCamera]中的示例。
  91. </p>
  92. <h3>[method:undefined clearViewOffset]()</h3>
  93. <p>
  94. 清除任何由.setViewOffset设置的偏移量。
  95. </p>
  96. <h3>[method:undefined updateProjectionMatrix]()</h3>
  97. <p>
  98. 更新摄像机投影矩阵。在任何参数被改变以后必须被调用。
  99. </p>
  100. <h3>[method:Object toJSON]([param:Object meta])</h3>
  101. <p>
  102. meta -- 包含有元数据的对象,例如对象后代中的纹理或图像<br />
  103. 将摄像机转换为 three.js [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 JSON Object/Scene format](three.js JSON 物体/场景格式)。
  104. </p>
  105. <h2>源代码</h2>
  106. <p>
  107. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  108. </p>
  109. </body>
  110. </html>