1
0

PointsMaterial.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Material] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">The default material used by [page:Points].</p>
  13. <h2>Code Example</h2>
  14. <code>
  15. const vertices = [];
  16. for ( let i = 0; i < 10000; i ++ ) {
  17. const x = THREE.MathUtils.randFloatSpread( 2000 );
  18. const y = THREE.MathUtils.randFloatSpread( 2000 );
  19. const z = THREE.MathUtils.randFloatSpread( 2000 );
  20. vertices.push( x, y, z );
  21. }
  22. const geometry = new THREE.BufferGeometry();
  23. geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
  24. const material = new THREE.PointsMaterial( { color: 0x888888 } );
  25. const points = new THREE.Points( geometry, material );
  26. scene.add( points );
  27. </code>
  28. <h2>Examples</h2>
  29. <p>
  30. [example:misc_controls_fly misc / controls / fly]<br />
  31. [example:webgl_buffergeometry_drawrange WebGL / BufferGeometry / drawrange]<br />
  32. [example:webgl_buffergeometry_points WebGL / BufferGeometry / points]<br />
  33. [example:webgl_buffergeometry_points_interleaved WebGL / BufferGeometry / points / interleaved]<br />
  34. [example:webgl_camera WebGL / camera ]<br />
  35. [example:webgl_geometry_convex WebGL / geometry / convex]<br />
  36. [example:webgl_geometry_shapes WebGL / geometry / shapes]<br />
  37. [example:webgl_interactive_raycasting_points WebGL / interactive / raycasting / points]<br />
  38. [example:webgl_multiple_elements_text WebGL / multiple / elements / text]<br />
  39. [example:webgl_points_billboards WebGL / points / billboards]<br />
  40. [example:webgl_points_dynamic WebGL / points / dynamic]<br />
  41. [example:webgl_points_sprites WebGL / points / sprites]
  42. </p>
  43. <h2>Constructor</h2>
  44. <h3>[name]( [param:Object parameters] )</h3>
  45. <p>
  46. [page:Object parameters] - (optional) an object with one or more
  47. properties defining the material's appearance. Any property of the
  48. material (including any property inherited from [page:Material]) can be
  49. passed in here.<br /><br />
  50. The exception is the property [page:Hexadecimal color], which can be
  51. passed in as a hexadecimal string and is `0xffffff` (white) by default.
  52. [page:Color.set]( color ) is called internally.
  53. </p>
  54. <h2>Properties</h2>
  55. <p>See the base [page:Material] class for common properties.</p>
  56. <h3>[property:Texture alphaMap]</h3>
  57. <p>
  58. The alpha map is a grayscale texture that controls the opacity across the
  59. surface (black: fully transparent; white: fully opaque). Default is
  60. null.<br /><br />
  61. Only the color of the texture is used, ignoring the alpha channel if one
  62. exists. For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer
  63. will use the green channel when sampling this texture due to the extra bit
  64. of precision provided for green in DXT-compressed and uncompressed RGB 565
  65. formats. Luminance-only and luminance/alpha textures will also still work
  66. as expected.
  67. </p>
  68. <h3>[property:Color color]</h3>
  69. <p>[page:Color] of the material, by default set to white (0xffffff).</p>
  70. <h3>[property:Boolean fog]</h3>
  71. <p>Whether the material is affected by fog. Default is `true`.</p>
  72. <h3>[property:Texture map]</h3>
  73. <p>
  74. Sets the color of the points using data from a [page:Texture]. May
  75. optionally include an alpha channel, typically combined with
  76. [page:Material.transparent .transparent] or [page:Material.alphaTest .alphaTest].
  77. </p>
  78. <h3>[property:Number size]</h3>
  79. <p>
  80. Defines the size of the points in pixels. Default is `1.0`.<br />
  81. Will be capped if it exceeds the hardware dependent parameter
  82. [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParameter gl.ALIASED_POINT_SIZE_RANGE].
  83. </p>
  84. <h3>[property:Boolean sizeAttenuation]</h3>
  85. <p>
  86. Specify whether points' size is attenuated by the camera depth.
  87. (Perspective camera only.) Default is true.
  88. </p>
  89. <h2>Methods</h2>
  90. <p>See the base [page:Material] class for common methods.</p>
  91. <h2>Source</h2>
  92. <p>
  93. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  94. </p>
  95. </body>
  96. </html>