CSMFrustum.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CSMFrustum - 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. <h1 translate="no">CSMFrustum</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Represents the frustum of a CSM instance.</p></div>
  16. </header>
  17. <article>
  18. <h2 class="subsection-title">Import</h2>
  19. <p><span translate="no">CSMFrustum</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  20. <pre><code class="language-js">import { CSMFrustum } from 'three/addons/csm/CSMFrustum.js';</code></pre>
  21. <div class="container-overview">
  22. <h2>Constructor</h2>
  23. <h3 class="name name-method" id="CSMFrustum" translate="no">new <a href="#CSMFrustum">CSMFrustum</a><span class="signature">( data : <span class="param-type"><a href="CSMFrustum.html#~Data">CSMFrustum~Data</a></span> )</span> </h3>
  24. <div class="method">
  25. <div class="description">
  26. <p>Constructs a new CSM frustum.</p>
  27. </div>
  28. <table class="params">
  29. <tbody>
  30. <tr>
  31. <td class="name">
  32. <strong translate="no">data</strong>
  33. </td>
  34. <td class="description last">
  35. <p>The CSM data.</p>
  36. </td>
  37. </tr>
  38. </tbody>
  39. </table>
  40. </div>
  41. </div>
  42. <h2 class="subsection-title">Properties</h2>
  43. <div class="member">
  44. <h3 class="name" id="vertices" translate="no">.<a href="#vertices">vertices</a><span class="type-signature"> : Object</span> </h3>
  45. <div class="description">
  46. <p>An object representing the vertices of the near and
  47. far plane in view space.</p>
  48. </div>
  49. </div>
  50. <div class="member">
  51. <h3 class="name" id="zFar" translate="no">.<a href="#zFar">zFar</a><span class="type-signature"> : number</span> </h3>
  52. <div class="description">
  53. <p>The zFar value.</p>
  54. </div>
  55. </div>
  56. <div class="member">
  57. <h3 class="name" id="zNear" translate="no">.<a href="#zNear">zNear</a><span class="type-signature"> : number</span> </h3>
  58. <div class="description">
  59. <p>The zNear value. This value depends on whether the CSM
  60. is used with WebGL or WebGPU. Both API use different
  61. conventions for their projection matrices.</p>
  62. </div>
  63. </div>
  64. <h2 class="subsection-title">Methods</h2>
  65. <h3 class="name name-method" id="setFromProjectionMatrix" translate="no">.<a href="#setFromProjectionMatrix">setFromProjectionMatrix</a><span class="signature">( projectionMatrix : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span>, maxFar : <span class="param-type">number</span> )</span><span class="type-signature"> : Object</span> </h3>
  66. <div class="method">
  67. <div class="description">
  68. <p>Setups this CSM frustum from the given projection matrix and max far value.</p>
  69. </div>
  70. <table class="params">
  71. <tbody>
  72. <tr>
  73. <td class="name">
  74. <strong translate="no">projectionMatrix</strong>
  75. </td>
  76. <td class="description last">
  77. <p>The projection matrix, usually of the scene's camera.</p>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td class="name">
  82. <strong translate="no">maxFar</strong>
  83. </td>
  84. <td class="description last">
  85. <p>The maximum far value.</p>
  86. </td>
  87. </tr>
  88. </tbody>
  89. </table>
  90. <dl class="details">
  91. <dt class="tag-returns"><strong>Returns:</strong> An object representing the vertices of the near and far plane in view space.</dt>
  92. </dl>
  93. </div>
  94. <h3 class="name name-method" id="split" translate="no">.<a href="#split">split</a><span class="signature">( breaks : <span class="param-type">Array.&lt;number></span>, target : <span class="param-type">Array.&lt;<a href="CSMFrustum.html">CSMFrustum</a>></span> )</span> </h3>
  95. <div class="method">
  96. <div class="description">
  97. <p>Splits the CSM frustum by the given array. The new CSM frustum are pushed into the given
  98. target array.</p>
  99. </div>
  100. <table class="params">
  101. <tbody>
  102. <tr>
  103. <td class="name">
  104. <strong translate="no">breaks</strong>
  105. </td>
  106. <td class="description last">
  107. <p>An array of numbers in the range <code>[0,1]</code> the defines how the
  108. CSM frustum should be split up.</p>
  109. </td>
  110. </tr>
  111. <tr>
  112. <td class="name">
  113. <strong translate="no">target</strong>
  114. </td>
  115. <td class="description last">
  116. <p>The target array that holds the new CSM frustums.</p>
  117. </td>
  118. </tr>
  119. </tbody>
  120. </table>
  121. </div>
  122. <h3 class="name name-method" id="toSpace" translate="no">.<a href="#toSpace">toSpace</a><span class="signature">( cameraMatrix : <span class="param-type"><a href="Matrix4.html">Matrix4</a></span>, target : <span class="param-type"><a href="CSMFrustum.html">CSMFrustum</a></span> )</span> </h3>
  123. <div class="method">
  124. <div class="description">
  125. <p>Transforms the given target CSM frustum into the different coordinate system defined by the
  126. given camera matrix.</p>
  127. </div>
  128. <table class="params">
  129. <tbody>
  130. <tr>
  131. <td class="name">
  132. <strong translate="no">cameraMatrix</strong>
  133. </td>
  134. <td class="description last">
  135. <p>The matrix that defines the new coordinate system.</p>
  136. </td>
  137. </tr>
  138. <tr>
  139. <td class="name">
  140. <strong translate="no">target</strong>
  141. </td>
  142. <td class="description last">
  143. <p>The CSM to convert.</p>
  144. </td>
  145. </tr>
  146. </tbody>
  147. </table>
  148. </div>
  149. <h2 class="subsection-title">Type Definitions</h2>
  150. <div class="member">
  151. <h3 class="name" id="~Data" translate="no">.<a href="#~Data">Data</a> </h3>
  152. <div class="description">
  153. <p>Constructor data of <code>CSMFrustum</code>.</p>
  154. </div>
  155. <table class="props">
  156. <tbody>
  157. <tr>
  158. <td class="name">
  159. <strong>webGL</strong>
  160. <br>
  161. <span class="param-type">boolean</span>
  162. </td>
  163. <td class="description last">
  164. <p>Whether this CSM frustum is used with WebGL or WebGPU.</p>
  165. </td>
  166. </tr>
  167. <tr>
  168. <td class="name">
  169. <strong>reversedDepth</strong>
  170. <br>
  171. <span class="param-type">boolean</span>
  172. </td>
  173. <td class="description last">
  174. <p>Whether reversed depth buffer is enabled.</p>
  175. </td>
  176. </tr>
  177. <tr>
  178. <td class="name">
  179. <strong>projectionMatrix</strong>
  180. <br>
  181. <span class="param-type"><a href="Matrix4.html">Matrix4</a></span>
  182. </td>
  183. <td class="description last">
  184. <p>A projection matrix usually of the scene's camera.</p>
  185. </td>
  186. </tr>
  187. <tr>
  188. <td class="name">
  189. <strong>maxFar</strong>
  190. <br>
  191. <span class="param-type">number</span>
  192. </td>
  193. <td class="description last">
  194. <p>The maximum far value.</p>
  195. </td>
  196. </tr>
  197. </tbody>
  198. </table>
  199. </div>
  200. <h2 class="subsection-title">Source</h2>
  201. <p>
  202. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/csm/CSMFrustum.js" translate="no" target="_blank" rel="noopener">examples/jsm/csm/CSMFrustum.js</a>
  203. </p>
  204. </article>
  205. </section>
  206. <script src="../scripts/linenumber.js"></script>
  207. <script src="../scripts/page.js"></script>
  208. </body>
  209. </html>
粤ICP备19079148号