Rebel Fork Framework
Urho3D::VertexBuffer Class Reference

Hardware vertex buffer. More...

#include <Urho3D/Graphics/VertexBuffer.h>

Inheritance diagram for Urho3D::VertexBuffer:
Urho3D::PipelineStateTracker

Public Member Functions

 VertexBuffer (Context *context)
 
void SetShadowed (bool enable)
 
bool SetSize (unsigned vertexCount, const ea::vector< VertexElement > &elements, bool dynamic=false)
 Set size, vertex elements and dynamic mode. Previous data will be lost.
 
bool SetSize (unsigned vertexCount, unsigned elementMask, bool dynamic=false)
 Set size and vertex elements and dynamic mode using legacy element bitmask. Previous data will be lost.
 
bool IsDynamic () const
 
unsigned GetVertexCount () const
 
unsigned GetVertexSize () const
 
const ea::vector< VertexElement > & GetElements () const
 
const VertexElementGetElement (VertexElementSemantic semantic, unsigned char index=0) const
 Return vertex element, or null if does not exist.
 
const VertexElementGetElement (VertexElementType type, VertexElementSemantic semantic, unsigned char index=0) const
 Return vertex element with specific type, or null if does not exist.
 
bool HasElement (VertexElementSemantic semantic, unsigned char index=0) const
 Return whether has a specified element semantic.
 
bool HasElement (VertexElementType type, VertexElementSemantic semantic, unsigned char index=0) const
 Return whether has an element semantic with specific type.
 
unsigned GetElementOffset (VertexElementSemantic semantic, unsigned char index=0) const
 Return offset of a element within vertex, or M_MAX_UNSIGNED if does not exist.
 
unsigned GetElementOffset (VertexElementType type, VertexElementSemantic semantic, unsigned char index=0) const
 Return offset of a element with specific type within vertex, or M_MAX_UNSIGNED if element does not exist.
 
VertexMaskFlags GetElementMask () const
 
ea::vector< Vector4GetUnpackedData (unsigned start=0, unsigned count=M_MAX_UNSIGNED) const
 Return unpacked buffer data as count * elements.size() elements, grouped by vertices.
 
void SetUnpackedData (const Vector4 data[], unsigned start=0, unsigned count=M_MAX_UNSIGNED)
 Set data in the buffer from unpacked data.
 
- Public Member Functions inherited from Urho3D::PipelineStateTracker
virtual ~PipelineStateTracker ()
 Destruct.
 
unsigned GetPipelineStateHash () const
 Return (partial) pipeline state hash. Save to call from multiple threads as long as the object is not changing.
 
void MarkPipelineStateHashDirty ()
 Mark pipeline state hash as dirty.
 

Static Public Member Functions

static const VertexElementGetElement (const ea::vector< VertexElement > &elements, VertexElementType type, VertexElementSemantic semantic, unsigned char index=0)
 Return element with specified type and semantic from a vertex element list, or null if does not exist.
 
static bool HasElement (const ea::vector< VertexElement > &elements, VertexElementType type, VertexElementSemantic semantic, unsigned char index=0)
 Return whether element list has a specified element type and semantic.
 
static unsigned GetElementOffset (const ea::vector< VertexElement > &elements, VertexElementType type, VertexElementSemantic semantic, unsigned char index=0)
 Return element offset for specified type and semantic from a vertex element list, or M_MAX_UNSIGNED if does not exist.
 
static ea::vector< VertexElementGetElements (unsigned elementMask)
 Return a vertex element list from a legacy element bitmask.
 
static unsigned GetVertexSize (const ea::vector< VertexElement > &elements)
 Return vertex size from an element list.
 
static unsigned GetVertexSize (unsigned elementMask)
 Return vertex size for a legacy vertex element bitmask.
 
static void UpdateOffsets (ea::vector< VertexElement > &elements)
 Update offsets of vertex elements.
 
static void UnpackVertexData (const void *source, unsigned sourceStride, const VertexElement &element, unsigned start, unsigned count, Vector4 dest[], unsigned destStride)
 Unpack given element data from vertex buffer into Vector4. Stride is measured in bytes.
 
static void PackVertexData (const Vector4 source[], unsigned sourceStride, void *dest, unsigned destStride, const VertexElement &element, unsigned start, unsigned count)
 Pack given element data from Vector4 into vertex buffer. Stride is measured in bytes.
 
static void ShuffleUnpackedVertexData (unsigned vertexCount, const Vector4 source[], const ea::vector< VertexElement > &sourceElements, Vector4 dest[], const ea::vector< VertexElement > &destElements, bool setMissingElementsToZero=true)
 Shuffle unpacked vertex data according to another vertex format. Element types are ignored. Source array should have vertexCount * sourceElements.size() elements. Destination array should have vertexCount * destElements.size() elements.
 

Private Member Functions

 URHO3D_OBJECT (VertexBuffer, RawBuffer)
 
void UpdateOffsets ()
 Update offsets of vertex elements.
 
unsigned RecalculatePipelineStateHash () const override
 Recalculate hash (must not be non zero). Shall be save to call from multiple threads as long as the object is not changing.
 

Private Attributes

unsigned vertexCount_ {}
 Number of vertices.
 
unsigned vertexSize_ {}
 Vertex size.
 
ea::vector< VertexElementelements_
 Vertex elements.
 
unsigned long long elementHash_ {}
 Vertex element hash.
 
VertexMaskFlags elementMask_ {}
 Vertex element legacy bitmask.
 
bool shadowedPending_ {}
 Shadowed flag.
 

Additional Inherited Members

- Protected Member Functions inherited from Urho3D::PipelineStateTracker
PipelineStateSubscription CreateDependency (PipelineStateTracker *dependency)
 Create dependency onto another pipeline state.
 
void AddSubscriberReference (PipelineStateTracker *subscriber)
 Add reference to subscriber pipeline state tracker.
 
void RemoveSubscriberReference (PipelineStateTracker *subscriber)
 Remove reference to subscriber pipeline state tracker.
 

Detailed Description

Hardware vertex buffer.

Member Function Documentation

◆ GetElementMask()

VertexMaskFlags Urho3D::VertexBuffer::GetElementMask ( ) const
inline

Return legacy vertex element mask. Note that both semantic and type must match the legacy element for a mask bit to be set.

◆ GetElements()

const ea::vector<VertexElement>& Urho3D::VertexBuffer::GetElements ( ) const
inline

Return vertex elements.

◆ GetVertexCount()

unsigned Urho3D::VertexBuffer::GetVertexCount ( ) const
inline

Return number of vertices.

◆ GetVertexSize()

unsigned Urho3D::VertexBuffer::GetVertexSize ( ) const
inline

Return vertex size in bytes.

◆ IsDynamic()

bool Urho3D::VertexBuffer::IsDynamic ( ) const
inline

Return whether is dynamic.

◆ SetShadowed()

void Urho3D::VertexBuffer::SetShadowed ( bool  enable)

Enable shadowing in CPU memory. Shadowing is forced on if the graphics subsystem does not exist.


The documentation for this class was generated from the following files: