From 3dedab035c98772fd9607480bddc8ffd9d7dc799 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 2 May 2008 13:05:03 +0000 Subject: additional light properties --- src/core/model.cc | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/core/model.cc') diff --git a/src/core/model.cc b/src/core/model.cc index e956612..c38749b 100644 --- a/src/core/model.cc +++ b/src/core/model.cc @@ -184,6 +184,7 @@ Light::Light(math::Vector3f const & location, math::Color const & color, bool st light_radius = 1.0f; light_frequency = 1.0f; light_offset = 0.0f; + light_time = 0.5f; } Light::~Light() @@ -251,6 +252,7 @@ Model::Model(std::string const & name) : float class_light = 100; float class_frequency = 1.0f; float class_offset = 0; + float class_time = 0.0f; bool brush_detail = false; while (ifs) { @@ -272,6 +274,7 @@ Model::Model(std::string const & name) : class_light = 100; class_offset = 0; class_frequency = 1.0f; + class_time = 0.0f; brush_detail = false; } level ++; @@ -302,7 +305,10 @@ Model::Model(std::string const & name) : Light *light = new Light(class_origin * model_scale, class_color, (class_spawnflags & 1) == 1); light->light_radius = class_light / 100.0f; light->light_offset = class_offset; - light->light_frequency = class_frequency; + if (class_frequency > 0 ) + light->light_frequency = class_frequency; + if (class_time > 0 ) + light->light_time = class_time; add_light(light); } @@ -399,6 +405,15 @@ Model::Model(std::string const & name) : tmp += c; std::istringstream is(tmp); is >> class_offset; + + } else if (firstword == "\"time\"") { + std::string tmp; + char c; + while ((linestream.get(c)) && (c != '"')); + while ((linestream.get(c)) && (c != '"')) + tmp += c; + std::istringstream is(tmp); + is >> class_time; } else if (firstword == "(") { if ((level == 2) && (class_name == "worldspawn")) { @@ -408,6 +423,7 @@ Model::Model(std::string const & name) : Vector3f p3; std::string tmp; std::string texture; + int n; linestream >> p1; linestream >> tmp; // ) @@ -423,9 +439,10 @@ Model::Model(std::string const & name) : for (int i=0; i < 5; i++) linestream >> tmp; - if (linestream >> tmp) - brush_detail = true; - + if (linestream >> n) { + if (n > 0) + brush_detail = true; + } //cout << data << std::endl; //cout << "(" << p1 << ") (" << p2 << ") (" << p3 << ") " << texture << std::endl; -- cgit v1.2.3