Removing flame class and integrate it into light class because it was unpractical.
This commit is contained in:
parent
b3b215e628
commit
97a315661f
16
flame.cc
16
flame.cc
@ -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;
|
||||
}
|
17
flame.hh
17
flame.hh
@ -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
|
4
level.cc
4
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;
|
||||
}
|
||||
|
3
level.hh
3
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<Object*> physicsObjects;
|
||||
std::vector<Light> lights;
|
||||
std::vector<Trigger> triggers;
|
||||
std::vector<Flame> flames;
|
||||
glm::vec3 ambientLight;
|
||||
glm::vec4 fogColour;
|
||||
Light directionalLight;
|
||||
|
7
light.cc
7
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;
|
||||
}
|
||||
|
4
light.hh
4
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;
|
||||
};
|
||||
|
10
loader.cc
10
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
|
||||
|
Loading…
Reference in New Issue
Block a user