paysages3d/src/render/opengl/OpenGLPart.cpp

53 lines
1.1 KiB
C++
Raw Normal View History

2013-12-21 22:48:54 +00:00
#include "OpenGLPart.h"
#include <QDir>
#include <cmath>
#include "OpenGLRenderer.h"
#include "OpenGLShaderProgram.h"
#include "CameraDefinition.h"
#include "AtmosphereDefinition.h"
#include "AtmosphereRenderer.h"
#include "Scenery.h"
OpenGLPart::OpenGLPart(OpenGLRenderer *renderer) : renderer(renderer) {
2013-12-21 22:48:54 +00:00
}
OpenGLPart::~OpenGLPart() {
QMapIterator<QString, OpenGLShaderProgram *> i(shaders);
while (i.hasNext()) {
2013-12-21 22:48:54 +00:00
i.next();
delete i.value();
}
}
void OpenGLPart::interrupt() {
}
OpenGLShaderProgram *OpenGLPart::createShader(QString name) {
OpenGLShaderProgram *program = new OpenGLShaderProgram(name.toStdString(), renderer);
2013-12-21 22:48:54 +00:00
if (!shaders.contains(name)) {
2013-12-21 22:48:54 +00:00
shaders[name] = program;
return program;
} else {
2013-12-21 22:48:54 +00:00
return 0;
}
}
void OpenGLPart::updateScenery(bool onlyCommon) {
2013-12-21 22:48:54 +00:00
// Let subclass do its own collecting
if (not onlyCommon) {
2013-12-21 22:48:54 +00:00
update();
}
}
Scenery *OpenGLPart::getScenery() const
{
return renderer->getScenery();
}
OpenGLFunctions *OpenGLPart::getOpenGlFunctions() const
{
return renderer->getOpenGlFunctions();
}