Class VertexDeclaration
The layout of a vertex buffer with a set of VertexElement.
[DataContract]
[DataSerializer(typeof(VertexDeclaration.Serializer))]
public class VertexDeclaration : IEquatable<VertexDeclaration>
- Inheritance
-
VertexDeclaration
- Implements
- Extension Methods
Constructors
VertexDeclaration(params VertexElement[])
Initializes a new instance of the VertexDeclaration class.
public VertexDeclaration(params VertexElement[] elements)
Parameters
elements
VertexElement[]The elements.
VertexDeclaration(VertexElement[], int, int)
Initializes a new instance of the VertexDeclaration class.
public VertexDeclaration(VertexElement[] elements, int instanceCount, int vertexStride)
Parameters
elements
VertexElement[]The elements.
instanceCount
intThe instance count.
vertexStride
intThe vertex stride.
Exceptions
- ArgumentNullException
elements
Properties
InstanceCount
Gets the instance count.
public int InstanceCount { get; }
Property Value
- int
The instance count.
VertexElements
Gets the vertex elements.
[DataMember]
public VertexElement[] VertexElements { get; }
Property Value
- VertexElement[]
The vertex elements.
VertexStride
Gets the vertex stride.
public int VertexStride { get; }
Property Value
- int
The vertex stride.
Methods
CalculateSize()
Calculate the size of the vertex declaration.
public int CalculateSize()
Returns
- int
The size in bytes of the vertex declaration
EnumerateWithOffsets()
Enumerates VertexElement with declared offsets.
public IEnumerable<VertexElementWithOffset> EnumerateWithOffsets()
Returns
- IEnumerable<VertexElementWithOffset>
A set of VertexElement with offsets.
Equals(VertexDeclaration)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(VertexDeclaration other)
Parameters
other
VertexDeclarationAn object to compare with this object.
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
Operators
implicit operator VertexDeclaration(VertexElement)
Performs an implicit conversion from VertexElement to VertexDeclaration.
public static implicit operator VertexDeclaration(VertexElement element)
Parameters
element
VertexElementThe element.
Returns
- VertexDeclaration
The result of the conversion.
implicit operator VertexDeclaration(VertexElement[])
Performs an implicit conversion from VertexElement to VertexDeclaration.
public static implicit operator VertexDeclaration(VertexElement[] elements)
Parameters
elements
VertexElement[]The elements.
Returns
- VertexDeclaration
The result of the conversion.