Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::IndexedVertexBuffer Class Referencefinal

A general vertex buffer for storing various indexed attributes. More...

#include <IndexedVertexBuffer.h>

Classes

struct  AttributeDeclaration
 Info for a declared vertex attribute. More...
 

Public Member Functions

 IndexedVertexBuffer ()
 
void declareAttribute (EVertexAttribute attribute, EVertexElement element, std::size_t numElements, bool shouldNormalize=false)
 Declares a vertex attribute with default layout (AoS).
 
void declareAttribute (EVertexAttribute attribute, EVertexElement element, std::size_t numElements, std::size_t strideOffset, std::size_t strideSize, bool shouldNormalize=false)
 Declares a vertex attribute with custom layout.
 
void allocate (std::size_t numVertices)
 
void setAttribute (EVertexAttribute attribute, std::size_t index, const math::Vector3R &value)
 
void setAttribute (EVertexAttribute attribute, std::size_t index, const math::Vector2R &value)
 
void setAttribute (EVertexAttribute attribute, std::size_t index, real value)
 
void setVertices (const std::byte *srcBytes, std::size_t numBytes, std::size_t dstOffset=0)
 
bool hasAttribute (EVertexAttribute attribute) const
 
math::Vector3R getAttribute (EVertexAttribute attribute, std::size_t index) const
 
std::size_t memoryUsage () const
 
bool isAllocated () const
 
std::size_t numVertices () const
 
AttributeDeclaration getAttributeDeclaration (EVertexAttribute attribute) const
 Get information for a previously declared attribute. Can only be called after allocation.
 
std::byte * getData ()
 Access to the underlying raw byte buffer.
 
const std::byte * getData () const
 

Detailed Description

A general vertex buffer for storing various indexed attributes.

Constructor & Destructor Documentation

◆ IndexedVertexBuffer()

ph::IndexedVertexBuffer::IndexedVertexBuffer ( )

Member Function Documentation

◆ allocate()

void ph::IndexedVertexBuffer::allocate ( std::size_t numVertices)

◆ declareAttribute() [1/2]

void ph::IndexedVertexBuffer::declareAttribute ( EVertexAttribute attribute,
EVertexElement element,
std::size_t numElements,
bool shouldNormalize = false )

Declares a vertex attribute with default layout (AoS).

◆ declareAttribute() [2/2]

void ph::IndexedVertexBuffer::declareAttribute ( EVertexAttribute attribute,
EVertexElement element,
std::size_t numElements,
std::size_t strideOffset,
std::size_t strideSize,
bool shouldNormalize = false )

Declares a vertex attribute with custom layout.

Parameters
attributePrimary type of the vertex attribute.
elementType of the datum that comprise a single attribute.
numElementsNumber of the data that comprise a single attribute.
strideOffsetOffset in the allocated buffer that points to the beginning of the attribute.
strideSizeThe amount of offset to reach the next attribute.
shouldNormalizeWhether to map the stored value to [-1, 1]/[0, 1] depending on element.

◆ getAttribute()

math::Vector3R ph::IndexedVertexBuffer::getAttribute ( EVertexAttribute attribute,
std::size_t index ) const

◆ getAttributeDeclaration()

auto ph::IndexedVertexBuffer::getAttributeDeclaration ( EVertexAttribute attribute) const

Get information for a previously declared attribute. Can only be called after allocation.

◆ getData() [1/2]

std::byte * ph::IndexedVertexBuffer::getData ( )
inline

Access to the underlying raw byte buffer.

◆ getData() [2/2]

const std::byte * ph::IndexedVertexBuffer::getData ( ) const
inline

◆ hasAttribute()

bool ph::IndexedVertexBuffer::hasAttribute ( EVertexAttribute attribute) const
inline

◆ isAllocated()

bool ph::IndexedVertexBuffer::isAllocated ( ) const
inline

◆ memoryUsage()

std::size_t ph::IndexedVertexBuffer::memoryUsage ( ) const
inline

◆ numVertices()

std::size_t ph::IndexedVertexBuffer::numVertices ( ) const
inline

◆ setAttribute() [1/3]

void ph::IndexedVertexBuffer::setAttribute ( EVertexAttribute attribute,
std::size_t index,
const math::Vector2R & value )
inline

◆ setAttribute() [2/3]

void ph::IndexedVertexBuffer::setAttribute ( EVertexAttribute attribute,
std::size_t index,
const math::Vector3R & value )

◆ setAttribute() [3/3]

void ph::IndexedVertexBuffer::setAttribute ( EVertexAttribute attribute,
std::size_t index,
real value )
inline

◆ setVertices()

void ph::IndexedVertexBuffer::setVertices ( const std::byte * srcBytes,
std::size_t numBytes,
std::size_t dstOffset = 0 )

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