頂點格式定義組成頂點的屬性。可以向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
)
要解包的元素的起始索引。