Removing flame class and integrate it into light class because it was unpractical.

This commit is contained in:
Faerbit 2015-02-24 12:56:40 +01:00
parent b3b215e628
commit 97a315661f
7 changed files with 15 additions and 46 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -227,10 +227,6 @@ void Level::addTrigger(Trigger trigger) {
this->triggers.push_back(trigger); this->triggers.push_back(trigger);
} }
void Level::addFlame(Flame flame){
this->flames.push_back(flame);
}
lua_State* Level::getLuaState() { lua_State* Level::getLuaState() {
return luaState; return luaState;
} }

View File

@ -10,7 +10,6 @@
#include "camera.hh" #include "camera.hh"
#include "physics.hh" #include "physics.hh"
#include "trigger.hh" #include "trigger.hh"
#include "flame.hh"
extern "C" { extern "C" {
#include "extern/lua/src/lua.h" #include "extern/lua/src/lua.h"
@ -45,7 +44,6 @@ class Level {
void setSkydomeObject(Object* object); void setSkydomeObject(Object* object);
void addObject(Object* object); void addObject(Object* object);
void addPhysicsObject(Object* object); void addPhysicsObject(Object* object);
void addFlame(Flame flame);
void setAmbientLight(glm::vec3 colour); void setAmbientLight(glm::vec3 colour);
void setFogColour(glm::vec4 colour); void setFogColour(glm::vec4 colour);
void setDirectionalLight(Light light); void setDirectionalLight(Light light);
@ -64,7 +62,6 @@ class Level {
std::vector<Object*> physicsObjects; std::vector<Object*> physicsObjects;
std::vector<Light> lights; std::vector<Light> lights;
std::vector<Trigger> triggers; std::vector<Trigger> triggers;
std::vector<Flame> flames;
glm::vec3 ambientLight; glm::vec3 ambientLight;
glm::vec4 fogColour; glm::vec4 fogColour;
Light directionalLight; Light directionalLight;

View File

@ -1,9 +1,10 @@
#include "light.hh" #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)) { : Entity(position, glm::vec3(0.0f, 0.0f, 0.0f)) {
this->colour = colour; this->colour = colour;
this->intensity = intensity; this->intensity = intensity;
this->flameOffset = flameOffset;
} }
Light::Light() { Light::Light() {
@ -19,3 +20,7 @@ glm::vec3 Light::getColour() {
float Light::getIntensity() { float Light::getIntensity() {
return intensity; return intensity;
} }
float Light::getFlameOffset() {
return flameOffset;
}

View File

@ -6,12 +6,14 @@
class Light : public Entity { class Light : public Entity {
public: public:
Light(glm::vec3 position, glm::vec3 colour, float intensity); Light(glm::vec3 position, glm::vec3 colour, float intensity, float flameOffset = 0.0f);
Light(); Light();
glm::vec3 getColour(); glm::vec3 getColour();
float getIntensity(); float getIntensity();
float getFlameOffset();
~Light(); ~Light();
private: private:
float flameOffset;
float intensity; float intensity;
glm::vec3 colour; glm::vec3 colour;
}; };

View File

@ -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::rotate(compRot.z, glm::vec3(0.0f, 0.0f, 1.0f))
* glm::vec4(lightOffset, 0); * glm::vec4(lightOffset, 0);
glm::vec3 lightPosition = compPos + glm::vec3(rotatedLightOffset.x,rotatedLightOffset.y,rotatedLightOffset.z); glm::vec3 lightPosition = compPos + glm::vec3(rotatedLightOffset.x,rotatedLightOffset.y,rotatedLightOffset.z);
Light light = Light(lightPosition, lightColour, lightIntensity);
level->addLight(light);
XMLElement* flameOffset = NULL; XMLElement* flameOffset = NULL;
flameOffset = xmlLight->FirstChildElement("flameOffset"); flameOffset = xmlLight->FirstChildElement("flameOffset");
if (flameOffset != NULL){ if (flameOffset != NULL){
float offset = 0; float offset = 0;
errorCheck(flameOffset->QueryFloatText(&offset)); errorCheck(flameOffset->QueryFloatText(&offset));
Flame flame = Flame(offset, lightPosition, glm::vec3(0,0,0)); Light light = Light(lightPosition, lightColour, lightIntensity, offset);
level->addFlame(flame); level->addLight(light);
}
else {
Light light = Light(lightPosition, lightColour, lightIntensity);
level->addLight(light);
} }
}//iterating over all lights of the composition }//iterating over all lights of the composition
}//corect composition found }//corect composition found