paysages3d/src/render/opengl/OpenGLPart.cpp

50 lines
917 B
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)
{
}
OpenGLPart::~OpenGLPart()
{
QMapIterator<QString, OpenGLShaderProgram*> i(shaders);
while (i.hasNext())
{
i.next();
delete i.value();
}
}
OpenGLShaderProgram* OpenGLPart::createShader(QString name)
{
OpenGLShaderProgram* program = new OpenGLShaderProgram(name, 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();
}
}