Create a new VertexFormat instance.
The graphics device used to manage this vertex format.
An array of vertex attribute descriptions.
Optional
vertexCount: numberWhen 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 pc.VertexFormat(graphicsDevice, [
{ semantic: pc.SEMANTIC_POSITION, components: 3, type: pc.TYPE_FLOAT32 }
]);
// Specify 2-component positions (x, y), a texture coordinate (u, v) and a vertex color (r, g, b, a)
const vertexFormat = new pc.VertexFormat(graphicsDevice, [
{ semantic: pc.SEMANTIC_POSITION, components: 2, type: pc.TYPE_FLOAT32 },
{ semantic: pc.SEMANTIC_TEXCOORD0, components: 2, type: pc.TYPE_FLOAT32 },
{ semantic: pc.SEMANTIC_COLOR, components: 4, type: pc.TYPE_UINT8, normalize: true }
]);
Static
getThe VertexFormat used to store matrices of type Mat4 for hardware instancing.
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.