API Reference

Class List

pc.VertexFormat

A vertex format is a descriptor that defines the layout of vertex data inside a pc.VertexBuffer.

// Specify 3-component positions (x, y, z)
var 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)
var 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 }
]);

Summary

Static Properties

defaultInstancingFormat

Returns pc.VertexFormat used to store matrices of type pc.Mat4 for hardware instancing.[read only]

Properties

elements

The vertex attribute elements.

Details

Static Properties

defaultInstancingFormat

Returns pc.VertexFormat used to store matrices of type pc.Mat4 for hardware instancing.

[read only]

Constructor

VertexFormat(graphicsDevice, description)

Returns a new pc.VertexFormat object.

// Specify 3-component positions (x, y, z)
var 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)
var 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 }
]);

Parameters

graphicsDevicepc.GraphicsDevice

The graphics device used to manage this vertex format.

descriptionpc.VertexAttributeDescription[]

An array of vertex attribute descriptions.

Properties

pc.VertexAttributeElement[]elements

The vertex attribute elements.