Fixed normal calculation at edges, more UI changes
[ted.git] / qsrc / terraindisplay.h
blob72e374033d9178d727028f4fac005a35e5dda2e4
1 #ifndef TERRAINDISPLAY_H
2 #define TERRAINDISPLAY_H
4 #include "../src/terrain.h"
6 #ifdef __cplusplus
7 extern "C++" {
8 #endif
10 #include <QtOpenGL/QGLWidget>
12 class TerrainDisplay : public QGLWidget
14 Q_OBJECT
16 public:
17 TerrainDisplay(QWidget *parent = 0);
18 ~TerrainDisplay();
20 QSize minimumSizeHint() const;
21 QSize sizeHint() const;
23 float getZoom() { return m_zoom; }
25 float getXRotation() { return m_rot[0]; }
26 float getYRotation() { return m_rot[1]; }
27 float getZRotation() { return m_rot[2]; }
29 float getRoughness() { return m_roughness; }
30 float getMagnitude() { return m_magnitude; }
32 int getSize() { return m_mesh->size; }
33 int getSeed() { return m_mesh->seed; }
35 protected:
36 void initializeGL();
37 void resizeGL(int w, int h);
38 void paintGL();
39 void mousePressEvent(QMouseEvent *event);
40 void mouseMoveEvent(QMouseEvent *event);
42 public slots:
43 void setZoom(double amount);
45 void setXRotation(double angle);
46 void setYRotation(double angle);
47 void setZRotation(double angle);
49 void setRoughness(double rough);
50 void setMagnitude(double mag);
52 void setSize(int size);
53 void setSeed(int seed);
55 void setDrawMode(int mode);
57 void zoomFit();
58 void makeFractal();
60 signals:
61 void zoomChanged(double amount);
63 void xRotationChanged(double angle);
64 void yRotationChanged(double angle);
65 void zRotationChanged(double angle);
67 void roughnessChanged(double rough);
68 void magnitudeChanged(double mag);
70 void sizeChanged(int size);
71 void seedChanged(int seed);
73 private:
74 bool m_controllable;
76 double m_zoom, m_maxZoom;
77 double m_rot[3];
78 double m_mouseSensitivity;
80 QPoint m_lastPos;
82 double m_roughness;
83 double m_magnitude;
84 struct terrain *m_mesh;
87 #ifdef __cplusplus
89 #endif
91 #endif // TERRAINDISPLAY_H