Materials.html 5.9 KB

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