candlewick 0.1.0
A renderer
Loading...
Searching...
No Matches
candlewick::MeshData Class Reference

A class to store type-erased vertex data and index data. More...

#include <candlewick/utils/MeshData.h>

Inheritance diagram for candlewick::MeshData:
candlewick::MeshDataBase< MeshData >

Public Types

using IndexType = Uint32
 

Public Member Functions

 MeshData (NoInitT)
 
template<IsVertexType VertexT>
 MeshData (SDL_GPUPrimitiveType primitiveType, std::vector< VertexT > vertexData, std::vector< IndexType > indexData={})
 
 MeshData (SDL_GPUPrimitiveType primitiveType, const MeshLayout &layout, std::vector< char > vertexData, std::vector< IndexType > indexData={})
 
 MeshData (MeshData &&) noexcept=default
 
MeshDataoperator= (MeshData &&) noexcept=default
 
MeshDataoperator= (const MeshData &) noexcept=delete
 
Uint32 numVertices () const noexcept
 Number of individual vertices.
 
Uint32 vertexSize () const noexcept
 Size of each vertex, in bytes.
 
Uint64 vertexBytes () const noexcept
 Size of the overall vertex data, in bytes.
 
template<typename U>
std::span< U > viewAs ()
 Obtain a typed view to the underlying vertex data.
 
template<typename U>
std::span< const U > viewAs () const
 Obtain a typed view to the underlying vertex data.
 
template<typename T>
strided_view< T > getAttribute (const SDL_GPUVertexAttribute &attr)
 Access an attribute. Use this when the underlying vertex data type is unknown.
 
template<typename T>
strided_view< const T > getAttribute (const SDL_GPUVertexAttribute &attr) const
 
template<typename T>
strided_view< T > getAttribute (VertexAttrib loc)
 
template<typename T>
strided_view< const T > getAttribute (VertexAttrib loc) const
 
std::span< const char > vertexData () const
 
- Public Member Functions inherited from candlewick::MeshDataBase< MeshData >
MeshDataderived ()
 
const MeshDataderived () const
 
Uint32 numVertices () const
 
Uint32 numIndices () const
 
bool isIndexed () const
 

Static Public Member Functions

static MeshData copy (const MeshData &other)
 Explicit copy function, uses private copy ctor.
 

Public Attributes

SDL_GPUPrimitiveType primitiveType
 
MeshLayout layout
 
std::vector< IndexTypeindexData
 
PbrMaterial material
 

Detailed Description

A class to store type-erased vertex data and index data.

This is to be used as an intermediate data representation class to map to Mesh objects.

Member Typedef Documentation

◆ IndexType

Constructor & Destructor Documentation

◆ MeshData() [1/4]

candlewick::MeshData::MeshData ( NoInitT )
explicit

◆ MeshData() [2/4]

template<IsVertexType VertexT>
candlewick::MeshData::MeshData ( SDL_GPUPrimitiveType primitiveType,
std::vector< VertexT > vertexData,
std::vector< IndexType > indexData = {} )
explicit

◆ MeshData() [3/4]

candlewick::MeshData::MeshData ( SDL_GPUPrimitiveType primitiveType,
const MeshLayout & layout,
std::vector< char > vertexData,
std::vector< IndexType > indexData = {} )
explicit

◆ MeshData() [4/4]

candlewick::MeshData::MeshData ( MeshData && )
defaultnoexcept

Member Function Documentation

◆ copy()

static MeshData candlewick::MeshData::copy ( const MeshData & other)
inlinestaticnodiscard

Explicit copy function, uses private copy ctor.

◆ getAttribute() [1/4]

template<typename T>
strided_view< T > candlewick::MeshData::getAttribute ( const SDL_GPUVertexAttribute & attr)
inlinenodiscard

Access an attribute. Use this when the underlying vertex data type is unknown.

◆ getAttribute() [2/4]

template<typename T>
strided_view< const T > candlewick::MeshData::getAttribute ( const SDL_GPUVertexAttribute & attr) const
inlinenodiscard

◆ getAttribute() [3/4]

template<typename T>
strided_view< T > candlewick::MeshData::getAttribute ( VertexAttrib loc)
inlinenodiscard

◆ getAttribute() [4/4]

template<typename T>
strided_view< const T > candlewick::MeshData::getAttribute ( VertexAttrib loc) const
inlinenodiscard

◆ numVertices()

Uint32 candlewick::MeshData::numVertices ( ) const
inlinenoexcept

Number of individual vertices.

◆ operator=() [1/2]

MeshData & candlewick::MeshData::operator= ( const MeshData & )
deletenoexcept

◆ operator=() [2/2]

MeshData & candlewick::MeshData::operator= ( MeshData && )
defaultnoexcept

◆ vertexBytes()

Uint64 candlewick::MeshData::vertexBytes ( ) const
inlinenoexcept

Size of the overall vertex data, in bytes.

◆ vertexData()

std::span< const char > candlewick::MeshData::vertexData ( ) const
inline

◆ vertexSize()

Uint32 candlewick::MeshData::vertexSize ( ) const
inlinenoexcept

Size of each vertex, in bytes.

◆ viewAs() [1/2]

template<typename U>
std::span< U > candlewick::MeshData::viewAs ( )
inline

Obtain a typed view to the underlying vertex data.

This should be used in tandem with the typed constructor.

◆ viewAs() [2/2]

template<typename U>
std::span< const U > candlewick::MeshData::viewAs ( ) const
inline

Obtain a typed view to the underlying vertex data.

Member Data Documentation

◆ indexData

std::vector<IndexType> candlewick::MeshData::indexData

◆ layout

MeshLayout candlewick::MeshData::layout

◆ material

PbrMaterial candlewick::MeshData::material

◆ primitiveType

SDL_GPUPrimitiveType candlewick::MeshData::primitiveType

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