From 97a315661fded4fb31007e0f2d0239119fd767df Mon Sep 17 00:00:00 2001 From: Faerbit Date: Tue, 24 Feb 2015 12:56:40 +0100 Subject: [PATCH] Removing flame class and integrate it into light class because it was unpractical. --- flame.cc | 16 ---------------- flame.hh | 17 ----------------- level.cc | 4 ---- level.hh | 3 --- light.cc | 7 ++++++- light.hh | 4 +++- loader.cc | 10 ++++++---- 7 files changed, 15 insertions(+), 46 deletions(-) delete mode 100644 flame.cc delete mode 100644 flame.hh diff --git a/flame.cc b/flame.cc deleted file mode 100644 index a519497..0000000 --- a/flame.cc +++ /dev/null @@ -1,16 +0,0 @@ -#include "flame.hh" - -Flame::Flame(float offset, glm::vec3 position, glm::vec3 rotation) : - Entity(position, rotation) { - this->offset = offset; -} - -Flame::Flame() { -} - -Flame::~Flame() { -} - -float Flame::getOffset(){ - return offset; -} diff --git a/flame.hh b/flame.hh deleted file mode 100644 index 2103082..0000000 --- a/flame.hh +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef FLAME_HH_INCLUDED -#define FLAME_HH_INCLUDED - -#include "entity.hh" - - -class Flame : public Entity { - public: - Flame(float offset, glm::vec3 position, glm::vec3 rotation); - Flame(); - ~Flame(); - float getOffset(); - private: - float offset; -}; - -#endif diff --git a/level.cc b/level.cc index ebb9ece..fef60ca 100644 --- a/level.cc +++ b/level.cc @@ -227,10 +227,6 @@ void Level::addTrigger(Trigger trigger) { this->triggers.push_back(trigger); } -void Level::addFlame(Flame flame){ - this->flames.push_back(flame); -} - lua_State* Level::getLuaState() { return luaState; } diff --git a/level.hh b/level.hh index e046d65..93d11fa 100644 --- a/level.hh +++ b/level.hh @@ -10,7 +10,6 @@ #include "camera.hh" #include "physics.hh" #include "trigger.hh" -#include "flame.hh" extern "C" { #include "extern/lua/src/lua.h" @@ -45,7 +44,6 @@ class Level { void setSkydomeObject(Object* object); void addObject(Object* object); void addPhysicsObject(Object* object); - void addFlame(Flame flame); void setAmbientLight(glm::vec3 colour); void setFogColour(glm::vec4 colour); void setDirectionalLight(Light light); @@ -64,7 +62,6 @@ class Level { std::vector physicsObjects; std::vector lights; std::vector triggers; - std::vector flames; glm::vec3 ambientLight; glm::vec4 fogColour; Light directionalLight; diff --git a/light.cc b/light.cc index c93572b..bdbd402 100644 --- a/light.cc +++ b/light.cc @@ -1,9 +1,10 @@ #include "light.hh" -Light::Light(glm::vec3 position, glm::vec3 colour, float intensity) +Light::Light(glm::vec3 position, glm::vec3 colour, float intensity, float flameOffset) : Entity(position, glm::vec3(0.0f, 0.0f, 0.0f)) { this->colour = colour; this->intensity = intensity; + this->flameOffset = flameOffset; } Light::Light() { @@ -19,3 +20,7 @@ glm::vec3 Light::getColour() { float Light::getIntensity() { return intensity; } + +float Light::getFlameOffset() { + return flameOffset; +} diff --git a/light.hh b/light.hh index 46bb546..b84d549 100644 --- a/light.hh +++ b/light.hh @@ -6,12 +6,14 @@ class Light : public Entity { public: - Light(glm::vec3 position, glm::vec3 colour, float intensity); + Light(glm::vec3 position, glm::vec3 colour, float intensity, float flameOffset = 0.0f); Light(); glm::vec3 getColour(); float getIntensity(); + float getFlameOffset(); ~Light(); private: + float flameOffset; float intensity; glm::vec3 colour; }; diff --git a/loader.cc b/loader.cc index cbe3bc8..5f23fe4 100644 --- a/loader.cc +++ b/loader.cc @@ -268,15 +268,17 @@ void Loader::load(std::string filePath, Level* level, std::string compositionsPa * glm::rotate(compRot.z, glm::vec3(0.0f, 0.0f, 1.0f)) * glm::vec4(lightOffset, 0); glm::vec3 lightPosition = compPos + glm::vec3(rotatedLightOffset.x,rotatedLightOffset.y,rotatedLightOffset.z); - Light light = Light(lightPosition, lightColour, lightIntensity); - level->addLight(light); XMLElement* flameOffset = NULL; flameOffset = xmlLight->FirstChildElement("flameOffset"); if (flameOffset != NULL){ float offset = 0; errorCheck(flameOffset->QueryFloatText(&offset)); - Flame flame = Flame(offset, lightPosition, glm::vec3(0,0,0)); - level->addFlame(flame); + Light light = Light(lightPosition, lightColour, lightIntensity, offset); + level->addLight(light); + } + else { + Light light = Light(lightPosition, lightColour, lightIntensity); + level->addLight(light); } }//iterating over all lights of the composition }//corect composition found