tuto2.h 3.33 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
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

Pierre Kraemer's avatar
merge..    
Pierre Kraemer committed
25
26
#ifndef _TUTO2_
#define _TUTO2_
Pierre Kraemer's avatar
Pierre Kraemer committed
27
28


29
#include "Utils/Qt/qtSimple.h"
Sylvain Thery's avatar
Sylvain Thery committed
30
#include "Utils/cgognStream.h"
Sylvain Thery's avatar
Sylvain Thery committed
31

Sylvain Thery's avatar
Sylvain Thery committed
32
33
34
35
36
37
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"

#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderColorPerVertex.h"
38
39


Sylvain Thery's avatar
Sylvain Thery committed
40
using namespace CGoGN ;
Pierre Kraemer's avatar
Pierre Kraemer committed
41

Sylvain Thery's avatar
Sylvain Thery committed
42
/**
Sylvain Thery's avatar
Sylvain Thery committed
43
44
 * Struct that contains some informations about the types of the manipulated objects
 * Mainly here to be used by the algorithms that are parameterized by it
Sylvain Thery's avatar
Sylvain Thery committed
45
 */
Sylvain Thery's avatar
Sylvain Thery committed
46
47
48
49
50
51
52
struct PFP: public PFP_STANDARD
{
	// definition of the type of the map
	typedef EmbeddedMap2 MAP;
};


Sylvain Thery's avatar
Sylvain Thery committed
53
class MyQT: public Utils::QT::SimpleQT
Pierre Kraemer's avatar
Pierre Kraemer committed
54
{
Sylvain Thery's avatar
Sylvain Thery committed
55
	Q_OBJECT
Sylvain Thery's avatar
Sylvain Thery committed
56
57
58
59
60
public:
	MyQT(): m_render(NULL), m_positionVBO(NULL), m_shader(NULL) {}

	void cb_redraw();
	void cb_initGL();
Sylvain Thery's avatar
Sylvain Thery committed
61

Sylvain Thery's avatar
Sylvain Thery committed
62
63
64
65
66
67
protected:
	// declaration of the map
	PFP::MAP myMap;

	// render (for the topo)
//	Algo::Render::GL2::TopoRenderMapD* m_render_topo;
Sylvain Thery's avatar
Sylvain Thery committed
68
69
70
71
72

	// render
	Algo::Render::GL2::MapRender* m_render;

	// VBO
Sylvain Thery's avatar
Sylvain Thery committed
73
74
75
	Utils::VBO* m_positionVBO;	// position 3D
	Utils::VBO* m_colorVBO1;	// color per vertex for face drawing
	Utils::VBO* m_colorVBO2;	// color per vertex for edge drawing
Sylvain Thery's avatar
Sylvain Thery committed
76

Sylvain Thery's avatar
Sylvain Thery committed
77
	//shaders
Sylvain Thery's avatar
Sylvain Thery committed
78
	Utils::ShaderSimpleColor* m_shader;
Sylvain Thery's avatar
Sylvain Thery committed
79
	Utils::ShaderColorPerVertex* m_shader2;
Sylvain Thery's avatar
Sylvain Thery committed
80

Sylvain Thery's avatar
Sylvain Thery committed
81
82
83
84
85
86
	// just for more compact writing
	inline Dart PHI1(Dart d)	{return myMap.phi1(d);}
	inline Dart PHI_1(Dart d)	{return myMap.phi_1(d);}
	inline Dart PHI2(Dart d)	{return myMap.phi2(d);}
	template<int X>
	Dart PHI(Dart d)	{return myMap.phi<X>(d);}
Sylvain Thery's avatar
Sylvain Thery committed
87

Sylvain Thery's avatar
Sylvain Thery committed
88
89
90
91
public:
	// example of simple map creation
	void createMap();
};
Sylvain Thery's avatar
Sylvain Thery committed
92
93


Pierre Kraemer's avatar
Pierre Kraemer committed
94

Sylvain Thery's avatar
Sylvain Thery committed
95
#endif