renderTopoSurface.h 2.82 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
	void updateRender();

	MapHandlerGen* mh;
23
	Algo::Render::GL2::TopoRender* m_renderTopo;
untereiner's avatar
untereiner committed
24
	VertexAttribute<PFP2::VEC3> positionAttribute;
25

26
	bool drawDarts;
Pierre Kraemer's avatar
Pierre Kraemer committed
27
	QColor dartsColor;
28
	bool drawPhi1;
Pierre Kraemer's avatar
Pierre Kraemer committed
29
	QColor phi1Color;
30
	bool drawPhi2;
Pierre Kraemer's avatar
Pierre Kraemer committed
31
	QColor phi2Color;
32 33 34 35 36 37 38 39 40
	float edgesScaleFactor;
	float facesScaleFactor;
};

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

untereiner's avatar
untereiner committed
41
	QHash<QString, PerMapParameterSet*> perMap;
42 43 44 45 46 47 48 49 50 51
	MapHandlerGen* selectedMap;
};


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

public:
untereiner's avatar
untereiner committed
52
	RenderTopoSurfacePlugin()
53 54 55 56 57 58 59 60 61 62 63 64 65 66
	{
		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) {}
untereiner's avatar
untereiner committed
67
	virtual void mousePress(View* view, QMouseEvent* event);
68 69 70 71 72
	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
73
	RenderTopoSurfaceDockTab* m_dockTab;
74 75 76 77 78 79 80 81 82 83
	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);

84 85 86 87 88 89 90
protected:
	void addManagedMap(View *v, MapHandlerGen* m);
	void removeManagedMap(View *v, MapHandlerGen* m);

public slots:
	void changeSelectedMap(View* view, MapHandlerGen* map);

untereiner's avatar
untereiner committed
91
	void changePositionAttribute(View* view, MapHandlerGen* map, VertexAttribute<PFP2::VEC3> attribute, bool fromUI = false);
92
	void changeDrawDarts(View* view, MapHandlerGen* map, bool b, bool fromUI = false);
Pierre Kraemer's avatar
Pierre Kraemer committed
93
	void changeDartsColor(View* view, MapHandlerGen* map, QColor c, bool fromUI = false);
94
	void changeDrawPhi1(View* view, MapHandlerGen* map, bool b, bool fromUI = false);
Pierre Kraemer's avatar
Pierre Kraemer committed
95
	void changePhi1Color(View* view, MapHandlerGen* map, QColor c, bool fromUI = false);
96
	void changeDrawPhi2(View* view, MapHandlerGen* map, bool b, bool fromUI = false);
Pierre Kraemer's avatar
Pierre Kraemer committed
97
	void changePhi2Color(View* view, MapHandlerGen* map, QColor c, bool fromUI = false);
untereiner's avatar
untereiner committed
98 99 100 101 102
	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();
untereiner's avatar
untereiner committed
103 104 105

signals:
	void dartSelected(Dart d);
106 107
};

untereiner's avatar
untereiner committed
108 109 110 111
} // namespace SCHNApps

} // namespace CGoGN

112
#endif