Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

surface_renderVector.h 3.45 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef _SURFACE_RENDERVECTOR_PLUGIN_H_
#define _SURFACE_RENDERVECTOR_PLUGIN_H_

#include "plugin_interaction.h"
#include "surface_renderVector_dockTab.h"

#include "Utils/Shaders/shaderVectorPerVertex.h"

namespace CGoGN
{

namespace SCHNApps
{

struct MapParameters
{
	MapParameters() :
18
		positionVBO(NULL)
Pierre Kraemer's avatar
Pierre Kraemer committed
19
20
21
22
	{}

	Utils::VBO* positionVBO;
	QList<Utils::VBO*> vectorVBOs;
23
24
	QList<QColor> colors;
	QList<float> scaleFactors;
Pierre Kraemer's avatar
Pierre Kraemer committed
25
26
};

Sylvain Thery's avatar
Sylvain Thery committed
27
/**
Sylvain Thery's avatar
Sylvain Thery committed
28
* @brief Plugin for vector attributes rendering over a surface mesh
Sylvain Thery's avatar
Sylvain Thery committed
29
30
31
32
* Each vector attribute to render must be of dim 3, and have a VBO
* The length and color of each vector can be changed.
* All parameters are per view / per map.
*/
Pierre Kraemer's avatar
Pierre Kraemer committed
33
34
35
36
class Surface_RenderVector_Plugin : public PluginInteraction
{
	Q_OBJECT
	Q_INTERFACES(CGoGN::SCHNApps::Plugin)
Sylvain Thery's avatar
Sylvain Thery committed
37
38
39
#if CGOGN_QT_DESIRED_VERSION == 5
	Q_PLUGIN_METADATA(IID "CGoGN.SCHNapps.Plugin")
#endif
Pierre Kraemer's avatar
Pierre Kraemer committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
	friend class Surface_RenderVector_DockTab;

public:
	Surface_RenderVector_Plugin()
	{}

	~Surface_RenderVector_Plugin()
	{}

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

	virtual void draw(View *view) {}
	virtual void drawMap(View* view, MapHandlerGen* map);

Sylvain Thery's avatar
Sylvain Thery committed
55
56
57
58
59
60
	virtual void keyPress(View* , QKeyEvent* ) {}
	virtual void keyRelease(View* , QKeyEvent* ) {}
	virtual void mousePress(View* , QMouseEvent* ) {}
	virtual void mouseRelease(View* , QMouseEvent* ) {}
	virtual void mouseMove(View* , QMouseEvent* ) {}
	virtual void wheelEvent(View* , QWheelEvent* ) {}
Pierre Kraemer's avatar
Pierre Kraemer committed
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

	virtual void viewLinked(View *view) {}
	virtual void viewUnlinked(View *view) {}

private slots:
	// slots called from SCHNApps signals
	void selectedViewChanged(View* prev, View* cur);
	void selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur);
	void mapAdded(MapHandlerGen* map);
	void mapRemoved(MapHandlerGen* map);

	// slots called from MapHandler signals
	void vboAdded(Utils::VBO* vbo);
	void vboRemoved(Utils::VBO* vbo);

public slots:
	// slots for Python calls
Sylvain Thery's avatar
Sylvain Thery committed
78
	/**
Sylvain Thery's avatar
Sylvain Thery committed
79
	 * @brief [PYTHON] change the position VBO use for rendering for specific view and map
Sylvain Thery's avatar
Sylvain Thery committed
80
81
82
83
	 * @param view the view name
	 * @param map the map name
	 * @param vbo
	 */
Pierre Kraemer's avatar
Pierre Kraemer committed
84
	void changePositionVBO(const QString& view, const QString& map, const QString& vbo);
Sylvain Thery's avatar
Sylvain Thery committed
85
86

	/**
Sylvain Thery's avatar
Sylvain Thery committed
87
	 * @brief [PYTHON] add a VBO use for rendering for specific view and map
Sylvain Thery's avatar
Sylvain Thery committed
88
89
90
91
	 * @param view the view name
	 * @param map the map name
	 * @param vbo
	 */
Pierre Kraemer's avatar
Pierre Kraemer committed
92
	void addVectorVBO(const QString& view, const QString& map, const QString& vbo);
Sylvain Thery's avatar
Sylvain Thery committed
93
94

	/**
Sylvain Thery's avatar
Sylvain Thery committed
95
	 * @brief [PYTHON] remove VBO of the corresponding vector
Sylvain Thery's avatar
Sylvain Thery committed
96
97
	 * @param view the view name
	 * @param map the map name
Sylvain Thery's avatar
Sylvain Thery committed
98
	 * @param vbo  the vbo name
Sylvain Thery's avatar
Sylvain Thery committed
99
	 */
Pierre Kraemer's avatar
Pierre Kraemer committed
100
	void removeVectorVBO(const QString& view, const QString& map, const QString& vbo);
Sylvain Thery's avatar
Sylvain Thery committed
101
102

	/**
Sylvain Thery's avatar
Sylvain Thery committed
103
	 * @brief [PYTHON] change the vector scale factor
Sylvain Thery's avatar
Sylvain Thery committed
104
105
	 * @param view the view name
	 * @param map the map name
Sylvain Thery's avatar
Sylvain Thery committed
106
107
	 * @param vbo vbo vector name on which apply the scale
	 * @param f the floating point scale value
Sylvain Thery's avatar
Sylvain Thery committed
108
	 */
109
	void changeVectorScaleFactor(const QString& view, const QString& map, const QString& vbo, float f);
Sylvain Thery's avatar
Sylvain Thery committed
110
111

	/**
Sylvain Thery's avatar
Sylvain Thery committed
112
	 * @brief [PYTHON] change thet vector color
Sylvain Thery's avatar
Sylvain Thery committed
113
114
	 * @param view the view name
	 * @param map the map name
Sylvain Thery's avatar
Sylvain Thery committed
115
116
	 * @param vbo the vbo vector name
	 * @param col the color in QString format ("red" or "#FF0000")
Sylvain Thery's avatar
Sylvain Thery committed
117
	 */
Sylvain Thery's avatar
Sylvain Thery committed
118
	void changeVectorColor(const QString& view, const QString& map, const QString& vbo, const QString& col);
Pierre Kraemer's avatar
Pierre Kraemer committed
119
120
121
122
123
124
125
126
127
128
129
130
131

protected:
	Surface_RenderVector_DockTab* m_dockTab;
	QHash<View*, QHash<MapHandlerGen*, MapParameters> > h_viewParameterSet;

	CGoGN::Utils::ShaderVectorPerVertex* m_vectorShader;
};

} // namespace SCHNApps

} // namespace CGoGN

#endif