顶点格式定义组成顶点的属性。可以向a
new VertexFormat(options)
Geometry
提供VertexFormat,以请求计算某些属性,例如,仅位置、位置和正常值等。
Parameters:
options
(Object)
具有与代码示例中所示的VertexFormat属性对应的布尔属性的对象。
Example
// Create a vertex format with position and 2D texture coordinate attributes.
var format = new bmgl.VertexFormat({
position : true,
st : true
});
- Geometry#attributes
- Packable
See:
Members
(static, constant) ALL : VertexFormat
一种不可变的顶点格式,具有众所周知的属性:位置、法向、st、切线和位范围。
See:
(static, constant) DEFAULT : VertexFormat
具有位置、法向和st属性的不可变顶点格式。这与大多数外观和材质都兼容;但是通常不需要Normal和ST属性。如果事先知道这一点,则应使用另一个
VertexFormat
。
(static) packedLength : Number
用于将对象打包到数组中的元素数。
(static, constant) POSITION_AND_COLOR : VertexFormat
具有位置和颜色属性的不可变顶点格式。
(static, constant) POSITION_AND_NORMAL : VertexFormat
具有位置和法向属性的不可变顶点格式。这与
PerInstanceColorAppearance
等每个实例的颜色外观兼容。
(static, constant) POSITION_AND_ST : VertexFormat
具有位置和st属性的不可变顶点格式。这与
EllipsoidSurfaceAppearance
兼容。
(static, constant) POSITION_NORMAL_AND_ST : VertexFormat
(static, constant) POSITION_ONLY : VertexFormat
只有位置属性的不可变顶点格式。
bitangent : Boolean
当
true
时,顶点有一个位范围属性(标准化),用于切线空间效果,如凹凸贴图。32位浮点。每个属性3个组件。
-
Default Value:
false
color : Boolean
当
true
时,顶点具有RGB颜色属性。8位无符号字节。每个属性3个组件。
-
Default Value:
false
normal : Boolean
当
true
时,顶点有一个正常属性(标准化),通常用于照明。32位浮点。每个属性3个组件。
-
Default Value:
false
position : Boolean
当
true
时,顶点具有3D位置属性。64位浮点(用于精度)。每个属性3个组件。
-
Default Value:
false
st : Boolean
当
true
时,顶点具有二维纹理坐标属性。32位浮点。每个属性2个组件
-
Default Value:
false
tangent : Boolean
当
true
时,顶点有一个切线属性(标准化),用于切线空间效果,如凹凸贴图。32位浮点。每个属性3个组件。
-
Default Value:
false
Methods
(static) clone(vertexFormat, result) → {VertexFormat}
复制VertexFormat实例。
Parameters:
将提供的实例存储到提供的数组中。
Parameters:
array
(Array.<Number>)
要打包的数组。
startingIndex
(Number)
(default 0
)
数组中开始打包元素的索引。
从压缩数组中检索实例。
Parameters:
array
(Array.<Number>)
压缩数组。
startingIndex
(Number)
(default 0
)
要解包的元素的起始索引。