tuto4.h 3.2 KB
Newer Older
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           *
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/                                           *
21
22
23
24
25
26
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/
#ifndef _TUTO4_H_
#define _TUTO4_H_

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

Sylvain Thery's avatar
Sylvain Thery committed
30
31
32
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
#include "Algo/Render/GL2/topoRender.h"
33
34
35


using namespace CGoGN ;
Sylvain Thery's avatar
Sylvain Thery committed
36

37
/**
Sylvain Thery's avatar
Sylvain Thery committed
38
39
 * 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
40
 */
Sylvain Thery's avatar
Sylvain Thery committed
41
42
43
44
45
46
struct PFP: public PFP_STANDARD
{
	// definition of the type of the map
	typedef EmbeddedMap2 MAP;
};

Pierre Kraemer's avatar
Pierre Kraemer committed
47
48
49
typedef PFP::MAP MAP ;
typedef PFP::VEC3 VEC3 ;

50
51
52
53
54

class MyQT: public Utils::QT::SimpleQT
{
	Q_OBJECT
public:
Sylvain Thery's avatar
Sylvain Thery committed
55
	MyQT():m_render_topo(NULL){}
56

Sylvain Thery's avatar
Sylvain Thery committed
57
58
59
	void cb_redraw();
	void cb_initGL();
	void cb_mouseClick(int button, int x, int y);
60

Sylvain Thery's avatar
Sylvain Thery committed
61
62
protected:
	// declaration of the map
Pierre Kraemer's avatar
Pierre Kraemer committed
63
	MAP myMap;
64

Sylvain Thery's avatar
Sylvain Thery committed
65
	// attribute handler on position;
Pierre Kraemer's avatar
Pierre Kraemer committed
66
	AttributeHandler<VEC3, VERTEX> position;
67

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

Sylvain Thery's avatar
Sylvain Thery committed
71
72
73
74
	// selected dart (mouse click)
	std::vector<Dart> dart_selected;
	//
	Geom::Vec3f color;
75

Sylvain Thery's avatar
Sylvain Thery committed
76
77
78
79
80
81
	// 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);}
82

Sylvain Thery's avatar
Sylvain Thery committed
83
84
85
86
public:

	// create the map (here tetrahedron
	void createMap();
87

Sylvain Thery's avatar
Sylvain Thery committed
88
89
	// traverse the map using markers
	void traverseMap();
90
91
};

Sylvain Thery's avatar
Sylvain Thery committed
92

93
#endif