Public Member Functions | Private Types | Private Attributes | List of all members
lvr2::MeshBuffer Class Reference

The MeshBuffer Mesh representation for I/O modules. More...

#include <MeshBuffer.hpp>

Inheritance diagram for lvr2::MeshBuffer:
Inheritance graph
[legend]

Public Member Functions

ucharArr getFaceColors (size_t &width)
 getFaceColors Returns an array with wrgb colors More...
 
indexArray getFaceIndices ()
 getFaceIndices Returns an array with face definitions, i.e., three vertex indices per face. More...
 
indexArray getFaceMaterialIndices ()
 getFaceMaterialIndices Returns an array with face material indices More...
 
floatArr getFaceNormals ()
 getFaceNormas Returns an array containing face normals, i.e., three float values per face. More...
 
std::vector< Material > & getMaterials ()
 getTextures Returns a vector with materials More...
 
floatArr getTextureCoordinates ()
 getTextureCoordinates Returns an array with texture coordinates. Two normalized floats per vertex. Returns an empty array if no texture coordinates were loaded. More...
 
std::vector< Texture > & getTextures ()
 getTextures Returns a vector with textures More...
 
ucharArr getVertexColors (size_t &width)
 getVertexColors Returns vertex color information or an empty array if vertex colors are not available More...
 
floatArr getVertexNormals ()
 getVertexNormals Returns an array with vertex normals or an empty array if no normals are present. More...
 
floatArr getVertices ()
 getVertices Return the vertex array. More...
 
bool hasFaceColors () const
 
bool hasFaceNormals () const
 
bool hasFaces () const
 
bool hasVertexColors () const
 
bool hasVertexNormals () const
 
bool hasVertices () const
 
 MeshBuffer ()
 MeshBuffer Contructor. Builds an empty buffer. Fill elements with add-Methods. More...
 
size_t numFaces () const
 numFaces Number of faces in the mesh More...
 
size_t numVertices () const
 numVertices Number of vertices in the mesh More...
 
bool removeVertices ()
 
void setFaceColors (ucharArr colors, size_t w=3)
 addFaceColors Adds face colors the the buffer More...
 
void setFaceIndices (indexArray indices, size_t n)
 addFaceIndices Adds the face index array that references to the vertex array More...
 
void setFaceMaterialIndices (indexArray indices)
 addFaceMaterialIndices Adds face material indices. The array references to material definitions in m_materials. More...
 
void setFaceNormals (floatArr normals)
 addFaceNormals Adds face normal information. The number of normals in the array are exspected to match the number of faces in the mesh More...
 
void setMaterials (std::vector< Material > &materials)
 
void setTextureCoordinates (floatArr coordinates)
 addTextureCoordinates Adds texture coordinates for vertices More...
 
void setTextures (std::vector< Texture > &textures)
 
void setVertexColors (ucharArr colors, size_t w=3)
 addVertexColors Adds vertex color information. More...
 
void setVertexNormals (floatArr normals)
 addVertexNormals Adds vertex normals. More...
 
void setVertices (floatArr vertices, size_t n)
 addVertices Adds the vertex array. Three floats per vertex More...
 
- Public Member Functions inherited from lvr2::BaseBuffer
template<typename T >
void addAtomic (T data, const std::string &name)
 Adds an atomic value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. More...
 
template<typename T >
void addChannel (boost::shared_array< T > array, std::string name, size_t n, size_t width)
 Constructs a channel from an boost::shared_array and saves it to the map. More...
 
template<typename T >
void addChannel (typename Channel< T >::Ptr data, const std::string &name)
 Adds a channel pointer to the map. More...
 
template<typename T >
void addEmptyChannel (const std::string &name, size_t n, size_t width)
 Adds an empty channel to the map. More...
 
void addEmptyFloatChannel (const std::string &name, size_t n, size_t width)
 Adds an empty float channel to the map. More...
 
void addEmptyIndexChannel (const std::string &name, size_t n, size_t width)
 Adds an empty index channel to the map. More...
 
