-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGLViewer.h
74 lines (60 loc) · 2.02 KB
/
GLViewer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
72
73
74
// *********************************************************
// OpenGL Viewer Class, based on LibQGLViewer, compatible
// with most hardware (OpenGL 1.2).
// Author : Tamy Boubekeur ([email protected]).
// Copyright (C) 2010 Tamy Boubekeur.
// All rights reserved.
// *********************************************************
#ifndef GLVIEWER_H
#define GLVIEWER_H
#include <GL/glew.h>
#include <QGLViewer/qglviewer.h>
#include <vector>
#include <string>
#include "Scene.h"
class GLViewer : public QGLViewer {
Q_OBJECT
public:
typedef enum {Flat=0, Smooth=1} RenderingMode;
typedef enum {OpenGLDisplayMode=0, RayDisplayMode=1} DisplayMode;
GLViewer ();
virtual ~GLViewer ();
inline bool isWireframe () const { return wireframe; }
inline int getRenderingMode () const { return renderingMode; }
inline const QImage & getRayImage () const { return rayImage; }
class Exception {
public:
Exception (const std::string & msg) : message ("[GLViewer]"+msg) {}
virtual ~Exception () {}
const std::string & getMessage () const { return message; }
private:
std::string message;
};
public slots :
void setWireframe (bool b);
void setRenderingMode (RenderingMode m);
void setRenderingMode (int m) { setRenderingMode (static_cast<RenderingMode>(m)); }
void setDisplayMode (DisplayMode m);
void setDisplayMode (int m) { setRenderingMode (static_cast<DisplayMode>(m)); }
void setRayImage (const QImage & image);
protected :
void init();
void draw ();
QString helpString() const;
virtual void keyPressEvent (QKeyEvent * event);
virtual void keyReleaseEvent (QKeyEvent * event);
virtual void mousePressEvent (QMouseEvent * event);
virtual void wheelEvent (QWheelEvent * e);
private:
bool wireframe;
RenderingMode renderingMode;
DisplayMode displayMode;
QImage rayImage;
};
#endif // GLVIEWER_H
// Some Emacs-Hints -- please don't remove:
//
// Local Variables:
// mode:C++
// tab-width:4
// End: