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