Materials.html 5.9 KB

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