scene.h 2.12 KB
Newer Older
1 2 3 4 5
#ifndef _SCENE_H_
#define _SCENE_H_

#include "types.h"

6 7 8
class QKeyEvent;
class QMouseEvent;
class QWheelEvent;
9 10 11 12 13 14

class Scene : public QObject
{
	Q_OBJECT

public:
15 16
	static unsigned int sceneCount;

Pierre Kraemer's avatar
Pierre Kraemer committed
17
	Scene(const QString& name, Window* window);
18 19
	~Scene();

Pierre Kraemer's avatar
Pierre Kraemer committed
20 21 22 23 24 25
	const QString& getName() { return m_name; }
	void setName(const QString& name) { m_name = name; }

	Window* getWindow() { return m_window; }
	void setWindow(Window* w) { m_window = w; }

26 27
	Context* getContext() { return m_context; }
	void setContext(Context* c) { m_context = c; }
Pierre Kraemer's avatar
Pierre Kraemer committed
28 29 30 31

	void initGL();
	void updateGL();
	void draw(View *v);
32

Pierre Kraemer's avatar
Pierre Kraemer committed
33 34 35 36 37 38
	void keyPressEvent(QKeyEvent* event);
	void keyReleaseEvent(QKeyEvent *e);
	void mousePressEvent(QMouseEvent* event);
	void mouseReleaseEvent(QMouseEvent* event);
	void mouseMoveEvent(QMouseEvent* event);
	void wheelEvent(QWheelEvent* event);
39

Pierre Kraemer's avatar
Pierre Kraemer committed
40 41 42
	/*********************************************************
	 * MANAGE VIEWS
	 *********************************************************/
Pierre Kraemer's avatar
Pierre Kraemer committed
43 44
	void linkView(View* view);
	void unlinkView(View* view);
45
	View* getLinkedView(int num);
Pierre Kraemer's avatar
Pierre Kraemer committed
46 47
	QList<View*> getLinkedViews() { return l_views; }
	int getNbLinkedViews() { return l_views.size(); }
48

Pierre Kraemer's avatar
Pierre Kraemer committed
49 50 51
	/*********************************************************
	 * MANAGE PLUGINS
	 *********************************************************/
Pierre Kraemer's avatar
Pierre Kraemer committed
52 53 54 55 56
	void linkPlugin(Plugin* plugin, bool callInitGL = true);
	void unlinkPlugin(Plugin* plugin);
	QList<Plugin*> getLinkedPlugins() { return l_plugins; }
	bool isLinkedToPlugins() { return !l_plugins.isEmpty(); }
	bool isLinkedToPlugin(Plugin* plugin) { return l_plugins.contains(plugin); }
Pierre Kraemer's avatar
Pierre Kraemer committed
57 58 59
//	void linkWithPlugin();
//	void unlinkPlugin();

60 61 62 63 64 65 66 67 68 69 70
//	VBOHandler* addNewVBO(QString name);
//	void addVBO(VBOHandler* vbo);
//	VBOHandler* findVBO(QString name);
//	VBOHandler* findFirstVBOMatching(QRegExp regexp);
//	QList<VBOHandler*> findVBOsMatching(QRegExp regexp);
//	VBOHandler* takeVBO(VBOHandler* vbo);

	void firstViewFitSphere(float x, float y, float z, float radius);

protected:
	QString m_name;
Pierre Kraemer's avatar
Pierre Kraemer committed
71
	Window* m_window;
72
	Context* m_context;
73

Pierre Kraemer's avatar
Pierre Kraemer committed
74 75 76
	QList<View*> l_views;
	QList<Plugin*> l_plugins;
//	QList<VBOHandler*> l_vbo;
Pierre Kraemer's avatar
Pierre Kraemer committed
77
//	QList<ViewButton*> l_viewButtons;
78 79 80
};

#endif