OrthographicCamera.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <!DOCTYPE html>
  2. <html lang="en">
  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. Camera that uses [link:https://en.wikipedia.org/wiki/Orthographic_projection orthographic projection].<br /><br />
  14. In this projection mode, an object's size in the rendered image stays constant
  15. regardless of its distance from the camera.<br /><br />
  16. This can be useful for rendering 2D scenes and UI elements, amongst other things.
  17. </p>
  18. <h2>Code Example</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>Examples</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>Constructor</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 — Camera frustum left plane.<br />
  39. right — Camera frustum right plane.<br />
  40. top — Camera frustum top plane.<br />
  41. bottom — Camera frustum bottom plane.<br />
  42. near — Camera frustum near plane.<br />
  43. far — Camera frustum far plane.<br /><br />
  44. Together these define the camera's [link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum].
  45. </p>
  46. <h2>Properties</h2>
  47. <p>
  48. See the base [page:Camera] class for common properties.<br>
  49. Note that after making changes to most of these properties you will have to call
  50. [page:OrthographicCamera.updateProjectionMatrix .updateProjectionMatrix] for the changes to take effect.
  51. </p>
  52. <h3>[property:Float bottom]</h3>
  53. <p>Camera frustum bottom plane.</p>
  54. <h3>[property:Float far]</h3>
  55. <p>
  56. Camera frustum far plane. Default is *2000*.<br /><br />
  57. Must be greater than the current value of [page:.near near] plane.
  58. </p>
  59. <h3>[property:Float left]</h3>
  60. <p>Camera frustum left plane.</p>
  61. <h3>[property:Float near]</h3>
  62. <p>
  63. Camera frustum near plane. Default is *0.1*.<br /><br />
  64. The valid range is between 0 and the current value of the [page:.far far] plane.
  65. Note that, unlike for the [page:PerspectiveCamera], *0* is a valid value for an
  66. OrthographicCamera's near plane.
  67. </p>
  68. <h3>[property:Float right]</h3>
  69. <p>Camera frustum right plane.</p>
  70. <h3>[property:Float top]</h3>
  71. <p>Camera frustum top plane.</p>
  72. <h3>[property:Object view]</h3>
  73. <p>Set by [page:OrthographicCamera.setViewOffset setViewOffset]. Default is *null*.</p>
  74. <h3>[property:number zoom]</h3>
  75. <p>Gets or sets the zoom factor of the camera. Default is *1*.</p>
  76. <h2>Methods</h2>
  77. <p>See the base [page:Camera] class for common methods.</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 — full width of multiview setup<br />
  81. fullHeight — full height of multiview setup<br />
  82. x — horizontal offset of subcamera<br />
  83. y — vertical offset of subcamera<br />
  84. width — width of subcamera<br />
  85. height — height of subcamera<br /><br />
  86. Sets an offset in a larger [link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum].
  87. This is useful for multi-window or multi-monitor/multi-machine setups.
  88. For an example on how to use it see [page:PerspectiveCamera.setViewOffset PerspectiveCamera].
  89. </p>
  90. <h3>[method:null clearViewOffset]()</h3>
  91. <p>
  92. Removes any offset set by the .setViewOffset method.
  93. </p>
  94. <h3>[method:null updateProjectionMatrix]()</h3>
  95. <p>
  96. Updates the camera projection matrix. Must be called after any change of parameters.
  97. </p>
  98. <h3>[method:Object toJSON]([param:Object meta])</h3>
  99. <p>
  100. meta -- object containing metadata such as textures or images in objects' descendants.<br />
  101. Convert the camera to three.js [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 JSON Object/Scene format].
  102. </p>
  103. <h2>Source</h2>
  104. <p>
  105. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  106. </p>
  107. </body>
  108. </html>