void addEmptyUCharChannel (const std::string &name, size_t n, size_t width)
 Adds an empty uchar channel to the map. More...
 
void addFloatAtomic (float data, const std::string &name)
 Adds an atomic float value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. More...
 
void addFloatChannel (floatArr array, std::string name, size_t n, size_t width)
 Constructs a float channel from an boost::shared_array and saves it to the map. More...
 
void addFloatChannel (FloatChannelPtr data, const std::string &name)
 Adds a float channel pointer to the map. More...
 
void addIndexChannel (indexArray array, std::string name, size_t n, size_t width)
 Constructs an index channel from an boost::shared_array and saves it to the map. More...
 
void addIndexChannel (IndexChannelPtr data, const std::string &name)
 Adds an index channel pointer to the map. cointer to add. cannel. More...
 
void addIntAtomic (int data, const std::string &name)
 Adds an atomic int value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. Kept because of api stability. More...
 
void addUCharAtomic (unsigned char data, const std::string &name)
 Adds an atomic uchar value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. Kept because of api stability. More...
 
void addUCharChannel (ucharArr array, std::string name, size_t n, size_t width)
 Constructs an uchar channel from an boost::shared_array and saves it to the map. More...
 
void addUCharChannel (UCharChannelPtr data, const std::string &name)
 Adds an uchar channel pointer to the map. More...
 
template<typename T >
size_t channelWidth (const std::string &name) const
 Gets a channels width. More...
 
BaseBuffer clone () const
 
size_t floatChannelWidth (const std::string &name) const
 Gets a float channels width. More...
 
template<typename T >
int getAllChannelsOfType (std::map< std::string, Channel< T > > &channels)
 Returns all channels of type T. More...
 
template<typename T >
int getAllChannelsOfType (std::vector< std::pair< std::string, Channel< T > >> &channels)
 Returns all channels of type T. More...
 
template<typename T >
boost::shared_array< T > getArray (const std::string &name, size_t &n, size_t &w)
 Gets a channel as array. More...
 
template<typename T >
boost::optional< T > getAtomic (const std::string &name)
 Gets an atomic value. More...
 
template<typename T >
Channel< T >::Optional getChannel (const std::string &name)
 Gets a channel and returns it as optional. More...
 
template<typename T >
const Channel< T >::Optional getChannel (const std::string &name) const
 Gets a channel and returns it as optional. More...
 
void getChannel (const std::string &name, FloatChannelOptional &channelOptional)
 Gets a float channel and returns it as optional. More...
 
void getChannel (const std::string &name, IndexChannelOptional &channelOptional)
 Gets an index channel and returns it as optional. More...
 
void getChannel (const std::string &name, UCharChannelOptional &channelOptional)
 Gets an uchar channel and returns it as optional. More...
 
floatArr getFloatArray (const std::string &name, size_t &n, size_t &w)
 Gets a float channel as array. More...
 
floatOptional getFloatAtomic (const std::string &name)
 Gets an atomic float value. More...
 
Channel< float >::Optional getFloatChannel (const std::string &name)
 Gets a float channel and returns it as optional. More...
 
FloatProxy getFloatHandle (unsigned int idx, const std::string &name)
 Get a Handle object (ElementProxy) of a float channel. More...
 
template<typename T >
ElementProxy< T > getHandle (unsigned int idx, const std::string &name)
 Get a Handle object (ElementProxy) of a specific typed channel. More...
 
indexArray getIndexArray (const std::string &name, size_t &n, size_t &w)
 Gets an index channel as array. More...
 
Channel< unsigned int >::Optional getIndexChannel (const std::string &name)
 Gets an index channel and returns it as optional. More...
 
IndexProxy getIndexHandle (unsigned int idx, const std::string &name)
 Get a Handle object (ElementProxy) of an index channel. More...
 
intOptional getIntAtomic (const std::string &name)
 Gets an atomic int value. More...
 
