Class MeshBuffer

Inheritance Relationships

Base Type

Class Documentation

class MeshBuffer : public lvr2::BaseBuffer

The MeshBuffer Mesh representation for I/O modules.

Public Functions

MeshBuffer()

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

inline bool removeVertices()
void setVertices(floatArr vertices, size_t n)

addVertices Adds the vertex array. Three floats per vertex

Parameters:
  • vertices – The vertex array

  • n – Number of vertices

void setVertexNormals(floatArr normals)

addVertexNormals Adds vertex normals.

Parameters:

normalsNormal defintion. Three floats per vertex.

void setVertexColors(ucharArr colors, size_t w = 3)

addVertexColors Adds vertex color information.

Parameters:
  • colors – Vertex color array

  • w – Number of bytes per color. (3 for RGB, 4 for RGBA)

void setTextureCoordinates(floatArr coordinates)

addTextureCoordinates Adds texture coordinates for vertices

Parameters:

coordinatesTexture coordinate definitions (2 floats per vertex)

void setFaceIndices(indexArray indices, size_t n)

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

Parameters:
  • indices – The index array (3 indices per face)

  • n – Number of faces

void setFaceMaterialIndices(indexArray indices)

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

Parameters:

indices – One material index per face

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

Parameters:

Normal – definitions for all faces

void setFaceColors(ucharArr colors, size_t w = 3)

addFaceColors Adds face colors the the buffer

Parameters:
  • colors – An array containing color information

  • w – Bytes per color attribute (3 for RGB, 4 for RGBA)

inline void setTextures(std::vector<Texture> &textures)
inline void setMaterials(std::vector<Material> &materials)
size_t numVertices() const

numVertices Number of vertices in the mesh

size_t numFaces() const

numFaces Number of faces in the mesh

floatArr getVertices()

getVertices Return the vertex array.

ucharArr getVertexColors(size_t &width)

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

Parameters:

width – Number of bytes per color (3 for RGB, 4 for RGBA)

Returns:

floatArr getVertexNormals()

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

floatArr getTextureCoordinates()

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

floatArr getFaceNormals()

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

indexArray getFaceIndices()

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

ucharArr getFaceColors(size_t &width)

getFaceColors Returns an array with wrgb colors

Parameters:

width – Number 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.

indexArray getFaceMaterialIndices()

getFaceMaterialIndices Returns an array with face material indices

std::vector<Texture> &getTextures()

getTextures Returns a vector with textures

std::vector<Material> &getMaterials()

getTextures Returns a vector with materials

bool hasVertices() const
bool hasFaces() const
bool hasFaceColors() const
bool hasVertexColors() const
bool hasFaceNormals() const
bool hasVertexNormals() const