2013-12-23 13:09:52 +00:00
|
|
|
#ifndef OPENGLTERRAIN_H
|
|
|
|
#define OPENGLTERRAIN_H
|
|
|
|
|
|
|
|
#include "opengl_global.h"
|
|
|
|
|
|
|
|
#include "OpenGLPart.h"
|
2015-08-17 20:55:30 +00:00
|
|
|
#include "DefinitionWatcher.h"
|
2013-12-23 13:09:52 +00:00
|
|
|
|
|
|
|
#include <QVector>
|
|
|
|
#include <QList>
|
|
|
|
#include <QMutex>
|
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace opengl {
|
|
|
|
|
2015-08-17 20:55:30 +00:00
|
|
|
class OPENGLSHARED_EXPORT OpenGLTerrain: public OpenGLPart, public DefinitionWatcher
|
2013-12-23 13:09:52 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
OpenGLTerrain(OpenGLRenderer* renderer);
|
|
|
|
virtual ~OpenGLTerrain();
|
|
|
|
|
|
|
|
virtual void initialize() override;
|
|
|
|
virtual void update() override;
|
|
|
|
virtual void render() override;
|
2013-12-30 15:02:33 +00:00
|
|
|
virtual void interrupt() override;
|
2013-12-23 13:09:52 +00:00
|
|
|
|
2015-08-18 17:12:54 +00:00
|
|
|
void pause();
|
|
|
|
void resume();
|
|
|
|
inline bool isPaused() const { return paused; }
|
|
|
|
|
2015-07-26 16:30:30 +00:00
|
|
|
/**
|
|
|
|
* Reset the color textures, without changing the tessellation.
|
|
|
|
*/
|
|
|
|
void resetTextures();
|
|
|
|
|
2013-12-23 13:09:52 +00:00
|
|
|
void performChunksMaintenance();
|
|
|
|
|
2015-08-17 20:55:30 +00:00
|
|
|
virtual void nodeChanged(const DefinitionNode *node, const DefinitionDiff *diff) override;
|
2013-12-23 13:09:52 +00:00
|
|
|
private:
|
|
|
|
OpenGLShaderProgram* program;
|
|
|
|
|
|
|
|
ParallelPool* work;
|
2015-08-18 17:12:54 +00:00
|
|
|
bool paused;
|
2013-12-23 13:09:52 +00:00
|
|
|
|
|
|
|
QVector<ExplorerChunkTerrain*> _chunks;
|
|
|
|
QList<ExplorerChunkTerrain*> _updateQueue;
|
|
|
|
QMutex _lock_chunks;
|
2015-08-17 20:55:30 +00:00
|
|
|
|
2013-12-23 13:09:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // OPENGLTERRAIN_H
|