材质常量(Material Constants)

由这些常量定义的属性对所有的材质类型都生效,除了Texture Combine Operations只应用于 MeshBasicMaterialMeshLambertMaterialMeshPhongMaterial

v3d.FrontSide v3d.BackSide v3d.DoubleSide

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

混合模式

v3d.NoBlending v3d.NormalBlending v3d.AdditiveBlending v3d.SubtractiveBlending v3d.MultiplyBlending v3d.CustomBlending

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

深度模式

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

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

纹理结合操作

v3d.MultiplyOperation v3d.MixOperation v3d.AddOperation

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

Stencil Functions

v3d.NeverStencilFunc v3d.LessStencilFunc v3d.EqualStencilFunc v3d.LessEqualStencilFunc v3d.GreaterStencilFunc v3d.NotEqualStencilFunc v3d.GreaterEqualStencilFunc v3d.AlwaysStencilFunc

Which stencil function the material uses to determine whether or not to perform a stencil operation.
NeverStencilFunc will never return true.
LessStencilFunc will return true if the stencil reference value is less than the current stencil value.
EqualStencilFunc will return true if the stencil reference value is equal to the current stencil value.
LessEqualStencilFunc will return true if the stencil reference value is less than or equal to the current stencil value.
GreaterStencilFunc will return true if the stencil reference value is greater than the current stencil value.
NotEqualStencilFunc will return true if the stencil reference value is not equal to the current stencil value.
GreaterEqualStencilFunc will return true if the stencil reference value is greater than or equal to the current stencil value.
AlwaysStencilFunc will always return true.

Stencil Operations

v3d.ZeroStencilOp v3d.KeepStencilOp v3d.ReplaceStencilOp v3d.IncrementStencilOp v3d.DecrementStencilOp v3d.IncrementWrapStencilOp v3d.DecrementWrapStencilOp v3d.InvertStencilOp

Which stencil operation the material will perform on the stencil buffer pixel if the provided stencil function passes.
ZeroStencilOp will set the stencil value to 0.
KeepStencilOp will not change the current stencil value.
ReplaceStencilOp will replace the stencil value with the specified stencil reference value.
IncrementStencilOp will increment the current stencil value by 1.
DecrementStencilOp will decrement the current stencil value by 1.
IncrementWrapStencilOp will increment the current stencil value by 1. If the value increments past 255 it will be set to 0.
DecrementWrapStencilOp will increment the current stencil value by 1. If the value decrements below 0 it will be set to 255.
InvertStencilOp will perform a bitwise iversion of the current stencil value.

源代码

src/constants.js