Back to class index

Class VertexDeclaration

Summary

Specifies the structure of a vertex stream.

Description

A vertex stream consists of several vertices. Each vertex contains some data elements, like position, normal, texcoords, etc.. VertexDeclaration contains a list of what elements the vertex stream contains. In addition, it specifies the semantic usage of the stream as whole, i.e. what type of primitives are used to render this stream and whether an index buffer is used. Note that the VertexDeclaration doesn't contain information such as the number of vertices or indices, since that's a property of the geometry buffer itself.

Member Reference

VertexDeclarationSpecifies the structure of a vertex stream.
elementsThe data elements each vertex specifies.
primTypeThe primitive type that is used for rendering.
indexTypeIf an associated index buffer is used, specify its type.
sizeThe size of a single vertex in the stream in bytes, including any padding.
ctor (+2 overloads)Constructs an empty vertex declaration.
Size()[const]Returns the size (==pitch==stride) of a single vertex in bytes.
PrimType()[const]Returns the type of primitives described by this declaration (PrimPoint, PrimLineList, PrimLineStrip, PrimTriangleList or PrimTriangleStrip).
IndexType()[const]Returns the type of indexing used in conjunction with this declaration (IndicesNone, Indices8Bit, Indices16Bit, Indices32Bit).
SetPrimType(type)Sets the type of primitives rendered with this declaration.
SetIndexType(type)Sets the type of indexing used with this declaration.
DataType(semantic)[const]Returns the format of the specified element in the stream. If the element doesn't exist, returns VFNone.
DataDimension(semantic)[const]Returns the plurality of the data of given type (1-4), or 0 if not present.
TypeOffset(semantic)[const]If the element doesn't exist, returns -1.
HasType(semantic)[const]Returns true if the given vertex data type is present in this declaration.
Add(elem)Adds a new data element to the end of the element list.
Remove(semantic)Deletes all occurrences of the given attribute semantic type from this declaration.
LoadFromFile(handle)Loads this structure from the given file.
SaveToFile(handle)Writes this structure to the given file.
DeserializeFromXML(e)Loads this structure from the given XML file.
DumpToConsole()[const]
Back to class index