材质常量(Material Constants)

由这些常量定义的属性对所有的材质类型都生效,除了Texture Combine Operations只应用于 [page:MeshBasicMaterial.combine MeshBasicMaterial],[page:MeshLambertMaterial.combine MeshLambertMaterial]和[page:MeshPhongMaterial.combine MeshPhongMaterial]。

THREE.FrontSide THREE.BackSide THREE.DoubleSide

定义了哪一边的面将会被渲染 —— 正面,或是反面,还是两个面都渲染。 默认值是[page:Constant FrontSide](只渲染正面)。

颜色

THREE.NoColors THREE.FaceColors THREE.VertexColors

[page:Constant NoColors] 是默认值,且会将材质的颜色应用到所有面。
[page:Constant FaceColors] 根据每个[page:Face3 Face3]的[page:Color Color]值来对面进行着色。
[page:Constant VertexColors] 根据每个 [page:Face3 Face3]的vertexColors(顶点颜色)值来对面进行着色。 这是一个包含有三个[page:Color Color]的数组,数组中每一项都对应着面中的每一个顶点。
请查看示例:[example:webgl_geometry_colors geometry / colors]。

混合模式

THREE.NoBlending THREE.NormalBlending THREE.AdditiveBlending THREE.SubtractiveBlending THREE.MultiplyBlending THREE.CustomBlending

这些值控制着源和目标材质中,被发送到WebGLRenderer,来给WebGL使用的包含有RGB和Alpha数据的混合方程。
默认值是[page:Constant NormalBlending]。
请注意,[page:Constant CustomBlending]必须被设置为自定义混合方程([page:CustomBlendingEquation Custom Blending Equations])常量中的值。
请查看示例:[example:webgl_materials_blending materials / blending]。

深度模式

THREE.NeverDepth THREE.AlwaysDepth THREE.LessDepth THREE.LessEqualDepth THREE.GreaterEqualDepth THREE.GreaterDepth THREE.NotEqualDepth

材质使用这些深度函数来比较输入像素和缓冲器中Z-depth的值。 如果比较的结果为true,则将绘制像素。
[page:Materials NeverDepth] 永远不返回true。
[page:Materials AlwaysDepth] 总是返回true。
[page:Materials LessDepth] 当输入像素Z-depth小于当前缓冲器Z-depth时,返回true。
[page:Materials LessEqualDepth] 为默认值,当输入像素Z-depth小于或等于当前缓冲器Z-depth时,返回true。
[page:Materials GreaterEqualDepth] 当输入像素Z-depth大于或等于当前缓冲器Z-depth时,返回true。
[page:Materials GreaterDepth] 当输入像素Z-depth大于当前缓冲器Z-depth时,返回true。
[page:Materials NotEqualDepth] 当输入像素Z-depth不等于当前缓冲器Z-depth时,返回true。

纹理结合操作

THREE.MultiplyOperation THREE.MixOperation THREE.AddOperation

这些常量定义了物体表面颜色与环境贴图(如果存在的话)相结合的结果, 用在[page:MeshBasicMaterial.combine MeshBasicMaterial]、[page:MeshLambertMaterial.combine MeshLambertMaterial]和[page:MeshPhongMaterial.combine MeshPhongMaterial]当中。
[page:Constant MultiplyOperation] 是默认值,它将环境贴图和物体表面颜色进行相乘。
[page:Constant MixOperation] 使用反射率来混和两种颜色。uses reflectivity to blend between the two colors.
[page:Constant AddOperation] 用于对两种颜色进行相加。

源代码

[link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]