tuto1.h 3.14 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-2012, 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.unistra.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 _TUTO1_
#define _TUTO1_
Pierre Kraemer's avatar
Pierre Kraemer committed
27

28
//#define USE_GMAP
29

Sylvain Thery's avatar
Sylvain Thery committed
30
31
//#include "Utils/Qt/qtSimple.h"
#include "Utils/Qt/qtQGLV.h"
32
#include "Utils/cgognStream.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
33

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

37
#include "Algo/Render/GL2/topoRender.h"
38

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

Sylvain Thery's avatar
Sylvain Thery committed
41
/**
Sylvain Thery's avatar
Sylvain Thery committed
42
43
 * 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
44
 */
Sylvain Thery's avatar
Sylvain Thery committed
45
struct PFP: public PFP_STANDARD
Pierre Kraemer's avatar
Pierre Kraemer committed
46
{
Sylvain Thery's avatar
Sylvain Thery committed
47
48
49
	// definition of the type of the map
	typedef EmbeddedMap2 MAP;
};
Sylvain Thery's avatar
Sylvain Thery committed
50

Pierre Kraemer's avatar
Pierre Kraemer committed
51
typedef PFP::MAP MAP;
Pierre Kraemer's avatar
Pierre Kraemer committed
52
typedef PFP::MAP::IMPL MAP_IMPL ;
Pierre Kraemer's avatar
Pierre Kraemer committed
53
typedef PFP::VEC3 VEC3;
Sylvain Thery's avatar
Sylvain Thery committed
54

Sylvain Thery's avatar
Sylvain Thery committed
55
class MyQT : public Utils::QT::SimpleQGLV
Sylvain Thery's avatar
Sylvain Thery committed
56
57
58
{
	Q_OBJECT
public:
Pierre Kraemer's avatar
Pierre Kraemer committed
59
	MyQT() : m_render_topo(NULL) {}
Sylvain Thery's avatar
Sylvain Thery committed
60

Sylvain Thery's avatar
Sylvain Thery committed
61
	void cb_redraw();
Sylvain Thery's avatar
Sylvain Thery committed
62
	void cb_initGL();
Sylvain Thery's avatar
Sylvain Thery committed
63
	void cb_keyPress(int keycode);
Sylvain Thery's avatar
Sylvain Thery committed
64

Sylvain Thery's avatar
Sylvain Thery committed
65
66
protected:
	// declaration of the map
Pierre Kraemer's avatar
Pierre Kraemer committed
67
68
69
	MAP myMap;

	// attribute for vertices positions
Pierre Kraemer's avatar
Pierre Kraemer committed
70
	VertexAttribute<VEC3, MAP_IMPL> position;
Pierre Kraemer's avatar
merge..    
Pierre Kraemer committed
71

Sylvain Thery's avatar
Sylvain Thery committed
72
	// render (for the topo)
Pierre Kraemer's avatar
Pierre Kraemer committed
73
	Algo::Render::GL2::TopoRenderMap<PFP>* m_render_topo;
Sylvain Thery's avatar
Sylvain Thery committed
74

Sylvain Thery's avatar
Sylvain Thery committed
75
	// just for more compact writing
Pierre Kraemer's avatar
Pierre Kraemer committed
76
77
78
	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); }
Sylvain Thery's avatar
Sylvain Thery committed
79
	template<int X>
Pierre Kraemer's avatar
Pierre Kraemer committed
80
	Dart PHI(Dart d) { return myMap.phi<X>(d); }
Pierre Kraemer's avatar
Pierre Kraemer committed
81

Sylvain Thery's avatar
Sylvain Thery committed
82
83
84
public:
	// example of simple map creation
	void createMap();
Sylvain Thery's avatar
Sylvain Thery committed
85
};
Pierre Kraemer's avatar
Pierre Kraemer committed
86

Sylvain Thery's avatar
Sylvain Thery committed
87
#endif