ucharArr getUCharArray (const std::string &name, size_t &n, size_t &w)
 Gets an uchar channel as array. More...
 
ucharOptional getUCharAtomic (const std::string &name)
 Gets an atomic uchar value. More...
 
Channel< unsigned char >::Optional getUCharChannel (const std::string &name)
 Gets an uchar channel and returns it as optional. More...
 
UCharProxy getUCharHandle (unsigned int idx, const std::string &name)
 Get a Handle object (ElementProxy) of an uchar channel. More...
 
template<typename T >
bool hasChannel (const std::string &name) const
 Checks if a channel is available. More...
 
bool hasFloatChannel (const std::string &name) const
 Checks if a float channel is available. More...
 
bool hasIndexChannel (const std::string &name) const
 Checks if an index channel is available. More...
 
bool hasUCharChannel (const std::string &name) const
 Checks if an uchar channel is available. More...
 
size_t indexChannelWidth (const std::string &name) const
 Gets an index channels width. More...
 
template<typename V >
BaseBuffer manipulate (V visitor)
 
template<typename T >
bool removeChannel (const std::string &name)
 Removes a channel with a specific type. @detail If the type is not required use: erase. More...
 
bool removeFloatChannel (const std::string &name)
 Removes a float channel. @detail If the type is not required use: erase. More...
 
bool removeIndexChannel (const std::string &name)
 Removes an index channel. @detail If the type is not required use: erase. More...
 
bool removeUCharChannel (const std::string &name)
 Removes an uchar channel. @detail If the type is not required use: erase. More...
 
size_t ucharChannelWidth (const std::string &name) const
 Gets an uchar channels width. More...
 
- Public Member Functions inherited from lvr2::VariantChannelMap< T >
template<typename U >
void add (const std::string &name)
 Adds an empty channel. More...
 
template<typename U >
void add (const std::string &name, Channel< U > channel)
 Adds an Key + AttributeChannel to the map. More...
 
template<typename U >
void add (const std::string &name, size_t numElements, size_t width)
 Adds an empty channel with size. More...
 
VariantChannelMap< T... > clone () const
 
template<typename U >
iterator< U > erase (iterator< U > it)
 
template<typename U >
Channel< U > & get (const std::string &name)
 Gets AttributeChannel with type U from map as reference. More...
 
template<typename U >
const Channel< U > & get (const std::string &name) const
 Gets AttributeChannel by type U from map. More...
 
template<typename U >
Channel< U >::Optional getOptional (const std::string &name)
 
template<typename U >
const Channel< U >::Optional getOptional (const std::string &name) const
 
template<typename U >
bool is_type (const std::string &name) const
 Checks if key has specific type U. More...
 
template<typename U >
std::vector< std::string > keys ()
 Gets the available keys by a specific type. More...
 
template<typename V >
VariantChannelMap< T... > manipulate (V visitor)
 
template<typename U >
size_t numChannels ()
 Counts the number of channels by a specific type. @detail For total number of channels use "size()". More...
 
int type (const std::string &name) const
 Gets type index of a map entry. More...
 
template<typename U >
iterator< U > typedBegin ()
 
template<typename U >
const_iterator< U > typedBegin () const
 

Private Types

using base = BaseBuffer
 

Private Attributes

std::vector< Materialm_materials
 TODO: CHANNEL BASED SETTER / GETTER! More...
 
std::vector< Texturem_textures
 Vector containing all textures. More...
 

Additional Inherited Members

- Public Types inherited from lvr2::BaseBuffer
using base = std::unordered_map< std::string, VariantChannel< T... > >
 
- Public Types inherited from lvr2::VariantChannelMap< T >
using base = std::unordered_map< std::string, VariantChannel< T... > >
 
using elem_type = std::pair< const key_type, val_type >
 
using key_type = std::string
 
template<std::size_t N>
using type_of_index = typename val_type::template type_of_index< N >
 
using types = std::tuple< T... >
 
using val_type = VariantChannel< T... >
 
