2012-07-13 12:23:58 +00:00
|
|
|
#ifndef _PAYSAGES_QT_WIDGETHEIGHTMAP_H_
|
|
|
|
#define _PAYSAGES_QT_WIDGETHEIGHTMAP_H_
|
|
|
|
|
|
|
|
#include <QGLWidget>
|
2012-07-15 14:42:50 +00:00
|
|
|
#include "../lib_paysages/euclid.h"
|
2012-07-13 12:23:58 +00:00
|
|
|
#include "../lib_paysages/heightmap.h"
|
|
|
|
|
2012-07-15 14:42:50 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Vector3 point;
|
|
|
|
Vector3 normal;
|
|
|
|
} _VertexInfo;
|
|
|
|
|
2012-07-13 12:23:58 +00:00
|
|
|
class WidgetHeightMap : public QGLWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
WidgetHeightMap(QWidget* parent, HeightMap* heightmap);
|
|
|
|
~WidgetHeightMap();
|
2012-07-13 21:24:19 +00:00
|
|
|
|
|
|
|
void setHorizontalViewAngle(double angle_h);
|
|
|
|
void setVerticalViewAngle(double angle_v);
|
2012-07-15 14:42:50 +00:00
|
|
|
void setBrushSize(double size);
|
|
|
|
void setBrushSmoothing(double smoothing);
|
2012-07-13 21:24:19 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void resetToTerrain();
|
2012-07-13 12:23:58 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void keyPressEvent(QKeyEvent* event);
|
|
|
|
void mousePressEvent(QMouseEvent* event);
|
|
|
|
void mouseMoveEvent(QMouseEvent* event);
|
|
|
|
void wheelEvent(QWheelEvent* event);
|
|
|
|
|
|
|
|
void initializeGL();
|
|
|
|
void resizeGL(int w, int h);
|
|
|
|
void paintGL();
|
|
|
|
|
2012-07-15 14:42:50 +00:00
|
|
|
private:
|
|
|
|
void updateVertexInfo();
|
|
|
|
|
2012-07-13 12:23:58 +00:00
|
|
|
private:
|
2012-07-13 21:24:19 +00:00
|
|
|
HeightMap* _heightmap;
|
2012-07-15 14:42:50 +00:00
|
|
|
_VertexInfo* _vertexes;
|
|
|
|
|
|
|
|
bool _dirty;
|
2012-07-13 21:24:19 +00:00
|
|
|
|
2012-07-13 12:23:58 +00:00
|
|
|
double _average_frame_time;
|
2012-07-13 21:24:19 +00:00
|
|
|
|
2012-07-13 12:23:58 +00:00
|
|
|
int _last_mouse_x;
|
|
|
|
int _last_mouse_y;
|
2012-07-13 21:24:19 +00:00
|
|
|
|
|
|
|
double _angle_h;
|
|
|
|
double _angle_v;
|
2012-07-15 14:42:50 +00:00
|
|
|
|
|
|
|
double _brush_x;
|
|
|
|
double _brush_z;
|
|
|
|
double _brush_size;
|
|
|
|
double _brush_smoothing;
|
2012-07-13 12:23:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|