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)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
OpenGLPart::~OpenGLPart()
|
|
|
|
{
|
|
|
|
QMapIterator<QString, OpenGLShaderProgram*> i(shaders);
|
|
|
|
while (i.hasNext())
|
|
|
|
{
|
|
|
|
i.next();
|
|
|
|
delete i.value();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-30 15:02:33 +00:00
|
|
|
void OpenGLPart::interrupt()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-12-21 22:48:54 +00:00
|
|
|
OpenGLShaderProgram* OpenGLPart::createShader(QString name)
|
|
|
|
{
|
2015-09-14 17:25:54 +00:00
|
|
|
OpenGLShaderProgram* program = new OpenGLShaderProgram(name.toStdString(), renderer);
|
2013-12-21 22:48:54 +00:00
|
|
|
|
|
|
|
if (!shaders.contains(name))
|
|
|
|
{
|
|
|
|
shaders[name] = program;
|
|
|
|
return program;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OpenGLPart::updateScenery(bool onlyCommon)
|
|
|
|
{
|
|
|
|
// Let subclass do its own collecting
|
|
|
|
if (not onlyCommon)
|
|
|
|
{
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
}
|