Materials.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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>源代码</h2>
  87. [link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
  88. </body>
  89. </html>