TexturedMesh.hpp
Go to the documentation of this file.
1 
28 /*
29  * TexturedMesh.hpp
30  *
31  * Created on: 14.04.2012
32  * Author: Thomas Wiemann
33  */
34 
35 #ifndef TEXTUREDMESH_HPP_
36 #define TEXTUREDMESH_HPP_
37 
40 
41 namespace lvr2
42 {
43 
45 
47 {
49  int numFaces;
51  vector<size_t> faceBuffer;
52 };
53 
54 class TexturedMesh: public StaticMesh
55 {
56 public:
58 
59  virtual ~TexturedMesh()
60  {
61  if (m_textures)
62  {
63  for (size_t i = 0; i < m_numTextures; i++)
64  {
65  delete m_textures[i];
66  }
67 
68  }
69 
70  for (MaterialGroup *ptr : m_textureMaterials)
71  delete ptr;
72 
73  for (MaterialGroup *ptr : m_colorMaterials)
74  delete ptr;
75  }
76 
77  virtual void render()
78  {
79  if(m_active)
80  {
81  if(m_finalized){
82  glPushMatrix();
83  glMultMatrixf(m_transformation.getData());
84  if(m_renderMode & RenderSurfaces)
85  {
86  //glEnable(GL_LIGHTING);
87  //glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
88  glCallList(m_textureDisplayList);
89  }
90 
91  if(m_renderMode & RenderTriangles)
92  {
93  glDisable(GL_LIGHTING);
94  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
95  glLineWidth(m_lineWidth);
96  glColor3f(0.0, 0.0, 0.0);
97  glCallList(m_wireframeList);
98  glEnable(GL_LIGHTING);
99  }
100  glPopMatrix();
101 
102  }
103 
104  }
105  }
106 
107 
108 private:
109 
110  void generateMaterialGroups();
111  void compileTexureDisplayList();
112  void getBufferArray(unsigned int*, MaterialGroup* g);
113 
117  vector<Material>& m_materials;
118 
119 
120  vector<MaterialGroup*> m_textureMaterials;
121  vector<MaterialGroup*> m_colorMaterials;
122 
123  size_t m_numFaces;
127 
129 };
130 
131 } /* namespace lvr2 */
132 
133 #endif /* TEXTUREDMESH_HPP_ */
vector< size_t > faceBuffer
vector< MaterialGroup * > m_colorMaterials
HalfEdgeMesh< Vec > mesh
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
boost::shared_array< GlTexture *> textureArr
Definition: DataStruct.hpp:159
virtual ~TexturedMesh()
vector< Material > & m_materials
indexArray m_faceMaterials
virtual void render()
boost::shared_array< unsigned int > indexArray
Definition: DataStruct.hpp:128
boost::shared_array< float > floatArr
Definition: DataStruct.hpp:133
vector< MaterialGroup * > m_textureMaterials


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 Mon Feb 28 2022 22:46:09