MeshBuffer.hpp
Go to the documentation of this file.
1 
28 #ifndef MESHBUFFER2_HPP
29 #define MESHBUFFER2_HPP
30 
32 #include "lvr2/texture/Texture.hpp"
34 
35 namespace lvr2
36 {
37 
41 class MeshBuffer : public BaseBuffer
42 {
43  using base = BaseBuffer;
44 public:
45 
50  MeshBuffer();
51 
53  return this->removeFloatChannel("vertices");
54  }
55 
61  void setVertices(floatArr vertices, size_t n);
62 
67  void setVertexNormals(floatArr normals);
68 
74  void setVertexColors(ucharArr colors, size_t w = 3);
75 
80  void setTextureCoordinates(floatArr coordinates);
81 
88  void setFaceIndices(indexArray indices, size_t n);
89 
96  void setFaceMaterialIndices(indexArray indices);
97 
104  void setFaceNormals(floatArr normals);
105 
111  void setFaceColors(ucharArr colors, size_t w = 3);
112 
113  void setTextures(std::vector<Texture>& textures)
114  {
115  m_textures = std::move(textures);
116  }
117 
118  void setMaterials(std::vector<Material>& materials)
119  {
120  m_materials = std::move(materials);
121  }
122 
126  size_t numVertices() const;
127 
131  size_t numFaces() const;
132 
133 
138 
145  ucharArr getVertexColors(size_t& width);
146 
152 
159 
165 
170 
177  ucharArr getFaceColors(size_t& width);
178 
183 
187  std::vector<Texture>& getTextures();
188 
192  std::vector<Material>& getMaterials();
193 
194  bool hasVertices() const;
195 
196  bool hasFaces() const;
197 
198  bool hasFaceColors() const;
199 
200  bool hasVertexColors() const;
201 
202  bool hasFaceNormals() const;
203 
204  bool hasVertexNormals() const;
205 
207 
208 private:
209 
211  std::vector<Material> m_materials;
212 
214  std::vector<Texture> m_textures;
215 };
216 
217 using MeshBufferPtr = std::shared_ptr<MeshBuffer>;
218 
219 }
220 #endif // MESHBUFFER2_HPP
lvr2::floatArr
boost::shared_array< float > floatArr
Definition: DataStruct.hpp:133
BaseBuffer.hpp
lvr2::MeshBuffer::MeshBuffer
MeshBuffer()
MeshBuffer Contructor. Builds an empty buffer. Fill elements with add-Methods.
Definition: MeshBuffer.cpp:38
lvr2::indexArray
boost::shared_array< unsigned int > indexArray
Definition: DataStruct.hpp:128
lvr2::MeshBuffer::getFaceColors
ucharArr getFaceColors(size_t &width)
getFaceColors Returns an array with wrgb colors
Definition: MeshBuffer.cpp:206
lvr2::MeshBuffer::setTextures
void setTextures(std::vector< Texture > &textures)
Definition: MeshBuffer.hpp:113
lvr2::MeshBuffer::setVertexNormals
void setVertexNormals(floatArr normals)
addVertexNormals Adds vertex normals.
Definition: MeshBuffer.cpp:52
lvr2::MeshBuffer::hasVertexNormals
bool hasVertexNormals() const
Definition: MeshBuffer.cpp:280
lvr2::MeshBuffer::setVertexColors
void setVertexColors(ucharArr colors, size_t w=3)
addVertexColors Adds vertex color information.
Definition: MeshBuffer.cpp:65
lvr2::MeshBuffer::hasVertices
bool hasVertices() const
Definition: MeshBuffer.cpp:230
lvr2::MeshBuffer::setTextureCoordinates
void setTextureCoordinates(floatArr coordinates)
addTextureCoordinates Adds texture coordinates for vertices
Definition: MeshBuffer.cpp:78
lvr2::MeshBuffer::getVertices
floatArr getVertices()
getVertices Return the vertex array.
Definition: MeshBuffer.cpp:164
lvr2::MeshBuffer::setMaterials
void setMaterials(std::vector< Material > &materials)
Definition: MeshBuffer.hpp:118
lvr2::MeshBuffer::hasFaceColors
bool hasFaceColors() const
Definition: MeshBuffer.cpp:250
lvr2::MeshBuffer::m_textures
std::vector< Texture > m_textures
Vector containing all textures.
Definition: MeshBuffer.hpp:214
Texture.hpp
lvr2::MeshBuffer
The MeshBuffer Mesh representation for I/O modules.
Definition: MeshBuffer.hpp:41
lvr2::MeshBuffer::setFaceMaterialIndices
void setFaceMaterialIndices(indexArray indices)
addFaceMaterialIndices Adds face material indices. The array references to material definitions in m_...
Definition: MeshBuffer.cpp:99
lvr2::MeshBuffer::getFaceIndices
indexArray getFaceIndices()
getFaceIndices Returns an array with face definitions, i.e., three vertex indices per face.
Definition: MeshBuffer.cpp:199
lvr2::BaseBuffer::removeFloatChannel
bool removeFloatChannel(const std::string &name)
Removes a float channel. @detail If the type is not required use: erase.
Definition: BaseBuffer.hpp:306
lvr2::MeshBuffer::getTextureCoordinates
floatArr getTextureCoordinates()
getTextureCoordinates Returns an array with texture coordinates. Two normalized floats per vertex....
Definition: MeshBuffer.cpp:192
lvr2::BaseBuffer
ChannelManager class Store and access AttributeChannels. It expands the MultiChannelMap with downwoar...
Definition: BaseBuffer.hpp:54
lvr2::MeshBuffer::getVertexNormals
floatArr getVertexNormals()
getVertexNormals Returns an array with vertex normals or an empty array if no normals are present.
Definition: MeshBuffer.cpp:178
lvr2::MeshBuffer::setFaceColors
void setFaceColors(ucharArr colors, size_t w=3)
addFaceColors Adds face colors the the buffer
Definition: MeshBuffer.cpp:125
lvr2::MeshBuffer::setFaceIndices
void setFaceIndices(indexArray indices, size_t n)
addFaceIndices Adds the face index array that references to the vertex array
Definition: MeshBuffer.cpp:91
scripts.create_png.colors
colors
Definition: create_png.py:41
lvr2::MeshBuffer::getTextures
std::vector< Texture > & getTextures()
getTextures Returns a vector with textures
Definition: MeshBuffer.cpp:220
lvr2::MeshBuffer::setFaceNormals
void setFaceNormals(floatArr normals)
addFaceNormals Adds face normal information. The number of normals in the array are exspected to matc...
Definition: MeshBuffer.cpp:112
lvr2::MeshBuffer::getMaterials
std::vector< Material > & getMaterials()
getTextures Returns a vector with materials
Definition: MeshBuffer.cpp:225
lvr2::MeshBuffer::hasVertexColors
bool hasVertexColors() const
Definition: MeshBuffer.cpp:260
lvr2::MeshBuffer::getVertexColors
ucharArr getVertexColors(size_t &width)
getVertexColors Returns vertex color information or an empty array if vertex colors are not available
Definition: MeshBuffer.cpp:171
lvr2::MeshBuffer::removeVertices
bool removeVertices()
Definition: MeshBuffer.hpp:52
lvr2::ucharArr
boost::shared_array< unsigned char > ucharArr
Definition: DataStruct.hpp:137
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::MeshBuffer::hasFaceNormals
bool hasFaceNormals() const
Definition: MeshBuffer.cpp:270
lvr2::MeshBuffer::numFaces
size_t numFaces() const
numFaces Number of faces in the mesh
Definition: MeshBuffer.cpp:151
lvr2::MeshBufferPtr
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
Material.hpp
lvr2::MeshBuffer::hasFaces
bool hasFaces() const
Definition: MeshBuffer.cpp:240
lvr2::MeshBuffer::setVertices
void setVertices(floatArr vertices, size_t n)
addVertices Adds the vertex array. Three floats per vertex
Definition: MeshBuffer.cpp:44
lvr2::MeshBuffer::getFaceMaterialIndices
indexArray getFaceMaterialIndices()
getFaceMaterialIndices Returns an array with face material indices
Definition: MeshBuffer.cpp:213
lvr2::MeshBuffer::numVertices
size_t numVertices() const
numVertices Number of vertices in the mesh
Definition: MeshBuffer.cpp:138
lvr2::MeshBuffer::m_materials
std::vector< Material > m_materials
TODO: CHANNEL BASED SETTER / GETTER!
Definition: MeshBuffer.hpp:211
lvr2::MeshBuffer::getFaceNormals
floatArr getFaceNormals()
getFaceNormas Returns an array containing face normals, i.e., three float values per face.
Definition: MeshBuffer.cpp:185


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:24