OrthographicCamera.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Object3D] &rarr; [page:Camera] &rarr;
  12. <h1>[name]</h1>
  13. <p class="desc">
  14. Camera that uses [link:https://en.wikipedia.org/wiki/Orthographic_projection orthographic projection].<br /><br />
  15. In this projection mode, an object's size in the rendered image stays constant
  16. regardless of its distance from the camera.<br /><br />
  17. This can be useful for rendering 2D scenes and UI elements, amongst other things.
  18. </p>
  19. <h2>Example</h2>
  20. <p>[example:webgl_camera camera ]</p>
  21. <p>[example:webgl_interactive_cubes_ortho interactive / cubes / ortho ]</p>
  22. <p>[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]</p>
  23. <p>[example:webgl_postprocessing_advanced postprocessing / advanced ]</p>
  24. <p>[example:webgl_postprocessing_dof2 postprocessing / dof2 ]</p>
  25. <p>[example:webgl_postprocessing_godrays postprocessing / godrays ]</p>
  26. <p>[example:webgl_rtt rtt ]</p>
  27. <p>[example:webgl_shaders_tonemapping shaders / tonemapping ]</p>
  28. <p>[example:webgl_shadowmap shadowmap ]</p>
  29. <code>var camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
  30. scene.add( camera );</code>
  31. <h2>Constructor</h2>
  32. <h3>[name]( [param:Number left], [param:Number right], [param:Number top], [param:Number bottom], [param:Number near], [param:Number far] )</h3>
  33. <p>
  34. left — Camera frustum left plane.<br />
  35. right — Camera frustum right plane.<br />
  36. top — Camera frustum top plane.<br />
  37. bottom — Camera frustum bottom plane.<br />
  38. near — Camera frustum near plane.<br />
  39. far — Camera frustum far plane.<br /><br />
  40. Together these define the camera's [link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum].
  41. </p>
  42. <h2>Properties</h2>
  43. <p>
  44. See the base [page:Camera] class for common properties.<br>
  45. Note that after making changes to most of these properties you will have to call
  46. [page:OrthographicCamera.updateProjectionMatrix .updateProjectionMatrix] for the changes to take effect.
  47. </p>
  48. <h3>[property:Float bottom]</h3>
  49. <p>Camera frustum bottom plane.</p>
  50. <h3>[property:Float far]</h3>
  51. <p>
  52. Camera frustum far plane. Default is *2000*.<br /><br />
  53. The valid range is between the current value of the [page:.near near] plane and infinity.
  54. </p>
  55. <h3>[property:Float left]</h3>
  56. <p>Camera frustum left plane.</p>
  57. <h3>[property:Float near]</h3>
  58. <p>
  59. Camera frustum near plane. Default is *0.1*.<br /><br />
  60. The valid range is between 0 and the current value of the [page:.far far] plane.
  61. Note that, unlike for the [page:PerspectiveCamera], *0* is a valid value for an
  62. OrthographicCamera's near plane.
  63. </p>
  64. <h3>[property:Float right]</h3>
  65. <p>Camera frustum right plane.</p>
  66. <h3>[property:Float top]</h3>
  67. <p>Camera frustum top plane.</p>
  68. <h3>[property:Object view]</h3>
  69. <p>Set by [page:OrthographicCamera.setViewOffset setViewOffset]. Default is *null*.</p>
  70. <h3>[property:number zoom]</h3>
  71. <p>Gets or sets the zoom factor of the camera. Default is *1*.</p>
  72. <h2>Methods</h2>
  73. <p>See the base [page:Camera] class for common methods.</p>
  74. <h3>[method:null setViewOffset]( [param:Float fullWidth], [param:Float fullHeight], [param:Float x], [param:Float y], [param:Float width], [param:Float height] )</h3>
  75. <p>
  76. fullWidth — full width of multiview setup<br />
  77. fullHeight — full height of multiview setup<br />
  78. x — horizontal offset of subcamera<br />
  79. y — vertical offset of subcamera<br />
  80. width — width of subcamera<br />
  81. height — height of subcamera<br /><br />
  82. Sets an offset in a larger [link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum].
  83. This is useful for multi-window or multi-monitor/multi-machine setups.
  84. For an example on how to use it see [page:PerspectiveCamera.setViewOffset PerspectiveCamera].
  85. </p>
  86. <h3>[method:null clearViewOffset]()</h3>
  87. <p>
  88. Removes any offset set by the .setViewOffset method.
  89. </p>
  90. <h3>[method:null updateProjectionMatrix]()</h3>
  91. <p>
  92. Updates the camera projection matrix. Must be called after any change of parameters.
  93. </p>
  94. <h3>[method:Object toJSON]([param:object meta])</h3>
  95. <p>
  96. meta -- object containing metadata such as textures or images in objects' descendants.<br />
  97. Convert the camera to three.js [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 JSON Object/Scene format].
  98. </p>
  99. <h2>Source</h2>
  100. <p>
  101. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  102. </p>
  103. </body>
  104. </html>