OrthographicCamera.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>OrthographicCamera - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Object3D.html">Object3D</a> → <a href="Camera.html">Camera</a> → </p>
  13. <h1 translate="no">OrthographicCamera</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Camera that uses <a href="https://en.wikipedia.org/wiki/Orthographic_projection" target="_blank" rel="noopener">orthographic projection</a>.</p>
  17. <p>In this projection mode, an object's size in the rendered image stays
  18. constant regardless of its distance from the camera. This can be useful
  19. for rendering 2D scenes and UI elements, amongst other things.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">const camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
  22. scene.add( camera );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="OrthographicCamera" translate="no">new <a href="#OrthographicCamera">OrthographicCamera</a><span class="signature">( left : <span class="param-type">number</span>, right : <span class="param-type">number</span>, top : <span class="param-type">number</span>, bottom : <span class="param-type">number</span>, near : <span class="param-type">number</span>, far : <span class="param-type">number</span> )</span> </h3>
  29. <div class="method">
  30. <div class="description">
  31. <p>Constructs a new orthographic camera.</p>
  32. </div>
  33. <table class="params">
  34. <tbody>
  35. <tr>
  36. <td class="name">
  37. <strong>left</strong>
  38. </td>
  39. <td class="description last">
  40. <p>The left plane of the camera's frustum.</p>
  41. <p>Default is <code>-1</code>.</p>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="name">
  46. <strong>right</strong>
  47. </td>
  48. <td class="description last">
  49. <p>The right plane of the camera's frustum.</p>
  50. <p>Default is <code>1</code>.</p>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td class="name">
  55. <strong>top</strong>
  56. </td>
  57. <td class="description last">
  58. <p>The top plane of the camera's frustum.</p>
  59. <p>Default is <code>1</code>.</p>
  60. </td>
  61. </tr>
  62. <tr>
  63. <td class="name">
  64. <strong>bottom</strong>
  65. </td>
  66. <td class="description last">
  67. <p>The bottom plane of the camera's frustum.</p>
  68. <p>Default is <code>-1</code>.</p>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td class="name">
  73. <strong>near</strong>
  74. </td>
  75. <td class="description last">
  76. <p>The camera's near plane.</p>
  77. <p>Default is <code>0.1</code>.</p>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td class="name">
  82. <strong>far</strong>
  83. </td>
  84. <td class="description last">
  85. <p>The camera's far plane.</p>
  86. <p>Default is <code>2000</code>.</p>
  87. </td>
  88. </tr>
  89. </tbody>
  90. </table>
  91. </div>
  92. </div>
  93. <h2 class="subsection-title">Properties</h2>
  94. <div class="member">
  95. <h3 class="name" id="bottom" translate="no">.<a href="#bottom">bottom</a><span class="type-signature"> : number</span> </h3>
  96. <div class="description">
  97. <p>The bottom plane of the camera's frustum.</p>
  98. <p>Default is <code>-1</code>.</p>
  99. </div>
  100. </div>
  101. <div class="member">
  102. <h3 class="name" id="far" translate="no">.<a href="#far">far</a><span class="type-signature"> : number</span> </h3>
  103. <div class="description">
  104. <p>The camera's far plane. Must be greater than the
  105. current value of <a href="OrthographicCamera.html#near">OrthographicCamera#near</a>.</p>
  106. <p>Default is <code>2000</code>.</p>
  107. </div>
  108. </div>
  109. <div class="member">
  110. <h3 class="name" id="isOrthographicCamera" translate="no">.<a href="#isOrthographicCamera">isOrthographicCamera</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  111. <div class="description">
  112. <p>This flag can be used for type testing.</p>
  113. <p>Default is <code>true</code>.</p>
  114. </div>
  115. </div>
  116. <div class="member">
  117. <h3 class="name" id="left" translate="no">.<a href="#left">left</a><span class="type-signature"> : number</span> </h3>
  118. <div class="description">
  119. <p>The left plane of the camera's frustum.</p>
  120. <p>Default is <code>-1</code>.</p>
  121. </div>
  122. </div>
  123. <div class="member">
  124. <h3 class="name" id="near" translate="no">.<a href="#near">near</a><span class="type-signature"> : number</span> </h3>
  125. <div class="description">
  126. <p>The camera's near plane. The valid range is greater than <code>0</code>
  127. and less than the current value of <a href="OrthographicCamera.html#far">OrthographicCamera#far</a>.</p>
  128. <p>Note that, unlike for the <a href="PerspectiveCamera.html">PerspectiveCamera</a>, <code>0</code> is a
  129. valid value for an orthographic camera's near plane.</p>
  130. <p>Default is <code>0.1</code>.</p>
  131. </div>
  132. </div>
  133. <div class="member">
  134. <h3 class="name" id="right" translate="no">.<a href="#right">right</a><span class="type-signature"> : number</span> </h3>
  135. <div class="description">
  136. <p>The right plane of the camera's frustum.</p>
  137. <p>Default is <code>1</code>.</p>
  138. </div>
  139. </div>
  140. <div class="member">
  141. <h3 class="name" id="top" translate="no">.<a href="#top">top</a><span class="type-signature"> : number</span> </h3>
  142. <div class="description">
  143. <p>The top plane of the camera's frustum.</p>
  144. <p>Default is <code>1</code>.</p>
  145. </div>
  146. </div>
  147. <div class="member">
  148. <h3 class="name" id="view" translate="no">.<a href="#view">view</a><span class="type-signature"> : Object</span> </h3>
  149. <div class="description">
  150. <p>Represents the frustum window specification. This property should not be edited
  151. directly but via <a href="PerspectiveCamera.html#setViewOffset">PerspectiveCamera#setViewOffset</a> and <a href="PerspectiveCamera.html#clearViewOffset">PerspectiveCamera#clearViewOffset</a>.</p>
  152. <p>Default is <code>null</code>.</p>
  153. </div>
  154. </div>
  155. <div class="member">
  156. <h3 class="name" id="zoom" translate="no">.<a href="#zoom">zoom</a><span class="type-signature"> : number</span> </h3>
  157. <div class="description">
  158. <p>The zoom factor of the camera.</p>
  159. <p>Default is <code>1</code>.</p>
  160. </div>
  161. </div>
  162. <h2 class="subsection-title">Methods</h2>
  163. <h3 class="name name-method" id="clearViewOffset" translate="no">.<a href="#clearViewOffset">clearViewOffset</a><span class="signature">()</span> </h3>
  164. <div class="method">
  165. <div class="description">
  166. <p>Removes the view offset from the projection matrix.</p>
  167. </div>
  168. </div>
  169. <h3 class="name name-method" id="setViewOffset" translate="no">.<a href="#setViewOffset">setViewOffset</a><span class="signature">( fullWidth : <span class="param-type">number</span>, fullHeight : <span class="param-type">number</span>, x : <span class="param-type">number</span>, y : <span class="param-type">number</span>, width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
  170. <div class="method">
  171. <div class="description">
  172. <p>Sets an offset in a larger frustum. This is useful for multi-window or
  173. multi-monitor/multi-machine setups.</p>
  174. </div>
  175. <table class="params">
  176. <tbody>
  177. <tr>
  178. <td class="name">
  179. <strong>fullWidth</strong>
  180. </td>
  181. <td class="description last">
  182. <p>The full width of multiview setup.</p>
  183. </td>
  184. </tr>
  185. <tr>
  186. <td class="name">
  187. <strong>fullHeight</strong>
  188. </td>
  189. <td class="description last">
  190. <p>The full height of multiview setup.</p>
  191. </td>
  192. </tr>
  193. <tr>
  194. <td class="name">
  195. <strong>x</strong>
  196. </td>
  197. <td class="description last">
  198. <p>The horizontal offset of the subcamera.</p>
  199. </td>
  200. </tr>
  201. <tr>
  202. <td class="name">
  203. <strong>y</strong>
  204. </td>
  205. <td class="description last">
  206. <p>The vertical offset of the subcamera.</p>
  207. </td>
  208. </tr>
  209. <tr>
  210. <td class="name">
  211. <strong>width</strong>
  212. </td>
  213. <td class="description last">
  214. <p>The width of subcamera.</p>
  215. </td>
  216. </tr>
  217. <tr>
  218. <td class="name">
  219. <strong>height</strong>
  220. </td>
  221. <td class="description last">
  222. <p>The height of subcamera.</p>
  223. </td>
  224. </tr>
  225. </tbody>
  226. </table>
  227. <dl class="details">
  228. <dt class="tag-see">See:</dt>
  229. <dd class="tag-see">
  230. <ul>
  231. <li><a href="PerspectiveCamera.html#setViewOffset">PerspectiveCamera#setViewOffset</a></li>
  232. </ul>
  233. </dd>
  234. </dl>
  235. </div>
  236. <h3 class="name name-method" id="updateProjectionMatrix" translate="no">.<a href="#updateProjectionMatrix">updateProjectionMatrix</a><span class="signature">()</span> </h3>
  237. <div class="method">
  238. <div class="description">
  239. <p>Updates the camera's projection matrix. Must be called after any change of
  240. camera properties.</p>
  241. </div>
  242. </div>
  243. <h2 class="subsection-title">Source</h2>
  244. <p>
  245. <a href="https://github.com/mrdoob/three.js/blob/master/src/cameras/OrthographicCamera.js" translate="no" target="_blank" rel="noopener">src/cameras/OrthographicCamera.js</a>
  246. </p>
  247. </article>
  248. </section>
  249. <script src="../scripts/linenumber.js"></script>
  250. <script src="../scripts/page.js"></script>
  251. </body>
  252. </html>
粤ICP备19079148号