view.h 2.67 KB
Newer Older
1 2 3
#ifndef _VIEW_H_
#define _VIEW_H_

4 5
#include <GL/glew.h>
#include <QGLViewer/qglviewer.h>
6 7 8 9

#include "types.h"
#include "Utils/gl_matrices.h"

10
//class ViewButton;
11 12 13 14 15 16

class View : public QGLViewer
{
	Q_OBJECT

public:
17 18 19
	static unsigned int viewCount;

	View(const QString& name, Window* w, QWidget* parent, const QGLWidget* shareWidget = NULL);
20 21
	~View();

Pierre Kraemer's avatar
Pierre Kraemer committed
22 23 24 25 26 27 28 29 30 31
	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; }

	Scene* getScene() { return m_scene; }
	void setScene(Scene* s) { m_scene = s; }

	Camera* getCurrentCamera() { return m_currentCamera; }
32
	void setCurrentCamera(Camera* c);
Pierre Kraemer's avatar
Pierre Kraemer committed
33

34 35
	Context* getContext() { return m_context; }
	void setContext(Context* c) { m_context = c; }
Pierre Kraemer's avatar
Pierre Kraemer committed
36 37

	virtual void initGL();
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
	virtual void updateGL();
	virtual void draw();
	void drawText();
	void drawButtons();

	void keyPressEvent(QKeyEvent* event);
	void keyReleaseEvent(QKeyEvent *e);
	void mousePressEvent(QMouseEvent* event);
	void mouseReleaseEvent(QMouseEvent* event);
	void mouseMoveEvent(QMouseEvent* event);
	void wheelEvent(QWheelEvent* event);

	virtual void resizeGL(int width, int height);

	void drawOverpaint(QPainter *painter);

//	virtual void paintGL() { update(); }
//	virtual void paintEvent(QPaintEvent *event);

	void enableLinking(bool b = true);
	void enableUnlinking(bool b = true);
	void enableCameraGesture(bool b = true);
	void enableSceneCameraGesture(bool b = true);
	void enableViewClose(bool b = true);

//	void addUnlinkButton();
//	void removeUnlinkButton();

	void updateTextInfo();

	glm::mat4 getCurrentModelViewMatrix();
	glm::mat4 getCurrentProjectionMatrix();
	glm::mat4 getCurrentModelViewProjectionMatrix();

Pierre Kraemer's avatar
Pierre Kraemer committed
72 73
	void setCurrentModelViewMatrix(const glm::mat4& mvm);
	void setCurrentProjectionMatrix(const glm::mat4& pm);
74

Pierre Kraemer's avatar
Pierre Kraemer committed
75 76
//	void addViewButton(ViewButton* viewButton);
//	void removeViewButton(ViewButton* viewButton);
77

Pierre Kraemer's avatar
Pierre Kraemer committed
78
//	void setShowButtons(bool b) { b_showButtons = b; }
79 80 81

protected:
	QString m_name;
Pierre Kraemer's avatar
Pierre Kraemer committed
82
	Window* m_window;
83
	Context* m_context;
84 85

	Scene* m_scene;
86 87
	Camera* m_currentCamera;

Pierre Kraemer's avatar
Pierre Kraemer committed
88
//	ViewButtonArea* m_buttonArea;
89

Pierre Kraemer's avatar
Pierre Kraemer committed
90 91 92 93 94 95 96 97 98 99
//	ViewButton* m_linkButton;
//	bool m_linkViewEnabled;
//	ViewButton* m_unlinkButton;
//	bool m_unlinkViewEnabled;
//	ViewButton* m_cameraButton;
//	bool m_cameraEnabled;
//	ViewButton* m_cameraSceneButton;
//	bool m_cameraSceneEnabled;
//	ViewButton* m_closeViewButton;
//	bool m_closeViewEnabled;
100

Pierre Kraemer's avatar
Pierre Kraemer committed
101
//	bool b_showButtons;
102

Pierre Kraemer's avatar
Pierre Kraemer committed
103 104
	QString m_textInfo;
	bool b_drawText;
105

Pierre Kraemer's avatar
Pierre Kraemer committed
106 107 108 109 110 111
//public slots:
//	void linkView();
//	void unlinkView();
//	void cameraGesture();
//	void cameraSceneGesture();
//	void closeView();
112

Pierre Kraemer's avatar
Pierre Kraemer committed
113 114
//signals:
//	void currentCameraChanged(Camera* camera);
115 116 117
};

#endif