firstPlugin.h 2.36 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
#ifndef _FIRSTPLUGIN_H_
#define _FIRSTPLUGIN_H_
Pierre Kraemer's avatar
Pierre Kraemer committed
3

Pierre Kraemer's avatar
Pierre Kraemer committed
4
#include "plugin.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
5
6

/**---CGoGN includes **/
7
#include "Topology/generic/parameters.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
8
#include "Topology/map/embeddedMap2.h"
9
10
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderFlat.h"
Pierre Kraemer's avatar
Pierre Kraemer committed
11
12
/**---CGoGN includes **/

13
14
/**---Definitions specific to CGoGN ---*/
using namespace CGoGN ;
Pierre Kraemer's avatar
Pierre Kraemer committed
15

16
17
18
19
20
21
/**
 * 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
 */
struct PFP: public PFP_STANDARD
{
Pierre Kraemer's avatar
Pierre Kraemer committed
22
	// definition of the map
23
24
	typedef EmbeddedMap2 MAP;
};
Pierre Kraemer's avatar
Pierre Kraemer committed
25

26
27
typedef PFP::MAP MAP;
typedef PFP::VEC3 VEC3;
Pierre Kraemer's avatar
Pierre Kraemer committed
28
/**---Definitions specific to CGoGN ---*/
Pierre Kraemer's avatar
Pierre Kraemer committed
29
30
31
32
33
34
35
36
37
38
39

/**
 * This class is a basic minimal plugin.
 * All the methods in this class are overloaded methods.
 * In order to create a valid plugin, all the method in this
 * needs to be declared (they are actually overloaded methods
 * from VisualPlugin), even if your plugin doesn't make any
 * drawing.
 */

/**
Pierre Kraemer's avatar
Pierre Kraemer committed
40
 * Our plugin must inherit from Plugin
Pierre Kraemer's avatar
Pierre Kraemer committed
41
 */
Pierre Kraemer's avatar
Pierre Kraemer committed
42
class FirstPlugin : public Plugin
43
{
Pierre Kraemer's avatar
Pierre Kraemer committed
44
45
46
47
48
	/**
	 * Essential Qt macros.
	 */
	Q_OBJECT
	Q_INTERFACES(Plugin)
49

Pierre Kraemer's avatar
Pierre Kraemer committed
50
public:
Pierre Kraemer's avatar
Pierre Kraemer committed
51
	FirstPlugin()
52
53
54
	{
		setProvidesRendering(true);
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
55

Pierre Kraemer's avatar
Pierre Kraemer committed
56
57
	~FirstPlugin()
	{}
Pierre Kraemer's avatar
Pierre Kraemer committed
58
59

	/**
Pierre Kraemer's avatar
Pierre Kraemer committed
60
	 * The plugin's enable method
Pierre Kraemer's avatar
Pierre Kraemer committed
61
62
63
64
65
66
	 * Each time the main application loads this plugin,
	 * it call this method. Writing this method is
	 * the occasion to initialize the plugin and check certain
	 * conditions.
	 * If this methods return 'false', the plugin load will be aborted.
	 */
67
	bool enable();
68

Pierre Kraemer's avatar
Pierre Kraemer committed
69
	/**
Pierre Kraemer's avatar
Pierre Kraemer committed
70
	 * The plugin's disable method
Pierre Kraemer's avatar
Pierre Kraemer committed
71
72
73
74
75
	 * Each time the main application will unload the plugin
	 * it will call this method.
	 */
	void disable();

76
	virtual void redraw(View *view);
Pierre Kraemer's avatar
Pierre Kraemer committed
77

78
79
80
81
82
83
84
	virtual void keyPress(View* view, int key) {}
	virtual void keyRelease(View* view, int key) {}
	virtual void mousePress(View* view, int button, int x, int y) {}
	virtual void mouseRelease(View* view, int button, int x, int y) {}
//	virtual void mouseClick(View* view, int button, int x, int y) {}
	virtual void mouseMove(View* view, int buttons, int x, int y) {}
	virtual void wheelEvent(View* view, int delta, int x, int y) {}
Pierre Kraemer's avatar
Pierre Kraemer committed
85

86
87
	virtual void viewAdded(View* view);
	virtual void viewRemoved(View* view) {}
Pierre Kraemer's avatar
Pierre Kraemer committed
88

Pierre Kraemer's avatar
Pierre Kraemer committed
89
protected:
90
91
	MAP myMap;
	VertexAttribute<VEC3> position;
92
93
94
	Algo::Render::GL2::MapRender* m_render ;
	Utils::VBO* m_positionVBO ;
	Utils::ShaderFlat* m_flatShader ;
Pierre Kraemer's avatar
Pierre Kraemer committed
95
96
};

Pierre Kraemer's avatar
Pierre Kraemer committed
97
#endif // _FIRSTPLUGIN_H_