include
lvr2
display
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
38
#include "
lvr2/display/StaticMesh.hpp
"
39
#include "
lvr2/geometry/BaseVector.hpp
"
40
41
namespace
lvr2
42
{
43
44
using
Vec
=
BaseVector<float>
;
45
46
struct
MaterialGroup
47
{
48
int
textureIndex
;
49
int
numFaces
;
50
Vec
color
;
51
vector<size_t>
faceBuffer
;
52
};
53
54
class
TexturedMesh
:
public
StaticMesh
55
{
56
public
:
57
TexturedMesh
(
MeshBufferPtr
mesh
);
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
114
indexArray
m_faceMaterials
;
115
floatArr
m_texcoords
;
116
textureArr
m_textures
;
117
vector<Material>&
m_materials
;
118
119
120
vector<MaterialGroup*>
m_textureMaterials
;
121
vector<MaterialGroup*>
m_colorMaterials
;
122
123
size_t
m_numFaces
;
124
size_t
m_numMaterials
;
125
size_t
m_numTextures
;
126
size_t
m_numVertices
;
127
128
int
m_textureDisplayList
;
129
};
130
131
}
/* namespace lvr2 */
132
133
#endif
/* TEXTUREDMESH_HPP_ */
lvr2::RenderSurfaces
Definition:
StaticMesh.hpp:68
lvr2::MaterialGroup::faceBuffer
vector< size_t > faceBuffer
Definition:
TexturedMesh.hpp:51
lvr2::TexturedMesh::m_colorMaterials
vector< MaterialGroup * > m_colorMaterials
Definition:
TexturedMesh.hpp:121
lvr2::TexturedMesh
Definition:
TexturedMesh.hpp:54
mesh
HalfEdgeMesh< Vec > mesh
Definition:
src/tools/lvr2_gs_reconstruction/Main.cpp:26
lvr2::MeshBufferPtr
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition:
MeshBuffer.hpp:217
lvr2::MaterialGroup::color
Vec color
Definition:
TexturedMesh.hpp:50
lvr2::StaticMesh
Definition:
StaticMesh.hpp:75
lvr2::textureArr
boost::shared_array< GlTexture *> textureArr
Definition:
DataStruct.hpp:159
lvr2::MaterialGroup::textureIndex
int textureIndex
Definition:
TexturedMesh.hpp:48
lvr2::TexturedMesh::m_numFaces
size_t m_numFaces
Definition:
TexturedMesh.hpp:123
lvr2::TexturedMesh::~TexturedMesh
virtual ~TexturedMesh()
Definition:
TexturedMesh.hpp:59
lvr2::TexturedMesh::m_materials
vector< Material > & m_materials
Definition:
TexturedMesh.hpp:117
lvr2::MaterialGroup
Definition:
TexturedMesh.hpp:46
lvr2::TexturedMesh::m_faceMaterials
indexArray m_faceMaterials
Definition:
TexturedMesh.hpp:114
lvr2::RenderTriangles
Definition:
StaticMesh.hpp:69
lvr2::TexturedMesh::render
virtual void render()
Definition:
TexturedMesh.hpp:77
lvr2::indexArray
boost::shared_array< unsigned int > indexArray
Definition:
DataStruct.hpp:128
lvr2::floatArr
boost::shared_array< float > floatArr
Definition:
DataStruct.hpp:133
BaseVector.hpp
StaticMesh.hpp
lvr2::TexturedMesh::m_textureDisplayList
int m_textureDisplayList
Definition:
TexturedMesh.hpp:128
lvr2::TexturedMesh::m_textures
textureArr m_textures
Definition:
TexturedMesh.hpp:116
lvr2::TexturedMesh::m_numMaterials
size_t m_numMaterials
Definition:
TexturedMesh.hpp:124
lvr2::TexturedMesh::m_numTextures
size_t m_numTextures
Definition:
TexturedMesh.hpp:125
lvr2::TexturedMesh::m_textureMaterials
vector< MaterialGroup * > m_textureMaterials
Definition:
TexturedMesh.hpp:120
lvr2::TexturedMesh::m_numVertices
size_t m_numVertices
Definition:
TexturedMesh.hpp:126
lvr2::MaterialGroup::numFaces
int numFaces
Definition:
TexturedMesh.hpp:49
lvr2::BaseVector< float >
lvr2::TexturedMesh::m_texcoords
floatArr m_texcoords
Definition:
TexturedMesh.hpp:115
lvr2
Definition:
BaseBufferManipulators.hpp:39
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