2013-11-05 10:45:26 +00:00
|
|
|
#ifndef WIDGETEXPLORER_H
|
|
|
|
#define WIDGETEXPLORER_H
|
2012-01-27 14:47:08 +00:00
|
|
|
|
2013-11-05 10:45:26 +00:00
|
|
|
#include "opengl_global.h"
|
2013-11-14 20:05:12 +00:00
|
|
|
|
2012-01-27 14:47:08 +00:00
|
|
|
#include <QGLWidget>
|
2013-11-05 10:45:26 +00:00
|
|
|
|
2013-11-14 20:05:12 +00:00
|
|
|
#include <QMutex>
|
2013-11-05 10:45:26 +00:00
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace opengl {
|
|
|
|
|
2013-11-14 17:47:03 +00:00
|
|
|
class OPENGLSHARED_EXPORT WidgetExplorer : public QGLWidget
|
2012-01-27 14:47:08 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-12-09 21:16:00 +00:00
|
|
|
WidgetExplorer(QWidget* parent, CameraDefinition* camera, SoftwareRenderer* renderer);
|
2012-06-08 12:54:57 +00:00
|
|
|
~WidgetExplorer();
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2012-05-08 14:07:47 +00:00
|
|
|
void performChunksMaintenance();
|
2012-01-27 14:47:08 +00:00
|
|
|
|
2012-01-27 23:01:21 +00:00
|
|
|
public slots:
|
|
|
|
void resetCamera();
|
|
|
|
void validateCamera();
|
|
|
|
|
2012-01-27 14:47:08 +00:00
|
|
|
protected:
|
2012-01-27 16:01:34 +00:00
|
|
|
void keyPressEvent(QKeyEvent* event);
|
|
|
|
void mousePressEvent(QMouseEvent* event);
|
|
|
|
void mouseMoveEvent(QMouseEvent* event);
|
|
|
|
void wheelEvent(QWheelEvent* event);
|
2012-05-08 14:07:47 +00:00
|
|
|
void timerEvent(QTimerEvent *event);
|
2012-01-27 16:01:34 +00:00
|
|
|
|
2012-01-27 14:47:08 +00:00
|
|
|
void initializeGL();
|
|
|
|
void resizeGL(int w, int h);
|
|
|
|
void paintGL();
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2012-01-27 14:47:08 +00:00
|
|
|
private:
|
2013-01-31 14:02:17 +00:00
|
|
|
void startRendering();
|
|
|
|
void stopRendering();
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2013-04-27 19:41:57 +00:00
|
|
|
CameraDefinition* _current_camera;
|
2012-01-27 23:01:21 +00:00
|
|
|
CameraDefinition* _base_camera;
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2013-11-05 10:45:26 +00:00
|
|
|
OpenGLRenderer* _opengl_renderer;
|
2013-11-14 20:05:12 +00:00
|
|
|
SoftwareRenderer* _renderer;
|
2013-01-31 14:02:17 +00:00
|
|
|
bool _inited;
|
2012-05-08 14:07:47 +00:00
|
|
|
bool _updated;
|
2012-12-09 17:49:28 +00:00
|
|
|
|
2012-06-08 12:28:46 +00:00
|
|
|
QVector<BaseExplorerChunk*> _chunks;
|
|
|
|
QList<BaseExplorerChunk*> _updateQueue;
|
2012-05-08 14:07:47 +00:00
|
|
|
bool _alive;
|
|
|
|
QMutex _lock_chunks;
|
2012-01-27 23:01:21 +00:00
|
|
|
|
2012-06-17 09:40:40 +00:00
|
|
|
double _average_frame_time;
|
2012-05-08 12:07:15 +00:00
|
|
|
int _quality;
|
2012-01-27 16:01:34 +00:00
|
|
|
|
2012-05-08 12:07:15 +00:00
|
|
|
int _last_mouse_x;
|
|
|
|
int _last_mouse_y;
|
2012-01-27 14:47:08 +00:00
|
|
|
};
|
|
|
|
|
2013-11-05 10:45:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // WIDGETEXPLORER_H
|