Merge branch 'master' into vegetation

This commit is contained in:
Michaël Lemaire 2015-11-24 00:59:28 +01:00
commit 9e3c43f510
7 changed files with 21 additions and 1 deletions

View file

@ -7,6 +7,7 @@
AtmosphereDefinition::AtmosphereDefinition(DefinitionNode *parent) AtmosphereDefinition::AtmosphereDefinition(DefinitionNode *parent)
: DefinitionNode(parent, "atmosphere", "atmosphere") { : DefinitionNode(parent, "atmosphere", "atmosphere") {
model = ATMOSPHERE_MODEL_DISABLED;
godrays = new GodRaysDefinition(this); godrays = new GodRaysDefinition(this);
daytime = new FloatNode(this, "daytime"); daytime = new FloatNode(this, "daytime");
humidity = new FloatNode(this, "humidity"); humidity = new FloatNode(this, "humidity");

View file

@ -3,6 +3,13 @@
OpenGLSharedState::OpenGLSharedState() { OpenGLSharedState::OpenGLSharedState() {
} }
paysages::opengl::OpenGLSharedState::~OpenGLSharedState()
{
for (const auto &pair : variables) {
delete pair.second;
}
}
void OpenGLSharedState::apply(OpenGLShaderProgram *program, int &texture_unit) { void OpenGLSharedState::apply(OpenGLShaderProgram *program, int &texture_unit) {
for (const auto &pair : variables) { for (const auto &pair : variables) {
pair.second->apply(program, texture_unit); pair.second->apply(program, texture_unit);
@ -11,7 +18,7 @@ void OpenGLSharedState::apply(OpenGLShaderProgram *program, int &texture_unit) {
OpenGLVariable *OpenGLSharedState::get(const std::string &name) { OpenGLVariable *OpenGLSharedState::get(const std::string &name) {
OpenGLVariable *&var = variables[name]; OpenGLVariable *&var = variables[name];
if (var == 0) { if (var == NULL) {
var = new OpenGLVariable(name); var = new OpenGLVariable(name);
} }
return var; return var;

View file

@ -15,6 +15,7 @@ namespace opengl {
class OPENGLSHARED_EXPORT OpenGLSharedState { class OPENGLSHARED_EXPORT OpenGLSharedState {
public: public:
OpenGLSharedState(); OpenGLSharedState();
~OpenGLSharedState();
/*! /*!
* \brief Apply the stored variables to the bound program. * \brief Apply the stored variables to the bound program.

View file

@ -3,6 +3,9 @@
Thread::Thread(ThreadFunction function) : data(0), result(0), function(function) { Thread::Thread(ThreadFunction function) : data(0), result(0), function(function) {
} }
Thread::~Thread() {
}
void Thread::start(void *data) { void Thread::start(void *data) {
this->data = data; this->data = data;
QThread::start(); QThread::start();

View file

@ -24,6 +24,8 @@ class SYSTEMSHARED_EXPORT Thread : private QThread {
*/ */
Thread(ThreadFunction function = 0); Thread(ThreadFunction function = 0);
virtual ~Thread();
/** /**
* Start the thread, with custom data. * Start the thread, with custom data.
*/ */

View file

@ -60,6 +60,7 @@ TEST(GodRaysSampler, setQuality) {
class GodRayLightSource : public LightSource { class GodRayLightSource : public LightSource {
virtual bool getLightsAt(std::vector<LightComponent> &result, const Vector3 &location) const override { virtual bool getLightsAt(std::vector<LightComponent> &result, const Vector3 &location) const override {
LightComponent light; LightComponent light;
light.direction = VECTOR_DOWN;
light.altered = true; light.altered = true;
light.color = Color(fabs(location.x), fabs(location.y), fabs(location.z)); light.color = Color(fabs(location.x), fabs(location.y), fabs(location.z));
result.push_back(light); result.push_back(light);

View file

@ -4,6 +4,7 @@
#include "PackStream.h" #include "PackStream.h"
#include "DiffManager.h" #include "DiffManager.h"
#include "IntNode.h" #include "IntNode.h"
#include "DefinitionDiff.h"
static DefinitionNode *_construc1(Layers *, const std::string &name) { static DefinitionNode *_construc1(Layers *, const std::string &name) {
return new DefinitionNode(NULL, name); return new DefinitionNode(NULL, name);
@ -193,4 +194,8 @@ TEST(Layers, generateInitDiffs) {
EXPECT_EQ("l1", layers1.getLayer(0)->getName()); EXPECT_EQ("l1", layers1.getLayer(0)->getName());
EXPECT_EQ("l2", layers1.getLayer(1)->getName()); EXPECT_EQ("l2", layers1.getLayer(1)->getName());
EXPECT_EQ("l3", layers1.getLayer(2)->getName()); EXPECT_EQ("l3", layers1.getLayer(2)->getName());
for (auto diff : diffs) {
delete diff;
}
} }