- Static Public Attributes inherited from lvr2::VariantChannelMap< T >
static constexpr std::size_t num_types = val_type::num_types
 

Detailed Description

The MeshBuffer Mesh representation for I/O modules.

Definition at line 41 of file MeshBuffer.hpp.

Member Typedef Documentation

◆ base

Definition at line 43 of file MeshBuffer.hpp.

Constructor & Destructor Documentation

◆ MeshBuffer()

lvr2::MeshBuffer::MeshBuffer ( )

MeshBuffer Contructor. Builds an empty buffer. Fill elements with add-Methods.

Definition at line 38 of file MeshBuffer.cpp.

Member Function Documentation

◆ getFaceColors()

ucharArr lvr2::MeshBuffer::getFaceColors ( size_t &  width)

getFaceColors Returns an array with wrgb colors

Parameters
widthNumber of bytes per color (3 for RGB and 4 for RGBA)
Returns
An array containing point data or an nullptr if no colors are present.

Definition at line 206 of file MeshBuffer.cpp.

◆ getFaceIndices()

indexArray lvr2::MeshBuffer::getFaceIndices ( )

getFaceIndices Returns an array with face definitions, i.e., three vertex indices per face.

Definition at line 199 of file MeshBuffer.cpp.

◆ getFaceMaterialIndices()

indexArray lvr2::MeshBuffer::getFaceMaterialIndices ( )

getFaceMaterialIndices Returns an array with face material indices

Definition at line 213 of file MeshBuffer.cpp.

◆ getFaceNormals()

floatArr lvr2::MeshBuffer::getFaceNormals ( )

getFaceNormas Returns an array containing face normals, i.e., three float values per face.

Definition at line 185 of file MeshBuffer.cpp.

◆ getMaterials()

std::vector< Material > & lvr2::MeshBuffer::getMaterials ( )

getTextures Returns a vector with materials

Definition at line 225 of file MeshBuffer.cpp.

◆ getTextureCoordinates()

floatArr lvr2::MeshBuffer::getTextureCoordinates ( )

getTextureCoordinates Returns an array with texture coordinates. Two normalized floats per vertex. Returns an empty array if no texture coordinates were loaded.

Definition at line 192 of file MeshBuffer.cpp.

◆ getTextures()

std::vector< Texture > & lvr2::MeshBuffer::getTextures ( )

getTextures Returns a vector with textures

Definition at line 220 of file MeshBuffer.cpp.

◆ getVertexColors()

ucharArr lvr2::MeshBuffer::getVertexColors ( size_t &  width)

getVertexColors Returns vertex color information or an empty array if vertex colors are not available

Parameters
widthNumber of bytes per color (3 for RGB, 4 for RGBA)
Returns

Definition at line 171 of file MeshBuffer.cpp.

◆ getVertexNormals()

floatArr lvr2::MeshBuffer::getVertexNormals ( )

getVertexNormals Returns an array with vertex normals or an empty array if no normals are present.

Definition at line 178 of file MeshBuffer.cpp.

◆ getVertices()

floatArr lvr2::MeshBuffer::getVertices ( )

getVertices Return the vertex array.

Definition at line 164 of file MeshBuffer.cpp.

◆ hasFaceColors()

bool lvr2::MeshBuffer::hasFaceColors ( ) const

Definition at line 250 of file MeshBuffer.cpp.

◆ hasFaceNormals()

bool lvr2::MeshBuffer::hasFaceNormals ( ) const

Definition at line 270 of file MeshBuffer.cpp.

◆ hasFaces()

bool lvr2::MeshBuffer::hasFaces ( ) const

Definition at line 240 of file MeshBuffer.cpp.

◆ hasVertexColors()

bool lvr2::MeshBuffer::hasVertexColors ( ) const

Definition at line 260 of file MeshBuffer.cpp.

◆ hasVertexNormals()

bool lvr2::MeshBuffer::hasVertexNormals ( ) const

Definition at line 280 of file MeshBuffer.cpp.

◆ hasVertices()

