CSMShadowNode.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CSMShadowNode - 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="Node.html">Node</a> → <a href="ShadowBaseNode.html">ShadowBaseNode</a> → </p>
  13. <h1 translate="no">CSMShadowNode</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>An implementation of Cascade Shadow Maps (CSM).</p>
  17. <p>This module can only be used with <a href="WebGPURenderer.html">WebGPURenderer</a>. When using <a href="WebGLRenderer.html">WebGLRenderer</a>,
  18. use <a href="CSM.html">CSM</a> instead.</p></div>
  19. </header>
  20. <article>
  21. <h2 class="subsection-title">Import</h2>
  22. <p><span translate="no">CSMShadowNode</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
  23. <pre><code class="language-js">import { CSMShadowNode } from 'three/addons/csm/CSMShadowNode.js';</code></pre>
  24. <div class="container-overview">
  25. <h2>Constructor</h2>
  26. <h3 class="name name-method" id="CSMShadowNode" translate="no">new <a href="#CSMShadowNode">CSMShadowNode</a><span class="signature">( light : <span class="param-type">DirectionalLight</span>, data : <span class="param-type">CSMShadowNode~Data</span> )</span> </h3>
  27. <div class="method">
  28. <div class="description">
  29. <p>Constructs a new CSM shadow node.</p>
  30. </div>
  31. <table class="params">
  32. <tbody>
  33. <tr>
  34. <td class="name"><code>light</code></td>
  35. <td class="description last"><p>The CSM light.</p></td>
  36. </tr>
  37. <tr>
  38. <td class="name"><code>data</code></td>
  39. <td class="description last"><p>The CSM data.<br/>Default is <code>{}</code>.</p></td>
  40. </tr>
  41. </tbody>
  42. </table>
  43. </div>
  44. </div>
  45. <h2 class="subsection-title">Properties</h2>
  46. <div class="member">
  47. <h3 class="name" id="breaks" translate="no">.<a href="#breaks">breaks</a><span class="type-signature"> : Array.&lt;number></span> </h3>
  48. <div class="description">
  49. <p>An array of numbers in the range <code>[0,1]</code> the defines how the
  50. mainCSM frustum should be split up.</p>
  51. </div>
  52. </div>
  53. <div class="member">
  54. <h3 class="name" id="camera" translate="no">.<a href="#camera">camera</a><span class="type-signature"> : <a href="Camera.html">Camera</a></span> </h3>
  55. <div class="description">
  56. <p>The scene's camera.<br/>Default is <code>null</code>.</p>
  57. </div>
  58. </div>
  59. <div class="member">
  60. <h3 class="name" id="cascades" translate="no">.<a href="#cascades">cascades</a><span class="type-signature"> : number</span> </h3>
  61. <div class="description">
  62. <p>The number of cascades.<br/>Default is <code>3</code>.</p>
  63. </div>
  64. </div>
  65. <div class="member">
  66. <h3 class="name" id="customSplitsCallback" translate="no">.<a href="#customSplitsCallback">customSplitsCallback</a><span class="type-signature"> : function</span> </h3>
  67. <div class="description">
  68. <p>Custom split callback when using <code>mode='custom'</code>.</p>
  69. </div>
  70. </div>
  71. <div class="member">
  72. <h3 class="name" id="fade" translate="no">.<a href="#fade">fade</a><span class="type-signature"> : boolean</span> </h3>
  73. <div class="description">
  74. <p>Whether to fade between cascades or not.<br/>Default is <code>false</code>.</p>
  75. </div>
  76. </div>
  77. <div class="member">
  78. <h3 class="name" id="frustums" translate="no">.<a href="#frustums">frustums</a><span class="type-signature"> : Array.&lt;<a href="CSMFrustum.html">CSMFrustum</a>></span> </h3>
  79. <div class="description">
  80. <p>An array of frustums representing the cascades.</p>
  81. </div>
  82. </div>
  83. <div class="member">
  84. <h3 class="name" id="lightMargin" translate="no">.<a href="#lightMargin">lightMargin</a><span class="type-signature"> : number</span> </h3>
  85. <div class="description">
  86. <p>The light margin.<br/>Default is <code>200</code>.</p>
  87. </div>
  88. </div>
  89. <div class="member">
  90. <h3 class="name" id="lights" translate="no">.<a href="#lights">lights</a><span class="type-signature"> : Array.&lt;<a href="DirectionalLight.html">DirectionalLight</a>></span> </h3>
  91. <div class="description">
  92. <p>An array of directional lights which cast the shadows for
  93. the different cascades. There is one directional light for each
  94. cascade.</p>
  95. </div>
  96. </div>
  97. <div class="member">
  98. <h3 class="name" id="mainFrustum" translate="no">.<a href="#mainFrustum">mainFrustum</a><span class="type-signature"> : <a href="CSMFrustum.html">CSMFrustum</a></span> </h3>
  99. <div class="description">
  100. <p>The main frustum.<br/>Default is <code>null</code>.</p>
  101. </div>
  102. </div>
  103. <div class="member">
  104. <h3 class="name" id="maxFar" translate="no">.<a href="#maxFar">maxFar</a><span class="type-signature"> : number</span> </h3>
  105. <div class="description">
  106. <p>The maximum far value.<br/>Default is <code>100000</code>.</p>
  107. </div>
  108. </div>
  109. <div class="member">
  110. <h3 class="name" id="mode" translate="no">.<a href="#mode">mode</a><span class="type-signature"> : 'practical' | 'uniform' | 'logarithmic' | 'custom'</span> </h3>
  111. <div class="description">
  112. <p>The frustum split mode.<br/>Default is <code>'practical'</code>.</p>
  113. </div>
  114. </div>
  115. <h2 class="subsection-title">Methods</h2>
  116. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  117. <div class="method">
  118. <div class="description">
  119. <p>Frees the GPU-related resources allocated by this instance. Call this
  120. method whenever this instance is no longer used in your app.</p>
  121. </div>
  122. <dl class="details">
  123. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="ShadowBaseNode.html#dispose">ShadowBaseNode#dispose</a></dt>
  124. </dl>
  125. </div>
  126. <h3 class="name name-method" id="updateFrustums" translate="no">.<a href="#updateFrustums">updateFrustums</a><span class="signature">()</span> </h3>
  127. <div class="method">
  128. <div class="description">
  129. <p>Applications must call this method every time they change camera or CSM settings.</p>
  130. </div>
  131. </div>
  132. <h2 class="subsection-title">Type Definitions</h2>
  133. <div class="member">
  134. <h3 class="name" id="~Data" translate="no">.<a href="#~Data">Data</a> </h3>
  135. <div class="description">
  136. <p>Constructor data of <code>CSMShadowNode</code>.</p>
  137. </div>
  138. <h5 class="subsection-title">Properties:</h5>
  139. <table class="props">
  140. <thead>
  141. <tr>
  142. <th>Name</th>
  143. <th>Type</th>
  144. <th>Attributes</th>
  145. <th>Default</th>
  146. <th class="last">Description</th>
  147. </tr>
  148. </thead>
  149. <tbody>
  150. <tr>
  151. <td class="name"><code>cascades</code></td>
  152. <td class="type">
  153. <span class="param-type">number</span>
  154. </td>
  155. <td class="attributes">
  156. &lt;optional><br>
  157. </td>
  158. <td class="default">
  159. 3
  160. </td>
  161. <td class="description last"><p>The number of cascades.</p></td>
  162. </tr>
  163. <tr>
  164. <td class="name"><code>maxFar</code></td>
  165. <td class="type">
  166. <span class="param-type">number</span>
  167. </td>
  168. <td class="attributes">
  169. &lt;optional><br>
  170. </td>
  171. <td class="default">
  172. 100000
  173. </td>
  174. <td class="description last"><p>The maximum far value.</p></td>
  175. </tr>
  176. <tr>
  177. <td class="name"><code>mode</code></td>
  178. <td class="type">
  179. <span class="param-type">'practical'</span>
  180. |
  181. <span class="param-type">'uniform'</span>
  182. |
  183. <span class="param-type">'logarithmic'</span>
  184. |
  185. <span class="param-type">'custom'</span>
  186. </td>
  187. <td class="attributes">
  188. &lt;optional><br>
  189. </td>
  190. <td class="default">
  191. 'practical'
  192. </td>
  193. <td class="description last"><p>The frustum split mode.</p></td>
  194. </tr>
  195. <tr>
  196. <td class="name"><code>customSplitsCallback</code></td>
  197. <td class="type">
  198. <span class="param-type">function</span>
  199. </td>
  200. <td class="attributes">
  201. &lt;optional><br>
  202. </td>
  203. <td class="default">
  204. </td>
  205. <td class="description last"><p>Custom split callback when using <code>mode='custom'</code>.</p></td>
  206. </tr>
  207. <tr>
  208. <td class="name"><code>lightMargin</code></td>
  209. <td class="type">
  210. <span class="param-type">number</span>
  211. </td>
  212. <td class="attributes">
  213. &lt;optional><br>
  214. </td>
  215. <td class="default">
  216. 200
  217. </td>
  218. <td class="description last"><p>The light margin.</p></td>
  219. </tr>
  220. </tbody>
  221. </table>
  222. </div>
  223. <h2 class="subsection-title">Source</h2>
  224. <p>
  225. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/csm/CSMShadowNode.js" target="_blank" rel="noopener" translate="no">examples/jsm/csm/CSMShadowNode.js</a>
  226. </p>
  227. </article>
  228. </section>
  229. <script src="../scripts/linenumber.js"></script>
  230. <script src="../scripts/page.js"></script>
  231. </body>
  232. </html>
粤ICP备19079148号