The MeshBuffer Mesh representation for I/O modules. More...
#include <MeshBuffer.hpp>
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 (typename Channel< T >::Ptr data, const std::string &name) |
Adds a channel pointer to the map. 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 | 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 (FloatChannelPtr data, const std::string &name) |
Adds a float channel pointer to the map. 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 | addIndexChannel (IndexChannelPtr data, const std::string &name) |
Adds an index channel pointer to the map. cointer to add. cannel. 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 | 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 (UCharChannelPtr data, const std::string &name) |
Adds an uchar channel pointer to the map. 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... | |
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. If the type is not required use: erase. More... | |
bool | removeFloatChannel (const std::string &name) |
Removes a float channel. If the type is not required use: erase. More... | |
bool | removeIndexChannel (const std::string &name) |
Removes an index channel. If the type is not required use: erase. More... | |
bool | removeUCharChannel (const std::string &name) |
Removes an uchar channel. 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, Channel< U > channel) |
Adds an Key + AttributeChannel to the map. More... | |
template<typename U > | |
void | add (const std::string &name) |
Adds an empty channel. 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. 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< Material > | m_materials |
TODO: CHANNEL BASED SETTER / GETTER! More... | |
std::vector< Texture > | m_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 |
The MeshBuffer Mesh representation for I/O modules.
Definition at line 41 of file MeshBuffer.hpp.
|
private |
Definition at line 43 of file MeshBuffer.hpp.
lvr2::MeshBuffer::MeshBuffer | ( | ) |
MeshBuffer Contructor. Builds an empty buffer. Fill elements with add-Methods.
Definition at line 38 of file MeshBuffer.cpp.
ucharArr lvr2::MeshBuffer::getFaceColors | ( | size_t & | width | ) |
getFaceColors Returns an array with wrgb colors
width | Number of bytes per color (3 for RGB and 4 for RGBA) |
Definition at line 206 of file MeshBuffer.cpp.
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.
indexArray lvr2::MeshBuffer::getFaceMaterialIndices | ( | ) |
getFaceMaterialIndices Returns an array with face material indices
Definition at line 213 of file MeshBuffer.cpp.
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.
std::vector< Material > & lvr2::MeshBuffer::getMaterials | ( | ) |
getTextures Returns a vector with materials
Definition at line 225 of file MeshBuffer.cpp.
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.
std::vector< Texture > & lvr2::MeshBuffer::getTextures | ( | ) |
getTextures Returns a vector with textures
Definition at line 220 of file MeshBuffer.cpp.
ucharArr lvr2::MeshBuffer::getVertexColors | ( | size_t & | width | ) |
getVertexColors Returns vertex color information or an empty array if vertex colors are not available
width | Number of bytes per color (3 for RGB, 4 for RGBA) |
Definition at line 171 of file MeshBuffer.cpp.
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.
floatArr lvr2::MeshBuffer::getVertices | ( | ) |
getVertices Return the vertex array.
Definition at line 164 of file MeshBuffer.cpp.
bool lvr2::MeshBuffer::hasFaceColors | ( | ) | const |
Definition at line 250 of file MeshBuffer.cpp.
bool lvr2::MeshBuffer::hasFaceNormals | ( | ) | const |
Definition at line 270 of file MeshBuffer.cpp.
bool lvr2::MeshBuffer::hasFaces | ( | ) | const |
Definition at line 240 of file MeshBuffer.cpp.
bool lvr2::MeshBuffer::hasVertexColors | ( | ) | const |
Definition at line 260 of file MeshBuffer.cpp.
bool lvr2::MeshBuffer::hasVertexNormals | ( | ) | const |
Definition at line 280 of file MeshBuffer.cpp.
bool lvr2::MeshBuffer::hasVertices | ( | ) | const |
Definition at line 230 of file MeshBuffer.cpp.
size_t lvr2::MeshBuffer::numFaces | ( | ) | const |
numFaces Number of faces in the mesh
Definition at line 151 of file MeshBuffer.cpp.
size_t lvr2::MeshBuffer::numVertices | ( | ) | const |
numVertices Number of vertices in the mesh
Definition at line 138 of file MeshBuffer.cpp.
|
inline |
Definition at line 52 of file MeshBuffer.hpp.
void lvr2::MeshBuffer::setFaceColors | ( | ucharArr | colors, |
size_t | w = 3 |
||
) |
addFaceColors Adds face colors the the buffer
colors | An array containing color information |
w | Bytes per color attribute (3 for RGB, 4 for RGBA) |
Definition at line 125 of file MeshBuffer.cpp.
void lvr2::MeshBuffer::setFaceIndices | ( | indexArray | indices, |
size_t | n | ||
) |
addFaceIndices Adds the face index array that references to the vertex array
indices | The index array (3 indices per face) |
n | Number of faces |
Definition at line 91 of file MeshBuffer.cpp.
void lvr2::MeshBuffer::setFaceMaterialIndices | ( | indexArray | indices | ) |
addFaceMaterialIndices Adds face material indices. The array references to material definitions in m_materials.
indices | One material index per face |
Definition at line 99 of file MeshBuffer.cpp.
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
Normal | definitions for all faces |
Definition at line 112 of file MeshBuffer.cpp.
|
inline |
Definition at line 118 of file MeshBuffer.hpp.
void lvr2::MeshBuffer::setTextureCoordinates | ( | floatArr | coordinates | ) |
addTextureCoordinates Adds texture coordinates for vertices
coordinates | Texture coordinate definitions (2 floats per vertex) |
Definition at line 78 of file MeshBuffer.cpp.
|
inline |
Definition at line 113 of file MeshBuffer.hpp.
void lvr2::MeshBuffer::setVertexColors | ( | ucharArr | colors, |
size_t | w = 3 |
||
) |
addVertexColors Adds vertex color information.
colors | Vertex color array |
w | Number of bytes per color. (3 for RGB, 4 for RGBA) |
Definition at line 65 of file MeshBuffer.cpp.
void lvr2::MeshBuffer::setVertexNormals | ( | floatArr | normals | ) |
addVertexNormals Adds vertex normals.
normals | Normal defintion. Three floats per vertex. |
Definition at line 52 of file MeshBuffer.cpp.
void lvr2::MeshBuffer::setVertices | ( | floatArr | vertices, |
size_t | n | ||
) |
addVertices Adds the vertex array. Three floats per vertex
vertices | The vertex array |
n | Number of vertices |
Definition at line 44 of file MeshBuffer.cpp.
|
private |
TODO: CHANNEL BASED SETTER / GETTER!
Vector containing all material definitions
Definition at line 211 of file MeshBuffer.hpp.
|
private |
Vector containing all textures.
Definition at line 214 of file MeshBuffer.hpp.