Material.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <script src="../../list.js"></script>
  6. <script src="../../page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="../../page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <div class="desc">Materials describe the appearance of [page:Object objects]. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer.</div>
  12. <h2>Constructor</h2>
  13. <h3>[name]()</h3>
  14. <div>
  15. This creates a generic material.
  16. </div>
  17. <h2>Properties</h2>
  18. <h3>.[page:Integer id]</h3>
  19. <div>
  20. Unique number of this material instance.
  21. </div>
  22. <h3>.[page:String name]</h3>
  23. <div>
  24. Material name. Default is an empty string.
  25. </div>
  26. <h3>.[page:Float opacity]</h3>
  27. <div>
  28. Float in the range of 0.0 - 1.0 indicating how transparent the material is.
  29. A value of 0.0 indicates fully transparent, 1.0 is fully opaque. If
  30. *transparent* is not set to true for the material, the material will remain
  31. fully opaque and this value will only affect its color.
  32. </div>
  33. <div>Default is *1.0*.</div>
  34. <h3>.[page:Boolean transparent]</h3>
  35. <div>
  36. Defines whether this material is transparent. This has an effect on rendering
  37. as transparent objects need special treatment and are rendered after
  38. non-transparent objects. For a working example of this behaviour, check the
  39. [page:WebGLRenderer WebGLRenderer] code.<br />
  40. When set to true, the extent to which the material is transparent is
  41. controlled by setting *opacity*.
  42. </div>
  43. <div>Default is *false*.</div>
  44. <h3>.[page:Blending blending]</h3>
  45. <div>
  46. Which blending to use when displaying objects with this material. Default is [page:Materials NormalBlending].
  47. </div>
  48. <h3>.[page:Integer blendSrc]</h3>
  49. <div>
  50. Blending source. It's one of the blending mode constants defined in [page:Three Three.js]. Default is [page:CustomBlendingEquation SrcAlphaFactor]
  51. </div>
  52. <h3>.[page:Integer blendDst]</h3>
  53. <div>
  54. Blending destination. It's one of the blending mode constants defined in [page:Three Three.js]. Default is [page:CustomBlendingEquation OneMinusSrcAlphaFactor].
  55. </div>
  56. <h3>.[page:Integer blendEquation]</h3>
  57. <div>
  58. Blending equation to use when applying blending. It's one of the constants defined in [page:Three Three.js]. Default is [page:CustomBlendingEquation AddEquation.]
  59. </div>
  60. <h3>.[page:Boolean depthTest]</h3>
  61. <div>
  62. Whether to have depth test enabled when rendering this material. Default is *true*.
  63. </div>
  64. <h3>.[page:Boolean depthWrite]</h3>
  65. <div>
  66. Whether rendering this material has any effect on the depth buffer. Default is *true*.
  67. </div>
  68. <div>
  69. When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
  70. </div>
  71. <h3>.[page:Boolean polygonOffset]</h3>
  72. <div>
  73. Whether to use polygon offset. Default is *false*. This corresponds to the *POLYGON_OFFSET_FILL* WebGL feature.
  74. </div>
  75. <h3>.[page:Integer polygonOffsetFactor]</h3>
  76. <div>
  77. Sets the polygon offset factor. Default is *0*.
  78. </div>
  79. <h3>.[page:Integer polygonOffsetUnits]</h3>
  80. <div>
  81. Sets the polygon offset units. Default is *0*.
  82. </div>
  83. <h3>.[page:Number alphaTest]</h3>
  84. <div>
  85. Sets the alpha value to be used when running an alpha test. Default is *0*.
  86. </div>
  87. <h3>.[page:Boolean overdraw]</h3>
  88. <div>
  89. Enables/disables overdraw. If enabled, polygons are drawn slightly bigger in order to fix antialiasing gaps when using the [page:CanvasRenderer]. Default is *false*.
  90. </div>
  91. <h3>.[page:Boolean visible]</h3>
  92. <div>
  93. Defines whether this material is visible. Default is *true*.
  94. </div>
  95. <h3>.[page:Enum side]</h3>
  96. <div>
  97. Defines which of the face sides will be rendered - front, back or both.
  98. </div>
  99. <div>
  100. Default is [page:Materials THREE.FrontSide]. Other options are [page:Materials THREE.BackSide] and [page:Materials THREE.DoubleSide].
  101. </div>
  102. <h3>.[page:Boolean needsUpdate]</h3>
  103. <div>
  104. Specifies that the material needs to be updated at the WebGL level. Set it to true if you made changes that need to be reflected in WebGL.
  105. </div>
  106. <div>
  107. This property is automatically set to *true* when instancing a new material.
  108. </div>
  109. <h2>Methods</h2>
  110. <h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
  111. <h3>.clone([page:material material]) [page:Material]</h3>
  112. <div>
  113. material -- this material gets the cloned information (optional).
  114. </div>
  115. <div>
  116. This clones the material in the optional parameter and returns it.
  117. </div>
  118. <h3>.dispose()</h3>
  119. <div>
  120. This disposes the material.
  121. </div>
  122. <h3>.setValues([page:object values])</h3>
  123. <div>
  124. values -- a container with parameters.
  125. </div>
  126. <div>
  127. Sets the properties based on the *values*.
  128. </div>
  129. <h2>Source</h2>
  130. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  131. </body>
  132. </html>