paysages3d/src/render/opengl/OpenGLRenderer.h

75 lines
1.7 KiB
C
Raw Normal View History

#ifndef OPENGLRENDERER_H
#define OPENGLRENDERER_H
#include "opengl_global.h"
2013-11-14 20:46:47 +00:00
#include "SoftwareRenderer.h"
namespace paysages {
namespace opengl {
/*!
* \brief Scenery renderer in an OpenGL context.
*/
2013-12-15 14:06:43 +00:00
class OPENGLSHARED_EXPORT OpenGLRenderer: public SoftwareRenderer
{
public:
2015-08-18 20:29:18 +00:00
OpenGLRenderer(Scenery* scenery);
2013-11-14 20:46:47 +00:00
virtual ~OpenGLRenderer();
2014-08-28 13:09:47 +00:00
inline OpenGLSkybox *getSkybox() const {return skybox;}
inline OpenGLWater *getWater() const {return water;}
inline OpenGLTerrain *getTerrain() const {return terrain;}
void initialize();
2014-08-27 16:19:48 +00:00
void prepareOpenGLState();
void resize(int width, int height);
void paint();
2013-12-15 14:06:43 +00:00
/**
* Reset the whole state (when the scenery has been massively updated).
*/
void reset();
/**
* Pause the rendering process.
*
* This will prevent paintings and stop background tasks, until resume() is called.
*/
void pause();
/**
* Resume the rendering process, put on hold by pause().
*/
void resume();
/**
* Change the camera location.
*/
void setCamera(CameraDefinition *camera);
2013-12-21 22:48:54 +00:00
void cameraChangeEvent(CameraDefinition* camera);
2013-12-23 09:26:29 +00:00
inline OpenGLFunctions* getOpenGlFunctions() const {return functions;}
inline OpenGLSharedState* getSharedState() const {return shared_state;}
2013-12-21 22:48:54 +00:00
virtual double getPrecision(const Vector3 &location) override;
2013-12-15 14:06:43 +00:00
virtual Color applyMediumTraversal(Vector3 location, Color color) override;
2013-12-21 22:48:54 +00:00
private:
2013-12-23 09:26:29 +00:00
bool ready;
bool paused;
2014-08-27 16:19:48 +00:00
int vp_width;
int vp_height;
2013-12-23 09:26:29 +00:00
OpenGLFunctions* functions;
OpenGLSharedState* shared_state;
2013-12-21 22:48:54 +00:00
OpenGLSkybox* skybox;
2013-12-21 23:41:19 +00:00
OpenGLWater* water;
OpenGLTerrain* terrain;
};
}
}
#endif // OPENGLRENDERER_H