Mesh.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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">BufferGeometry</span>, material : <span class="param-type">Material | Array.&lt;Material></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"><code>geometry</code></td>
  36. <td class="description last"><p>The mesh geometry.</p></td>
  37. </tr>
  38. <tr>
  39. <td class="name"><code>material</code></td>
  40. <td class="description last"><p>The mesh material.</p></td>
  41. </tr>
  42. </tbody>
  43. </table>
  44. </div>
  45. </div>
  46. <h2 class="subsection-title">Properties</h2>
  47. <div class="member">
  48. <h3 class="name" id="count" translate="no">.<a href="#count">count</a><span class="type-signature"> : number</span> </h3>
  49. <div class="description">
  50. <p>The number of instances of this mesh.
  51. Can only be used with <a href="WebGPURenderer.html">WebGPURenderer</a>.<br/>Default is <code>1</code>.</p>
  52. </div>
  53. </div>
  54. <div class="member">
  55. <h3 class="name" id="geometry" translate="no">.<a href="#geometry">geometry</a><span class="type-signature"> : <a href="BufferGeometry.html">BufferGeometry</a></span> </h3>
  56. <div class="description">
  57. <p>The mesh geometry.</p>
  58. </div>
  59. </div>
  60. <div class="member">
  61. <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>
  62. <div class="description">
  63. <p>This flag can be used for type testing.<br/>Default is <code>true</code>.</p>
  64. </div>
  65. </div>
  66. <div class="member">
  67. <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>
  68. <div class="description">
  69. <p>The mesh material.<br/>Default is <code>MeshBasicMaterial</code>.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="morphTargetDictionary" translate="no">.<a href="#morphTargetDictionary">morphTargetDictionary</a><span class="type-signature"> : Object.&lt;String, number> | undefined</span> </h3>
  74. <div class="description">
  75. <p>A dictionary representing the morph targets in the geometry. The key is the
  76. morph targets name, the value its attribute index. This member is <code>undefined</code>
  77. by default and only set when morph targets are detected in the geometry.<br/>Default is <code>undefined</code>.</p>
  78. </div>
  79. </div>
  80. <div class="member">
  81. <h3 class="name" id="morphTargetInfluences" translate="no">.<a href="#morphTargetInfluences">morphTargetInfluences</a><span class="type-signature"> : Array.&lt;number> | undefined</span> </h3>
  82. <div class="description">
  83. <p>An array of weights typically in the range <code>[0,1]</code> that specify how much of the morph
  84. is applied. This member is <code>undefined</code> by default and only set when morph targets are
  85. detected in the geometry.<br/>Default is <code>undefined</code>.</p>
  86. </div>
  87. </div>
  88. <h2 class="subsection-title">Methods</h2>
  89. <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">Vector3</span> )</span><span class="type-signature"> : <a href="Vector3.html">Vector3</a></span> </h3>
  90. <div class="method">
  91. <div class="description">
  92. <p>Returns the local-space position of the vertex at the given index, taking into
  93. account the current animation state of both morph targets and skinning.</p>
  94. </div>
  95. <table class="params">
  96. <tbody>
  97. <tr>
  98. <td class="name"><code>index</code></td>
  99. <td class="description last"><p>The vertex index.</p></td>
  100. </tr>
  101. <tr>
  102. <td class="name"><code>target</code></td>
  103. <td class="description last"><p>The target object that is used to store the method's result.</p></td>
  104. </tr>
  105. </tbody>
  106. </table>
  107. <dl class="details">
  108. <dt class="tag-returns"><strong>Returns:</strong> The vertex position in local space.</dt>
  109. </dl>
  110. </div>
  111. <h3 class="name name-method" id="raycast" translate="no">.<a href="#raycast">raycast</a><span class="signature">( raycaster : <span class="param-type">Raycaster</span>, intersects : <span class="param-type">Array.&lt;Object></span> )</span> </h3>
  112. <div class="method">
  113. <div class="description">
  114. <p>Computes intersection points between a casted ray and this line.</p>
  115. </div>
  116. <table class="params">
  117. <tbody>
  118. <tr>
  119. <td class="name"><code>raycaster</code></td>
  120. <td class="description last"><p>The raycaster.</p></td>
  121. </tr>
  122. <tr>
  123. <td class="name"><code>intersects</code></td>
  124. <td class="description last"><p>The target array that holds the intersection points.</p></td>
  125. </tr>
  126. </tbody>
  127. </table>
  128. <dl class="details">
  129. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Object3D.html#raycast">Object3D#raycast</a></dt>
  130. </dl>
  131. </div>
  132. <h3 class="name name-method" id="updateMorphTargets" translate="no">.<a href="#updateMorphTargets">updateMorphTargets</a><span class="signature">()</span> </h3>
  133. <div class="method">
  134. <div class="description">
  135. <p>Sets the values of <a href="Mesh.html#morphTargetDictionary">Mesh#morphTargetDictionary</a> and <a href="Mesh.html#morphTargetInfluences">Mesh#morphTargetInfluences</a>
  136. to make sure existing morph targets can influence this 3D object.</p>
  137. </div>
  138. </div>
  139. <h2 class="subsection-title">Source</h2>
  140. <p>
  141. <a href="https://github.com/mrdoob/three.js/blob/master/src/objects/Mesh.js" target="_blank" rel="noopener" translate="no">src/objects/Mesh.js</a>
  142. </p>
  143. </article>
  144. </section>
  145. <script src="../scripts/linenumber.js"></script>
  146. <script src="../scripts/page.js"></script>
  147. </body>
  148. </html>
粤ICP备19079148号