Materials.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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>材质常量(Material Constants)</h1>
  12. <p class="desc">
  13. 由这些常量定义的属性对所有的材质类型都生效,除了Texture Combine Operations只应用于
  14. [page:MeshBasicMaterial.combine MeshBasicMaterial],[page:MeshLambertMaterial.combine MeshLambertMaterial]和[page:MeshPhongMaterial.combine MeshPhongMaterial]。<br />
  15. </p>
  16. <h2>面</h2>
  17. <code>
  18. THREE.FrontSide
  19. THREE.BackSide
  20. THREE.DoubleSide
  21. </code>
  22. <p>
  23. 定义了哪一边的面将会被渲染 —— 正面,或是反面,还是两个面都渲染。
  24. 默认值是[page:Constant FrontSide](只渲染正面)。
  25. </p>
  26. <h2>颜色</h2>
  27. <code>
  28. THREE.NoColors
  29. THREE.FaceColors
  30. THREE.VertexColors
  31. </code>
  32. <p>
  33. [page:Constant NoColors] 是默认值,且会将材质的颜色应用到所有面。<br />
  34. [page:Constant FaceColors] 根据每个[page:Face3 Face3]的[page:Color Color]值来对面进行着色。<br />
  35. [page:Constant VertexColors] 根据每个 [page:Face3 Face3]的vertexColors(顶点颜色)值来对面进行着色。 这是一个包含有三个[page:Color Color]的数组,数组中每一项都对应着面中的每一个顶点。<br />
  36. 请查看示例:[example:webgl_geometry_colors geometry / colors]。
  37. </p>
  38. <h2>混合模式</h2>
  39. <code>
  40. THREE.NoBlending
  41. THREE.NormalBlending
  42. THREE.AdditiveBlending
  43. THREE.SubtractiveBlending
  44. THREE.MultiplyBlending
  45. THREE.CustomBlending
  46. </code>
  47. <p>
  48. 这些值控制着源和目标材质中,被发送到WebGLRenderer,来给WebGL使用的包含有RGB和Alpha数据的混合方程。<br />
  49. 默认值是[page:Constant NormalBlending]。<br />
  50. 请注意,[page:Constant CustomBlending]必须被设置为自定义混合方程([page:CustomBlendingEquation Custom Blending Equations])常量中的值。<br />
  51. 请查看示例:[example:webgl_materials_blending materials / blending]。<br />
  52. </p>
  53. <h2>深度模式</h2>
  54. <code>
  55. THREE.NeverDepth
  56. THREE.AlwaysDepth
  57. THREE.LessDepth
  58. THREE.LessEqualDepth
  59. THREE.GreaterEqualDepth
  60. THREE.GreaterDepth
  61. THREE.NotEqualDepth
  62. </code>
  63. <p>
  64. 材质使用这些深度函数来比较输入像素和缓冲器中Z-depth的值。
  65. 如果比较的结果为true,则将绘制像素。<br />
  66. [page:Materials NeverDepth] 永远不返回true。<br />
  67. [page:Materials AlwaysDepth] 总是返回true。<br />
  68. [page:Materials LessDepth] 当输入像素Z-depth小于当前缓冲器Z-depth时,返回true。<br />
  69. [page:Materials LessEqualDepth] 为默认值,当输入像素Z-depth小于或等于当前缓冲器Z-depth时,返回true。<br />
  70. [page:Materials GreaterEqualDepth] 当输入像素Z-depth大于或等于当前缓冲器Z-depth时,返回true。 <br />
  71. [page:Materials GreaterDepth] 当输入像素Z-depth大于当前缓冲器Z-depth时,返回true。<br />
  72. [page:Materials NotEqualDepth] 当输入像素Z-depth不等于当前缓冲器Z-depth时,返回true。<br />
  73. </p>
  74. <h2>纹理结合操作</h2>
  75. <code>
  76. THREE.MultiplyOperation
  77. THREE.MixOperation
  78. THREE.AddOperation
  79. </code>
  80. <p>
  81. 这些常量定义了物体表面颜色与环境贴图(如果存在的话)相结合的结果,
  82. 用在[page:MeshBasicMaterial.combine MeshBasicMaterial]、[page:MeshLambertMaterial.combine MeshLambertMaterial]和[page:MeshPhongMaterial.combine MeshPhongMaterial]当中。<br />
  83. [page:Constant MultiplyOperation] 是默认值,它将环境贴图和物体表面颜色进行相乘。<br />
  84. [page:Constant MixOperation] 使用反射率来混和两种颜色。uses reflectivity to blend between the two colors.<br />
  85. [page:Constant AddOperation] 用于对两种颜色进行相加。</p>
  86. <h2>Stencil Functions</h2>
  87. <code>
  88. THREE.NeverStencilFunc
  89. THREE.LessStencilFunc
  90. THREE.EqualStencilFunc
  91. THREE.LessEqualStencilFunc
  92. THREE.GreaterStencilFunc
  93. THREE.NotEqualStencilFunc
  94. THREE.GreaterEqualStencilFunc
  95. THREE.AlwaysStencilFunc
  96. </code>
  97. <p>
  98. Which stencil function the material uses to determine whether or not to perform a stencil operation.<br />
  99. [page:Materials NeverStencilFunc] will never return true.<br />
  100. [page:Materials LessStencilFunc] will return true if the stencil reference value is less than the current stencil value.<br />
  101. [page:Materials EqualStencilFunc] will return true if the stencil reference value is equal to the current stencil value.<br />
  102. [page:Materials LessEqualStencilFunc] will return true if the stencil reference value is less than or equal to the current stencil value.<br />
  103. [page:Materials GreaterStencilFunc] will return true if the stencil reference value is greater than the current stencil value.<br />
  104. [page:Materials NotEqualStencilFunc] will return true if the stencil reference value is not equal to the current stencil value.<br />
  105. [page:Materials GreaterEqualStencilFunc] will return true if the stencil reference value is greater than or equal to the current stencil value.<br />
  106. [page:Materials AlwaysStencilFunc] will always return true.<br />
  107. </p>
  108. <h2>Stencil Operations</h2>
  109. <code>
  110. THREE.ZeroStencilOp
  111. THREE.KeepStencilOp
  112. THREE.ReplaceStencilOp
  113. THREE.IncrementStencilOp
  114. THREE.DecrementStencilOp
  115. THREE.IncrementWrapStencilOp
  116. THREE.DecrementWrapStencilOp
  117. THREE.InvertStencilOp
  118. </code>
  119. <p>
  120. Which stencil operation the material will perform on the stencil buffer pixel if the provided stencil function passes.<br />
  121. [page:Materials ZeroStencilOp] will set the stencil value to 0.<br />
  122. [page:Materials KeepStencilOp] will not change the current stencil value.<br />
  123. [page:Materials ReplaceStencilOp] will replace the stencil value with the specified stencil reference value.<br />
  124. [page:Materials IncrementStencilOp] will increment the current stencil value by 1.<br />
  125. [page:Materials DecrementStencilOp] will decrement the current stencil value by 1.<br />
  126. [page:Materials IncrementWrapStencilOp] will increment the current stencil value by 1. If the value increments past 255 it will be set to 0.<br />
  127. [page:Materials DecrementWrapStencilOp] will increment the current stencil value by 1. If the value decrements below 0 it will be set to 255.<br />
  128. [page:Materials InvertStencilOp] will perform a bitwise iversion of the current stencil value.<br />
  129. </p>
  130. <h2>源代码</h2>
  131. <p>
  132. [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
  133. </p>
  134. </body>
  135. </html>