NAP
Public Member Functions | Public Attributes | List of all members
MeshShape Struct Reference

#include <mesh.h>

Public Member Functions

int getNumIndices () const
 
void clearIndices ()
 
void reserveIndices (size_t numIndices)
 
void setIndices (uint32 *indices, int numIndices)
 
const std::vector< uint32 > & getIndices () const
 
std::vector< uint32 > & getIndices ()
 
void addIndices (uint32 *indices, int numIndices)
 
void addIndex (uint32 index)
 
uint32operator[] (std::size_t index)
 
const uint32operator[] (std::size_t index) const
 

Public Attributes

std::vector< uint32mIndices
 Property: 'Indices' into the mesh's vertex data. More...
 

Description

Contains a list of indices that describe which particular part of the nap::MeshInstance should be drawn. Every nap::MeshInstance contains at least one shape.

Member Function Documentation

◆ addIndex()

void addIndex ( uint32  index)

Adds a single index to the index CPU buffer. Use setIndices to add an entire list of indices. Call either before init() or call update() to reflect the changes in the GPU buffer.

Parameters
indexIndex to add.

◆ addIndices()

void addIndices ( uint32 indices,
int  numIndices 
)

Adds a number of indices to the existing indices in the index CPU buffer. Use setIndices to replace the current indices with a new set of indices. Call either before init() or call update() to reflect the changes in the GPU buffer.

Parameters
indicesList of indices to update.
numIndicesNumber of indices in the list.

◆ clearIndices()

void clearIndices ( )

Clears the list of indices. Call either before init() or call update() to reflect the changes in the GPU buffer.

◆ getIndices() [1/2]

std::vector<uint32>& getIndices ( )
Returns
The index list for this shape

◆ getIndices() [2/2]

const std::vector<uint32>& getIndices ( ) const
Returns
The index list for this shape

◆ getNumIndices()

int getNumIndices ( ) const
Returns
The number of indices in this shape

◆ operator[]() [1/2]

uint32& operator[] ( std::size_t  index)

Array subscript overload.

Parameters
indexlookup index
Returns
value at the given index

◆ operator[]() [2/2]

const uint32& operator[] ( std::size_t  index) const

Const array subscript overload.

Parameters
indexlookup index
Returns
value at the given index

◆ reserveIndices()

void reserveIndices ( size_t  numIndices)

Reserves CPU memory for index list. GPU memory is reserved after update() is called.

Parameters
numIndicesAmount of indices to reserve.

◆ setIndices()

void setIndices ( uint32 indices,
int  numIndices 
)

Adds a list of indices to the index CPU buffer. Call either before init() or call update() to reflect the changes in the GPU buffer.

Parameters
indicesarray of indices to add.
numIndicessize of the array.

Member Data Documentation

◆ mIndices

std::vector<uint32> mIndices

Property: 'Indices' into the mesh's vertex data.