Create a new VertexFormat instance.
The graphics device used to manage this vertex format.
An array of vertex attribute descriptions.
OptionalvertexCount: number
When specified, vertex format will be set up for non-interleaved format with a specified number of vertices. (example: PPPPNNNNCCCC), where arrays of individual attributes will be stored one right after the other (subject to alignment requirements). Note that in this case, the format depends on the number of vertices, and needs to change when the number of vertices changes. When not specified, vertex format will be interleaved. (example: PNCPNCPNCPNC).
// Specify 3-component positions (x, y, z)
const vertexFormat = new VertexFormat(graphicsDevice, [
{ semantic: SEMANTIC_POSITION, components: 3, type: TYPE_FLOAT32 }
]);
// Specify 2-component positions (x, y), a texture coordinate (u, v) and a vertex color (r, g, b, a)
const vertexFormat = new VertexFormat(graphicsDevice, [
{ semantic: SEMANTIC_POSITION, components: 2, type: TYPE_FLOAT32 },
{ semantic: SEMANTIC_TEXCOORD0, components: 2, type: TYPE_FLOAT32 },
{ semantic: SEMANTIC_COLOR, components: 4, type: TYPE_UINT8, normalize: true }
]);
Returns true if the format contains the texture coordinate set with the specified index.
The index of the texture coordinate set, from 0 for SEMANTIC_TEXCOORD0 to 7 for SEMANTIC_TEXCOORD7.
True if the format contains the texture coordinate set.
StaticgetThe VertexFormat used to store matrices of type Mat4 for hardware instancing. The matrix rows use SEMANTIC_ATTR11, SEMANTIC_ATTR12, SEMANTIC_ATTR14 and SEMANTIC_ATTR15. The first two share their attribute locations with SEMANTIC_TEXCOORD6 and SEMANTIC_TEXCOORD7, so a shader reading those texture coordinate sets needs a custom instancing format on other attributes.
The graphics device used to create this vertex format.
The default instancing vertex format.
A vertex format is a descriptor that defines the layout of vertex data inside a VertexBuffer.