Added flameHeight and flameWidth with loading from xml.

This commit is contained in:
Steffen Fündgens 2015-03-04 15:22:07 +01:00
parent 5cd13899d6
commit c4f106bf86
4 changed files with 11 additions and 3 deletions

View File

@ -76,6 +76,8 @@
<bColour>0.3</bColour>
<intensity>4.0</intensity>
<flameOffset>-1.5</flameOffset>
<flameHeight>3.0</flameHeight>
<flameWidth>0.8</flameWidth>
</light>
</composition>

View File

@ -1,10 +1,12 @@
#include "light.hh"
Light::Light(glm::vec3 position, glm::vec3 colour, float intensity, float flameYOffset)
Light::Light(glm::vec3 position, glm::vec3 colour, float intensity, float flameYOffset, float flameHeight, float flameWidth)
: Entity(position, glm::vec3(0.0f, 0.0f, 0.0f)) {
this->colour = colour;
this->intensity = intensity;
this->flameYOffset = flameYOffset;
this->flameHeight = flameHeight;
this->flameWidth = flameWidth;
}
Light::Light() {

View File

@ -6,7 +6,7 @@
class Light : public Entity {
public:
Light(glm::vec3 position, glm::vec3 colour, float intensity, float flameYOffset = 0.0f);
Light(glm::vec3 position, glm::vec3 colour, float intensity, float flameYOffset = 0.0f, float flameHeight = 0.0f, float flameWidth = 0.0f);
Light();
glm::vec3 getColour();
float getIntensity();
@ -14,6 +14,8 @@ class Light : public Entity {
~Light();
private:
float flameYOffset;
float flameHeight;
float flameWidth;
float intensity;
glm::vec3 colour;
};

View File

@ -299,7 +299,9 @@ void Loader::load(std::string filePath, Level* level, std::string compositionsPa
if (flameOffset != NULL){
float offset = 0;
errorCheck(flameOffset->QueryFloatText(&offset));
Light light = Light(lightPosition, lightColour, lightIntensity, offset);
float flameHeight = queryBool(xmlLight, "flameHeight");
float flameWidth = queryBool(xmlLight, "flameWidth");
Light light = Light(lightPosition, lightColour, lightIntensity, offset, flameHeight, flameWidth);
level->addLight(light);
}
else {