renderTopoSurface.h 2.09 KB
Newer Older
untereiner's avatar
untereiner committed
1
2
#ifndef _RENDERTOPO_SURFACE_PLUGIN_H_
#define _RENDERTOPO_SURFACE_PLUGIN_H_
3
4

#include "plugin.h"
untereiner's avatar
untereiner committed
5
#include "renderTopoSurfaceDockTab.h"
6
7
8

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

untereiner's avatar
untereiner committed
9
10
namespace CGoGN
{
11

untereiner's avatar
untereiner committed
12
13
namespace SCHNApps
{
14
15
16

struct PerMapParameterSet
{
untereiner's avatar
untereiner committed
17
18
	PerMapParameterSet(MapHandlerGen* mh);
	~PerMapParameterSet();
19

untereiner's avatar
untereiner committed
20
21
22
23
24
	void updateRender();

	Algo::Render::GL2::TopoRender* m_renderTopo;
	MapHandlerGen* mh;
	VertexAttribute<PFP2::VEC3> positionAttribute;
25
26
27
28
29
30
31
32
33
34

	float edgesScaleFactor;
	float facesScaleFactor;
};

struct ParameterSet
{
	ParameterSet() : selectedMap(NULL)
	{}

untereiner's avatar
untereiner committed
35
	QHash<QString, PerMapParameterSet*> perMap;
36
37
38
39
40
41
42
43
44
45
	MapHandlerGen* selectedMap;
};


class RenderTopoSurfacePlugin : public Plugin
{
	Q_OBJECT
	Q_INTERFACES(CGoGN::SCHNApps::Plugin)

public:
untereiner's avatar
untereiner committed
46
	RenderTopoSurfacePlugin()
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
	{
		setProvidesRendering(true);
	}

	~RenderTopoSurfacePlugin()
	{}

	virtual bool enable();
	virtual void disable();

	virtual void redraw(View *view);

	virtual void keyPress(View* view, QKeyEvent* event) {}
	virtual void keyRelease(View* view, QKeyEvent* event) {}
	virtual void mousePress(View* view, QMouseEvent* event) {}
	virtual void mouseRelease(View* view, QMouseEvent* event) {}
	virtual void mouseMove(View* view, QMouseEvent* event) {}
	virtual void wheelEvent(View* view, QWheelEvent* event) {}


protected:
untereiner's avatar
untereiner committed
68
	RenderTopoSurfaceDockTab* m_dockTab;
69
70
71
72
73
74
75
76
77
78
	QHash<View*, ParameterSet*> h_viewParams;

public slots:
	void viewLinked(View* view, Plugin* plugin);
	void viewUnlinked(View* view, Plugin* plugin);
	void currentViewChanged(View* view);

	void mapLinked(MapHandlerGen* m);
	void mapUnlinked(MapHandlerGen* m);

untereiner's avatar
untereiner committed
79
80
81
	void changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI = false);

	void changePositionAttribute(View* view, MapHandlerGen* map, VertexAttribute<PFP2::VEC3> attribute, bool fromUI = false);
82

untereiner's avatar
untereiner committed
83
84
85
86
87
	void changeEdgesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI = false);
	void changeFacesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI = false);

	void attributeModified(unsigned int orbit, QString nameAttr);
	void connectivityModified();
88
89
};

untereiner's avatar
untereiner committed
90
91
92
93
} // namespace SCHNApps

} // namespace CGoGN

94
#endif