OrthographicCamera.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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
  14. [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
  16. constant regardless of its distance from the camera.<br /><br />
  17. This can be useful for rendering 2D scenes and UI elements, amongst other
  18. things.
  19. </p>
  20. <h2>Code Example</h2>
  21. <code>
  22. const camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
  23. scene.add( camera );
  24. </code>
  25. <h2>Examples</h2>
  26. <p>
  27. [example:webgl_camera camera ]<br />
  28. [example:webgl_interactive_cubes_ortho interactive / cubes / ortho ]<br />
  29. [example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic]<br />
  30. [example:webgl_postprocessing_advanced postprocessing / advanced ]<br />
  31. [example:webgl_postprocessing_dof2 postprocessing / dof2 ]<br />
  32. [example:webgl_postprocessing_godrays postprocessing / godrays ]<br />
  33. [example:webgl_rtt rtt ]<br />
  34. [example:webgl_shadowmap shadowmap ]
  35. </p>
  36. <h2>Constructor</h2>
  37. <h3>[name]( [param:Number left], [param:Number right], [param:Number top], [param:Number bottom], [param:Number near], [param:Number far] )</h3>
  38. <p>
  39. left — Camera frustum left plane.<br />
  40. right — Camera frustum right plane.<br />
  41. top — Camera frustum top plane.<br />
  42. bottom — Camera frustum bottom plane.<br />
  43. near — Camera frustum near plane.<br />
  44. far — Camera frustum far plane.<br /><br />
  45. Together these define the camera's
  46. [link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum].
  47. </p>
  48. <h2>Properties</h2>
  49. <p>
  50. See the base [page:Camera] class for common properties.<br />
  51. Note that after making changes to most of these properties you will have
  52. to call [page:OrthographicCamera.updateProjectionMatrix .updateProjectionMatrix] for the changes to take effect.
  53. </p>
  54. <h3>[property:Float bottom]</h3>
  55. <p>Camera frustum bottom plane.</p>
  56. <h3>[property:Float far]</h3>
  57. <p>
  58. Camera frustum far plane. Default is `2000`.<br /><br />
  59. Must be greater than the current value of [page:.near near] plane.
  60. </p>
  61. <h3>[property:Boolean isOrthographicCamera]</h3>
  62. <p>Read-only flag to check if a given object is of type [name].</p>
  63. <h3>[property:Float left]</h3>
  64. <p>Camera frustum left plane.</p>
  65. <h3>[property:Float near]</h3>
  66. <p>
  67. Camera frustum near plane. Default is `0.1`.<br /><br />
  68. The valid range is between `0` and the current value of the [page:.far far] plane. Note that, unlike for the [page:PerspectiveCamera], `0` is a
  69. valid value for an OrthographicCamera's near plane.
  70. </p>
  71. <h3>[property:Float right]</h3>
  72. <p>Camera frustum right plane.</p>
  73. <h3>[property:Float top]</h3>
  74. <p>Camera frustum top plane.</p>
  75. <h3>[property:Object view]</h3>
  76. <p>
  77. Set by [page:OrthographicCamera.setViewOffset setViewOffset]. Default is
  78. `null`.
  79. </p>
  80. <h3>[property:number zoom]</h3>
  81. <p>Gets or sets the zoom factor of the camera. Default is `1`.</p>
  82. <h2>Methods</h2>
  83. <p>See the base [page:Camera] class for common methods.</p>
  84. <h3>[method:undefined setViewOffset]( [param:Float fullWidth], [param:Float fullHeight], [param:Float x], [param:Float y], [param:Float width], [param:Float height] )</h3>
  85. <p>
  86. fullWidth — full width of multiview setup<br />
  87. fullHeight — full height of multiview setup<br />
  88. x — horizontal offset of subcamera<br />
  89. y — vertical offset of subcamera<br />
  90. width — width of subcamera<br />
  91. height — height of subcamera<br /><br />
  92. Sets an offset in a larger
  93. [link:https://en.wikipedia.org/wiki/Viewing_frustum viewing frustum]. This
  94. is useful for multi-window or multi-monitor/multi-machine setups. For an
  95. example on how to use it see [page:PerspectiveCamera.setViewOffset PerspectiveCamera].
  96. </p>
  97. <h3>[method:undefined clearViewOffset]()</h3>
  98. <p>Removes any offset set by the .setViewOffset method.</p>
  99. <h3>[method:undefined updateProjectionMatrix]()</h3>
  100. <p>
  101. Updates the camera projection matrix. Must be called after any change of
  102. parameters.
  103. </p>
  104. <h3>[method:Object toJSON]([param:Object meta])</h3>
  105. <p>
  106. meta -- object containing metadata such as textures or images in objects'
  107. descendants.<br />
  108. Convert the camera to three.js
  109. [link:https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4 JSON Object/Scene format].
  110. </p>
  111. <h2>Source</h2>
  112. <p>
  113. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  114. </p>
  115. </body>
  116. </html>