1
0

SpriteNodeMaterial.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>SpriteNodeMaterial - 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="Material.html">Material</a> → <a href="NodeMaterial.html">NodeMaterial</a> → </p>
  13. <h1 translate="no">SpriteNodeMaterial</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Node material version of <a href="SpriteMaterial.html">SpriteMaterial</a>.</p></div>
  17. </header>
  18. <article>
  19. <div class="container-overview">
  20. <h2>Constructor</h2>
  21. <h3 class="name name-method" id="SpriteNodeMaterial" translate="no">new <a href="#SpriteNodeMaterial">SpriteNodeMaterial</a><span class="signature">( parameters : <span class="param-type">Object</span> )</span> </h3>
  22. <div class="method">
  23. <div class="description">
  24. <p>Constructs a new sprite node material.</p>
  25. </div>
  26. <table class="params">
  27. <tbody>
  28. <tr>
  29. <td class="name">
  30. <strong>parameters</strong>
  31. </td>
  32. <td class="description last">
  33. <p>The configuration parameter.</p>
  34. </td>
  35. </tr>
  36. </tbody>
  37. </table>
  38. </div>
  39. </div>
  40. <h2 class="subsection-title">Properties</h2>
  41. <div class="member">
  42. <h3 class="name" id="isSpriteNodeMaterial" translate="no">.<a href="#isSpriteNodeMaterial">isSpriteNodeMaterial</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  43. <div class="description">
  44. <p>This flag can be used for type testing.</p>
  45. <p>Default is <code>true</code>.</p>
  46. </div>
  47. </div>
  48. <div class="member">
  49. <h3 class="name" id="positionNode" translate="no">.<a href="#positionNode">positionNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec2></span> </h3>
  50. <div class="description">
  51. <p>This property makes it possible to define the position of the sprite with a
  52. node. That can be useful when the material is used with instanced rendering
  53. and node data are defined with an instanced attribute node:</p>
  54. <pre><code class="language-js">const positionAttribute = new InstancedBufferAttribute( new Float32Array( positions ), 3 );
  55. material.positionNode = instancedBufferAttribute( positionAttribute );
  56. </code></pre>
  57. <p>Another possibility is to compute the instanced data with a compute shader:</p>
  58. <pre><code class="language-js">const positionBuffer = instancedArray( particleCount, 'vec3' );
  59. particleMaterial.positionNode = positionBuffer.toAttribute();
  60. </code></pre>
  61. <p>Default is <code>null</code>.</p>
  62. </div>
  63. <dl class="details">
  64. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeMaterial.html#positionNode">NodeMaterial#positionNode</a></dt>
  65. </dl>
  66. </div>
  67. <div class="member">
  68. <h3 class="name" id="rotationNode" translate="no">.<a href="#rotationNode">rotationNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;float></span> </h3>
  69. <div class="description">
  70. <p>The rotation of sprite materials is by default inferred from the <code>rotation</code>,
  71. property. This node property allows to overwrite the default and define
  72. the rotation with a node instead.</p>
  73. <p>If you don't want to overwrite the rotation but modify the existing
  74. value instead, use <a href="TSL.html#materialRotation">materialRotation</a>.</p>
  75. <p>Default is <code>null</code>.</p>
  76. </div>
  77. </div>
  78. <div class="member">
  79. <h3 class="name" id="scaleNode" translate="no">.<a href="#scaleNode">scaleNode</a><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec2></span> </h3>
  80. <div class="description">
  81. <p>This node property provides an additional way to scale sprites next to
  82. <code>Object3D.scale</code>. The scale transformation based in <code>Object3D.scale</code>
  83. is multiplied with the scale value of this node in the vertex shader.</p>
  84. <p>Default is <code>null</code>.</p>
  85. </div>
  86. </div>
  87. <div class="member">
  88. <h3 class="name" id="sizeAttenuation" translate="no">.<a href="#sizeAttenuation">sizeAttenuation</a><span class="type-signature"> : boolean</span> </h3>
  89. <div class="description">
  90. <p>Whether to use size attenuation or not.</p>
  91. <p>Default is <code>true</code>.</p>
  92. </div>
  93. </div>
  94. <div class="member">
  95. <h3 class="name" id="transparent" translate="no">.<a href="#transparent">transparent</a><span class="type-signature"> : boolean</span> </h3>
  96. <div class="description">
  97. <p>In Sprites, the transparent property is enabled by default.</p>
  98. <p>Default is <code>true</code>.</p>
  99. </div>
  100. <dl class="details">
  101. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeMaterial.html#transparent">NodeMaterial#transparent</a></dt>
  102. </dl>
  103. </div>
  104. <h2 class="subsection-title">Methods</h2>
  105. <h3 class="name name-method" id="setupPositionView" translate="no">.<a href="#setupPositionView">setupPositionView</a><span class="signature">( builder : <span class="param-type"><a href="NodeBuilder.html">NodeBuilder</a></span> )</span><span class="type-signature"> : <a href="Node.html">Node</a>.&lt;vec3></span> </h3>
  106. <div class="method">
  107. <div class="description">
  108. <p>Setups the position node in view space. This method implements
  109. the sprite specific vertex shader.</p>
  110. </div>
  111. <table class="params">
  112. <tbody>
  113. <tr>
  114. <td class="name">
  115. <strong>builder</strong>
  116. </td>
  117. <td class="description last">
  118. <p>The current node builder.</p>
  119. </td>
  120. </tr>
  121. </tbody>
  122. </table>
  123. <dl class="details">
  124. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="NodeMaterial.html#setupPositionView">NodeMaterial#setupPositionView</a></dt>
  125. </dl>
  126. <dl class="details">
  127. <dt class="tag-returns"><strong>Returns:</strong> The position in view space.</dt>
  128. </dl>
  129. </div>
  130. <h2 class="subsection-title">Source</h2>
  131. <p>
  132. <a href="https://github.com/mrdoob/three.js/blob/master/src/materials/nodes/SpriteNodeMaterial.js" translate="no" target="_blank" rel="noopener">src/materials/nodes/SpriteNodeMaterial.js</a>
  133. </p>
  134. </article>
  135. </section>
  136. <script src="../scripts/linenumber.js"></script>
  137. <script src="../scripts/page.js"></script>
  138. </body>
  139. </html>
粤ICP备19079148号