From 16ba763ddc372977a53b9b0a4854c0ae42e988d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20F=C3=BCndgens?= Date: Wed, 4 Mar 2015 15:22:07 +0100 Subject: [PATCH] Added flameHeight and flameWidth with loading from xml. --- data/levels/Compositions.xml | 2 ++ light.cc | 4 +++- light.hh | 4 +++- loader.cc | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/data/levels/Compositions.xml b/data/levels/Compositions.xml index 744df8e..4e66431 100644 --- a/data/levels/Compositions.xml +++ b/data/levels/Compositions.xml @@ -76,6 +76,8 @@ 0.3 4.0 -1.5 + 3.0 + 0.8 diff --git a/light.cc b/light.cc index fa8dfde..e523ba5 100644 --- a/light.cc +++ b/light.cc @@ -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() { diff --git a/light.hh b/light.hh index 2112487..0ad997c 100644 --- a/light.hh +++ b/light.hh @@ -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; }; diff --git a/loader.cc b/loader.cc index 5c93b29..d70b40f 100644 --- a/loader.cc +++ b/loader.cc @@ -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 {