bool lvr2::MeshBuffer::hasVertices ( ) const

Definition at line 230 of file MeshBuffer.cpp.

◆ numFaces()

size_t lvr2::MeshBuffer::numFaces ( ) const

numFaces Number of faces in the mesh

Definition at line 151 of file MeshBuffer.cpp.

◆ numVertices()

size_t lvr2::MeshBuffer::numVertices ( ) const

numVertices Number of vertices in the mesh

Definition at line 138 of file MeshBuffer.cpp.

◆ removeVertices()

bool lvr2::MeshBuffer::removeVertices ( )
inline

Definition at line 52 of file MeshBuffer.hpp.

◆ setFaceColors()

void lvr2::MeshBuffer::setFaceColors ( ucharArr  colors,
size_t  w = 3 
)

addFaceColors Adds face colors the the buffer

Parameters
colorsAn array containing color information
wBytes per color attribute (3 for RGB, 4 for RGBA)

Definition at line 125 of file MeshBuffer.cpp.

◆ setFaceIndices()

void lvr2::MeshBuffer::setFaceIndices ( indexArray  indices,
size_t  n 
)

addFaceIndices Adds the face index array that references to the vertex array

Parameters
indicesThe index array (3 indices per face)
nNumber of faces

Definition at line 91 of file MeshBuffer.cpp.

◆ setFaceMaterialIndices()

void lvr2::MeshBuffer::setFaceMaterialIndices ( indexArray  indices)

addFaceMaterialIndices Adds face material indices. The array references to material definitions in m_materials.

Parameters
indicesOne material index per face

Definition at line 99 of file MeshBuffer.cpp.

◆ setFaceNormals()

void lvr2::MeshBuffer::setFaceNormals ( floatArr  normals)

addFaceNormals Adds face normal information. The number of normals in the array are exspected to match the number of faces in the mesh

Parameters
Normaldefinitions for all faces

Definition at line 112 of file MeshBuffer.cpp.

◆ setMaterials()

void lvr2::MeshBuffer::setMaterials ( std::vector< Material > &  materials)
inline

Definition at line 118 of file MeshBuffer.hpp.

◆ setTextureCoordinates()

void lvr2::MeshBuffer::setTextureCoordinates ( floatArr  coordinates)

addTextureCoordinates Adds texture coordinates for vertices

Parameters
coordinatesTexture coordinate definitions (2 floats per vertex)

Definition at line 78 of file MeshBuffer.cpp.

◆ setTextures()

void lvr2::MeshBuffer::setTextures ( std::vector< Texture > &  textures)
inline

Definition at line 113 of file MeshBuffer.hpp.

◆ setVertexColors()

void lvr2::MeshBuffer::setVertexColors ( ucharArr  colors,
size_t  w = 3 
)

addVertexColors Adds vertex color information.

Parameters
colorsVertex color array
wNumber of bytes per color. (3 for RGB, 4 for RGBA)

Definition at line 65 of file MeshBuffer.cpp.

◆ setVertexNormals()

void lvr2::MeshBuffer::setVertexNormals ( floatArr  normals)

addVertexNormals Adds vertex normals.

Parameters
normalsNormal defintion. Three floats per vertex.

Definition at line 52 of file MeshBuffer.cpp.

◆ setVertices()

void lvr2::MeshBuffer::setVertices ( floatArr  vertices,
size_t  n 
)

addVertices Adds the vertex array. Three floats per vertex

Parameters
verticesThe vertex array
nNumber of vertices

Definition at line 44 of file MeshBuffer.cpp.

Member Data Documentation

◆ m_materials

std::vector<Material> lvr2::MeshBuffer::m_materials
private

TODO: CHANNEL BASED SETTER / GETTER!

Vector containing all material definitions

Definition at line 211 of file MeshBuffer.hpp.

◆ m_textures

std::vector<Texture> lvr2::MeshBuffer::m_textures
private

Vector containing all textures.

Definition at line 214 of file MeshBuffer.hpp.


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


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:27