Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

explodeVolumeRender.h 4.61 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg           *
Pierre Kraemer's avatar
Pierre Kraemer committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
*                                                                              *
* This library is free software; you can redistribute it and/or modify it      *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your     *
* option) any later version.                                                   *
*                                                                              *
* This library is distributed in the hope that it will be useful, but WITHOUT  *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License  *
* for more details.                                                            *
*                                                                              *
* You should have received a copy of the GNU Lesser General Public License     *
* along with this library; if not, write to the Free Software Foundation,      *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
20
* Web site: http://cgogn.u-strasbg.fr/                                         *
Pierre Kraemer's avatar
Pierre Kraemer committed
21
22
23
24
25
26
27
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef _EXPLODE_VOLUME_VBO_RENDER
#define _EXPLODE_VOLUME_VBO_RENDER

Sylvain Thery's avatar
Sylvain Thery committed
28
#include <GL/glew.h>
Pierre Kraemer's avatar
Pierre Kraemer committed
29
30
31
32
33
34
35

#include <vector>
#include <list>

#include "Topology/generic/dart.h"
#include "Topology/generic/attributeHandler.h"
#include "Topology/generic/functor.h"
36
37
38
#include "Utils/vbo.h"
#include "Utils/Shaders/shaderExplodeVolumes.h"
#include "Utils/Shaders/shaderExplodeVolumesLines.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
39
40
41
42
43
44
45
46
47
48

namespace CGoGN
{

namespace Algo
{

namespace Render
{

Sylvain Thery's avatar
Sylvain Thery committed
49
namespace GL2
Pierre Kraemer's avatar
Pierre Kraemer committed
50
51
52
{


53
class ExplodeVolumeRender
Pierre Kraemer's avatar
Pierre Kraemer committed
54
55
56
{
protected:

57
	Utils::ShaderExplodeVolumes* m_shader;
Pierre Kraemer's avatar
Pierre Kraemer committed
58

59
60
	bool m_cpf;

61
62
	bool m_ef;

63
64
65
66
	Utils::ShaderExplodeVolumesLines* m_shaderL;

	Utils::VBO* m_vboPos;

67
68
	Utils::VBO* m_vboColors;

69
	Utils::VBO* m_vboPosLine;
Pierre Kraemer's avatar
Pierre Kraemer committed
70
71
72
73
74
75

	/**
	*number of triangles to draw
	*/
	GLuint m_nbTris;

76
77
	GLuint m_nbLines;

78
79
	Geom::Vec3f m_globalColor;

80
81


Pierre Kraemer's avatar
Pierre Kraemer committed
82
83
84
public:
	/**
	* Constructor
85
86
	* @param withColorPerFace affect a color per face
	* @param withExplodeFace shrinj each face
Pierre Kraemer's avatar
Pierre Kraemer committed
87
	*/
88
	ExplodeVolumeRender(bool withColorPerFace=false, bool withExplodeFace=false) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
89
90
91
92

	/**
	* Destructor
	*/
Sylvain Thery's avatar
Sylvain Thery committed
93
	~ExplodeVolumeRender() ;
94
95
96
97

	/**
	 * return a ptr on used shader do not forgot to register
	 */
Sylvain Thery's avatar
Sylvain Thery committed
98
	Utils::GLSLShader* shaderFaces() ;
99
100
101
102

	/**
	 * return a ptr on used shader do not forgot to register
	 */
Sylvain Thery's avatar
Sylvain Thery committed
103
	Utils::GLSLShader* shaderLines() ;
104

Pierre Kraemer's avatar
Pierre Kraemer committed
105
106
107
108
	/**
	* update all drawing buffers
	* @param map the map
	* @param positions  attribute of position vertices
109
	* @param good selector
Pierre Kraemer's avatar
Pierre Kraemer committed
110
	*/
111
112
	template<typename PFP>
	void updateData(typename PFP::MAP& map, typename PFP::TVEC3& positions, const FunctorSelect& good = allDarts) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
113

114
115
116
117
118
119
120
121
122
123
	/**
	* update all drawing buffers
	* @param map the map
	* @param positions  attribute of position vertices
	* @param colorPerFace attribute of color (per face)
	* @param good selector
	*/
	template<typename PFP>
	void updateData(typename PFP::MAP& map, typename PFP::TVEC3& positions, typename PFP::TVEC3& colorPerFace, const FunctorSelect& good = allDarts) ;

Pierre Kraemer's avatar
Pierre Kraemer committed
124
	/**
125
	 * draw edges
Pierre Kraemer's avatar
Pierre Kraemer committed
126
	 */
Sylvain Thery's avatar
Sylvain Thery committed
127
	void drawEdges() ;
128

129
130
131
	/**
	 * draw edges
	 */
Sylvain Thery's avatar
Sylvain Thery committed
132
	void drawFaces() ;
133

Sylvain Thery's avatar
Sylvain Thery committed
134
135
136
137
	/**
	 * set exploding volume coefficient parameter
	 */
	void setExplodeVolumes(float explode) ;
138

139
140
141
142
143
	/**
	 * set exploding volume coefficient parameter
	 */
	void setExplodeFaces(float explode) ;

Sylvain Thery's avatar
Sylvain Thery committed
144
145
146
147
	/**
	 * set clipping plane
	 */
	void setClippingPlane(const Geom::Vec4f& p) ;
148

Sylvain Thery's avatar
Sylvain Thery committed
149
150
151
152
	/**
	 * unset clipping plane
	 */
	void setNoClippingPlane() ;
153

Sylvain Thery's avatar
Sylvain Thery committed
154
155
156
157
	/**
	 * set ambiant color parameter
	 */
	void setAmbiant(const Geom::Vec4f& ambiant) ;
158

Sylvain Thery's avatar
Sylvain Thery committed
159
	/**
160
	 * set back color parameter
Sylvain Thery's avatar
Sylvain Thery committed
161
	 */
162
	void setBackColor(const Geom::Vec4f& color) ;
163

Sylvain Thery's avatar
Sylvain Thery committed
164
165
166
167
168
169
170
171
172
	/**
	 * set light position parameter
	 */
	void setLightPosition(const Geom::Vec3f& lp) ;

	/**
	 * set color parameter for edge drawing
	 */
	void setColorLine(const Geom::Vec4f& col) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
173
174
};

Sylvain Thery's avatar
Sylvain Thery committed
175
}//end namespace GL2
Pierre Kraemer's avatar
Pierre Kraemer committed
176
177
178
179
180
181
182

}//end namespace Algo

}//end namespace Render

}//end namespace CGoGN

Sylvain Thery's avatar
Sylvain Thery committed
183
#include "Algo/Render/GL2/explodeVolumeRender.hpp"
Pierre Kraemer's avatar
Pierre Kraemer committed
184
185

#endif