2012-01-27 14:47:08 +00:00
|
|
|
#ifndef _PAYSAGES_QT_WIDGETWANDERER_H_
|
|
|
|
#define _PAYSAGES_QT_WIDGETWANDERER_H_
|
|
|
|
|
|
|
|
#include <QGLWidget>
|
2012-06-08 12:28:46 +00:00
|
|
|
#include "baseexplorerchunk.h"
|
2012-01-27 14:47:08 +00:00
|
|
|
#include "../lib_paysages/camera.h"
|
|
|
|
#include "../lib_paysages/water.h"
|
2012-05-08 12:07:15 +00:00
|
|
|
#include "../lib_paysages/renderer.h"
|
2012-05-08 14:07:47 +00:00
|
|
|
#include "../lib_paysages/sky.h"
|
2012-05-09 11:39:03 +00:00
|
|
|
#include "../lib_paysages/terrain.h"
|
|
|
|
#include "../lib_paysages/textures.h"
|
|
|
|
#include "../lib_paysages/lighting.h"
|
2012-01-27 14:47:08 +00:00
|
|
|
|
|
|
|
class WidgetWanderer : public QGLWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
WidgetWanderer(QWidget* parent, CameraDefinition* camera);
|
2012-05-08 12:07:15 +00:00
|
|
|
~WidgetWanderer();
|
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-05-08 14:07:47 +00:00
|
|
|
|
2012-01-27 14:47:08 +00:00
|
|
|
private:
|
2012-05-08 14:07:47 +00:00
|
|
|
void startThreads();
|
|
|
|
void stopThreads();
|
|
|
|
|
2012-01-27 23:01:21 +00:00
|
|
|
CameraDefinition _current_camera;
|
|
|
|
CameraDefinition* _base_camera;
|
2012-05-08 12:07:15 +00:00
|
|
|
|
|
|
|
Renderer _renderer;
|
2012-05-08 14:07:47 +00:00
|
|
|
bool _updated;
|
2012-05-08 12:07:15 +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-05-08 12:07:15 +00:00
|
|
|
WaterDefinition _water;
|
2012-05-08 14:07:47 +00:00
|
|
|
SkyDefinition _sky;
|
2012-05-09 11:39:03 +00:00
|
|
|
TerrainDefinition _terrain;
|
|
|
|
TexturesDefinition _textures;
|
|
|
|
LightingDefinition _lighting;
|
2012-01-30 13:10:16 +00:00
|
|
|
|
2012-05-08 12:07:15 +00:00
|
|
|
double _average_frame_time;
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|