Mesh.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Mesh - 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> → </p>
  13. <h1 translate="no">Mesh</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Class representing triangular polygon mesh based objects.</p></div>
  17. <h2>Code Example</h2>
  18. <div translate="no"><pre><code class="language-js">const geometry = new THREE.BoxGeometry( 1, 1, 1 );
  19. const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
  20. const mesh = new THREE.Mesh( geometry, material );
  21. scene.add( mesh );
  22. </code></pre></div>
  23. </header>
  24. <article>
  25. <div class="container-overview">
  26. <h2>Constructor</h2>
  27. <h3 class="name name-method" id="Mesh" translate="no">new <a href="#Mesh">Mesh</a><span class="signature">( geometry : <span class="param-type"><a href="BufferGeometry.html">BufferGeometry</a></span>, material : <span class="param-type"><a href="Material.html">Material</a> | Array.&lt;<a href="Material.html">Material</a>></span> )</span> </h3>
  28. <div class="method">
  29. <div class="description">
  30. <p>Constructs a new mesh.</p>
  31. </div>
  32. <table class="params">
  33. <tbody>
  34. <tr>
  35. <td class="name">
  36. <strong>geometry</strong>
  37. </td>
  38. <td class="description last">
  39. <p>The mesh geometry.</p>
  40. </td>
  41. </tr>
  42. <tr>
  43. <td class="name">
  44. <strong>material</strong>
  45. </td>
  46. <td class="description last">
  47. <p>The mesh material.</p>
  48. </td>
  49. </tr>
  50. </tbody>
  51. </table>
  52. </div>
  53. </div>
  54. <h2 class="subsection-title">Properties</h2>
  55. <div class="member">
  56. <h3 class="name" id="count" translate="no">.<a href="#count">count</a><span class="type-signature"> : number</span> </h3>
  57. <div class="description">
  58. <p>The number of instances of this mesh.
  59. Can only be used with <a href="WebGPURenderer.html">WebGPURenderer</a>.</p>
  60. <p>Default is <code>1</code>.</p>
  61. </div>
  62. </div>
  63. <div class="member">
  64. <h3 class="name" id="geometry" translate="no">.<a href="#geometry">geometry</a><span class="type-signature"> : <a href="BufferGeometry.html">BufferGeometry</a></span> </h3>
  65. <div class="description">
  66. <p>The mesh geometry.</p>
  67. </div>
  68. </div>
  69. <div class="member">
  70. <h3 class="name" id="isMesh" translate="no">.<a href="#isMesh">isMesh</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  71. <div class="description">
  72. <p>This flag can be used for type testing.</p>
  73. <p>Default is <code>true</code>.</p>
  74. </div>
  75. </div>
  76. <div class="member">
  77. <h3 class="name" id="material" translate="no">.<a href="#material">material</a><span class="type-signature"> : <a href="Material.html">Material</a> | Array.&lt;<a href="Material.html">Material</a>></span> </h3>
  78. <div class="description">
  79. <p>The mesh material.</p>
  80. <p>Default is <code>MeshBasicMaterial</code>.</p>
  81. </div>
  82. </div>
  83. <div class="member">
  84. <h3 class="name" id="morphTargetDictionary" translate="no">.<a href="#morphTargetDictionary">morphTargetDictionary</a><span class="type-signature"> : Object.&lt;String, number> | undefined</span> </h3>
  85. <div class="description">
  86. <p>A dictionary representing the morph targets in the geometry. The key is the
  87. morph targets name, the value its attribute index. This member is <code>undefined</code>
  88. by default and only set when morph targets are detected in the geometry.</p>
  89. <p>Default is <code>undefined</code>.</p>
  90. </div>
  91. </div>
  92. <div class="member">
  93. <h3 class="name" id="morphTargetInfluences" translate="no">.<a href="#morphTargetInfluences">morphTargetInfluences</a><span class="type-signature"> : Array.&lt;number> | undefined</span> </h3>
  94. <div class="description">
  95. <p>An array of weights typically in the range <code>[0,1]</code> that specify how much of the morph
  96. is applied. This member is <code>undefined</code> by default and only set when morph targets are
  97. detected in the geometry.</p>
  98. <p>Default is <code>undefined</code>.</p>
  99. </div>
  100. </div>
  101. <h2 class="subsection-title">Methods</h2>
  102. <h3 class="name name-method" id="getVertexPosition" translate="no">.<a href="#getVertexPosition">getVertexPosition</a><span class="signature">( index : <span class="param-type">number</span>, target : <span class="param-type"><a href="Vector3.html">Vector3</a></span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  103. <div class="method">
  104. <div class="description">
  105. <p>Returns the local-space position of the vertex at the given index, taking into
  106. account the current animation state of both morph targets and skinning.</p>
  107. </div>
  108. <table class="params">
  109. <tbody>
  110. <tr>
  111. <td class="name">
  112. <strong>index</strong>
  113. </td>
  114. <td class="description last">
  115. <p>The vertex index.</p>
  116. </td>
  117. </tr>
  118. <tr>
  119. <td class="name">
  120. <strong>target</strong>
  121. </td>
  122. <td class="description last">
  123. <p>The target object that is used to store the method's result.</p>
  124. </td>
  125. </tr>
  126. </tbody>
  127. </table>
  128. <dl class="details">
  129. <dt class="tag-returns"><strong>Returns:</strong> The vertex position in local space.</dt>
  130. </dl>
  131. </div>
  132. <h3 class="name name-method" id="raycast" translate="no">.<a href="#raycast">raycast</a><span class="signature">( raycaster : <span class="param-type"><a href="Raycaster.html">Raycaster</a></span>, intersects : <span class="param-type">Array.&lt;Object></span> )</span> </h3>
  133. <div class="method">
  134. <div class="description">
  135. <p>Computes intersection points between a casted ray and this line.</p>
  136. </div>
  137. <table class="params">
  138. <tbody>
  139. <tr>
  140. <td class="name">
  141. <strong>raycaster</strong>
  142. </td>
  143. <td class="description last">
  144. <p>The raycaster.</p>
  145. </td>
  146. </tr>
  147. <tr>
  148. <td class="name">
  149. <strong>intersects</strong>
  150. </td>
  151. <td class="description last">
  152. <p>The target array that holds the intersection points.</p>
  153. </td>
  154. </tr>
  155. </tbody>
  156. </table>
  157. <dl class="details">
  158. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Object3D.html#raycast">Object3D#raycast</a></dt>
  159. </dl>
  160. </div>
  161. <h3 class="name name-method" id="updateMorphTargets" translate="no">.<a href="#updateMorphTargets">updateMorphTargets</a><span class="signature">()</span> </h3>
  162. <div class="method">
  163. <div class="description">
  164. <p>Sets the values of <a href="Mesh.html#morphTargetDictionary">Mesh#morphTargetDictionary</a> and <a href="Mesh.html#morphTargetInfluences">Mesh#morphTargetInfluences</a>
  165. to make sure existing morph targets can influence this 3D object.</p>
  166. </div>
  167. </div>
  168. <h2 class="subsection-title">Source</h2>
  169. <p>
  170. <a href="https://github.com/mrdoob/three.js/blob/master/src/objects/Mesh.js" translate="no" target="_blank" rel="noopener">src/objects/Mesh.js</a>
  171. </p>
  172. </article>
  173. </section>
  174. <script src="../scripts/linenumber.js"></script>
  175. <script src="../scripts/page.js"></script>
  176. </body>
  177. </html>
粤ICP备19079148号