renderExplod.h 2.58 KB
Newer Older
1 2 3 4
#ifndef _RENDER_PLUGIN_H_
#define _RENDER_PLUGIN_H_

#include "plugin.h"
5
#include "renderExplodDockTab.h"
6 7 8

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

9 10
namespace CGoGN
{
11

12 13
namespace SCHNApps
{
14

untereiner's avatar
untereiner committed
15 16 17 18 19 20
enum FaceShadingStyle
{
	FLAT = 0,
	SMOOTH = 1
};

21 22
struct PerMapParameterSet
{
untereiner's avatar
untereiner committed
23 24
	PerMapParameterSet(MapHandlerGen* mh);
	~PerMapParameterSet();
25

untereiner's avatar
untereiner committed
26
	void updateRender();
27

untereiner's avatar
untereiner committed
28 29 30 31
	Algo::Render::GL2::ExplodeVolumeRender* m_renderExplod;
	MapHandlerGen* mh;
	VertexAttribute<PFP3::VEC3> positionAttribute;
	VolumeAttribute<PFP3::VEC3> colorAttribute;
32 33 34 35
	float facesScaleFactor;
	float volumesScaleFactor;
	bool renderEdges;
	bool renderFaces;
untereiner's avatar
untereiner committed
36
	FaceShadingStyle faceStyle;
37 38 39 40 41 42 43
};

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

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


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

public:
55
	RenderExplodPlugin()
56 57 58 59 60 61 62 63 64 65 66 67
	{
		setProvidesRendering(true);
	}

	~RenderExplodPlugin()
	{}

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

	virtual void redraw(View *view);

68 69 70 71 72 73
	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) {}
74 75 76 77 78 79

protected:
	RenderExplodDockTab* m_dockTab;
	QHash<View*, ParameterSet*> h_viewParams;

public slots:
80 81 82 83 84 85 86
	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
87
	//void addAttributeToList(unsigned int orbit, const QString& nameAttr);
88

89
	void changeSelectedMap(View* view, MapHandlerGen* map, bool fromUI = false);
untereiner's avatar
untereiner committed
90 91 92 93

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

94 95 96 97
	void changeRenderEdges(View* view, MapHandlerGen* map, bool b, bool fromUI = false);
	void changeRenderFaces(View* view, MapHandlerGen* map, bool b, bool fromUI = false);
	void changeFacesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI = false);
	void changeVolumesScaleFactor(View* view, MapHandlerGen* map, int i, bool fromUI = false);
untereiner's avatar
untereiner committed
98 99 100

	void attributeModified(unsigned int orbit, QString nameAttr);
	void connectivityModified();
101 102
};

103 104 105 106
} // namespace SCHNApps

} // namespace CGoGN

107
#endif