Material.html 5.3 KB

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