PointsMaterial.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>PointsMaterial - 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> → </p>
  13. <h1 translate="no">PointsMaterial</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A material for rendering point primitives.</p>
  17. <p>Materials define the appearance of renderable 3D objects.</p></div>
  18. <h2>Code Example</h2>
  19. <div translate="no"><pre><code class="language-js">const vertices = [];
  20. for ( let i = 0; i &lt; 10000; i ++ ) {
  21. const x = THREE.MathUtils.randFloatSpread( 2000 );
  22. const y = THREE.MathUtils.randFloatSpread( 2000 );
  23. const z = THREE.MathUtils.randFloatSpread( 2000 );
  24. vertices.push( x, y, z );
  25. }
  26. const geometry = new THREE.BufferGeometry();
  27. geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
  28. const material = new THREE.PointsMaterial( { color: 0x888888 } );
  29. const points = new THREE.Points( geometry, material );
  30. scene.add( points );
  31. </code></pre></div>
  32. </header>
  33. <article>
  34. <div class="container-overview">
  35. <h2>Constructor</h2>
  36. <h3 class="name name-method" id="PointsMaterial" translate="no">new <a href="#PointsMaterial">PointsMaterial</a><span class="signature">( parameters : <span class="param-type">Object</span> )</span> </h3>
  37. <div class="method">
  38. <div class="description">
  39. <p>Constructs a new points material.</p>
  40. </div>
  41. <table class="params">
  42. <tbody>
  43. <tr>
  44. <td class="name"><code>parameters</code></td>
  45. <td class="description last"><p>An object with one or more properties
  46. defining the material's appearance. Any property of the material
  47. (including any property from inherited materials) can be passed
  48. in here. Color values can be passed any type of value accepted
  49. by <a href="Color.html#set">Color#set</a>.</p></td>
  50. </tr>
  51. </tbody>
  52. </table>
  53. </div>
  54. </div>
  55. <h2 class="subsection-title">Properties</h2>
  56. <div class="member">
  57. <h3 class="name" id="alphaMap" translate="no">.<a href="#alphaMap">alphaMap</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  58. <div class="description">
  59. <p>The alpha map is a grayscale texture that controls the opacity across the
  60. surface (black: fully transparent; white: fully opaque).</p>
  61. <p>Only the color of the texture is used, ignoring the alpha channel if one
  62. exists. For RGB and RGBA textures, the renderer will use the green channel
  63. when sampling this texture due to the extra bit of precision provided for
  64. green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
  65. luminance/alpha textures will also still work as expected.<br/>Default is <code>null</code>.</p>
  66. </div>
  67. </div>
  68. <div class="member">
  69. <h3 class="name" id="color" translate="no">.<a href="#color">color</a><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  70. <div class="description">
  71. <p>Color of the material.<br/>Default is <code>(1,1,1)</code>.</p>
  72. </div>
  73. </div>
  74. <div class="member">
  75. <h3 class="name" id="fog" translate="no">.<a href="#fog">fog</a><span class="type-signature"> : boolean</span> </h3>
  76. <div class="description">
  77. <p>Whether the material is affected by fog or not.<br/>Default is <code>true</code>.</p>
  78. </div>
  79. </div>
  80. <div class="member">
  81. <h3 class="name" id="isPointsMaterial" translate="no">.<a href="#isPointsMaterial">isPointsMaterial</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  82. <div class="description">
  83. <p>This flag can be used for type testing.<br/>Default is <code>true</code>.</p>
  84. </div>
  85. </div>
  86. <div class="member">
  87. <h3 class="name" id="map" translate="no">.<a href="#map">map</a><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  88. <div class="description">
  89. <p>The color map. May optionally include an alpha channel, typically combined
  90. with <a href="Material.html#transparent">Material#transparent</a> or <a href="Material.html#alphaTest">Material#alphaTest</a>. The texture map
  91. color is modulated by the diffuse <code>color</code>.<br/>Default is <code>null</code>.</p>
  92. </div>
  93. </div>
  94. <div class="member">
  95. <h3 class="name" id="size" translate="no">.<a href="#size">size</a><span class="type-signature"> : number</span> </h3>
  96. <div class="description">
  97. <p>Defines the size of the points in pixels.</p>
  98. <p>Might be capped if the value exceeds hardware dependent parameters like <a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParamete">gl.ALIASED_POINT_SIZE_RANGE</a>.<br/>Default is <code>1</code>.</p>
  99. </div>
  100. </div>
  101. <div class="member">
  102. <h3 class="name" id="sizeAttenuation" translate="no">.<a href="#sizeAttenuation">sizeAttenuation</a><span class="type-signature"> : boolean</span> </h3>
  103. <div class="description">
  104. <p>Specifies whether size of individual points is attenuated by the camera depth (perspective camera only).<br/>Default is <code>true</code>.</p>
  105. </div>
  106. </div>
  107. <h2 class="subsection-title">Source</h2>
  108. <p>
  109. <a href="https://github.com/mrdoob/three.js/blob/master/src/materials/PointsMaterial.js" target="_blank" rel="noopener" translate="no">src/materials/PointsMaterial.js</a>
  110. </p>
  111. </article>
  112. </section>
  113. <script src="../scripts/linenumber.js"></script>
  114. <script src="../scripts/page.js"></script>
  115. </body>
  116. </html>
粤ICP备19079148号