From a22542f273de28d06ecaf2bd6fd741821e98512b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 1 May 2008 16:59:54 +0000 Subject: lights offset and frequency --- src/core/model.cc | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'src/core/model.cc') diff --git a/src/core/model.cc b/src/core/model.cc index a09c7fd..e956612 100644 --- a/src/core/model.cc +++ b/src/core/model.cc @@ -181,6 +181,9 @@ Light::Light(math::Vector3f const & location, math::Color const & color, bool st light_color(color) { light_strobe = strobe; + light_radius = 1.0f; + light_frequency = 1.0f; + light_offset = 0.0f; } Light::~Light() @@ -245,6 +248,9 @@ Model::Model(std::string const & name) : float class_angle = 0; math::Color class_color; unsigned int class_spawnflags = 0; + float class_light = 100; + float class_frequency = 1.0f; + float class_offset = 0; bool brush_detail = false; while (ifs) { @@ -263,6 +269,9 @@ Model::Model(std::string const & name) : class_origin = math::Vector3f(0,0,0); class_color = math::Color(1, 1, 1); class_spawnflags = 0; + class_light = 100; + class_offset = 0; + class_frequency = 1.0f; brush_detail = false; } level ++; @@ -290,7 +299,11 @@ Model::Model(std::string const & name) : //con_debug << " engine at " << class_origin << "\n"; add_engine(new Engine(class_origin * model_scale)); } else if ((level == 1) && (class_name == "light")) { - add_light(new Light(class_origin * model_scale, class_color, (class_spawnflags & 1) == 1)); + 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; + add_light(light); } if (level == 1) { @@ -360,6 +373,33 @@ Model::Model(std::string const & name) : is >> class_spawnflags; //con_debug << " spawnflags '" << class_spawnflags << "'" << std::endl; + } else if (firstword == "\"light\"") { + std::string tmp; + char c; + while ((linestream.get(c)) && (c != '"')); + while ((linestream.get(c)) && (c != '"')) + tmp += c; + std::istringstream is(tmp); + is >> class_light; + + } else if (firstword == "\"frequency\"") { + std::string tmp; + char c; + while ((linestream.get(c)) && (c != '"')); + while ((linestream.get(c)) && (c != '"')) + tmp += c; + std::istringstream is(tmp); + is >> class_frequency; + + } else if (firstword == "\"offset\"") { + std::string tmp; + char c; + while ((linestream.get(c)) && (c != '"')); + while ((linestream.get(c)) && (c != '"')) + tmp += c; + std::istringstream is(tmp); + is >> class_offset; + } else if (firstword == "(") { if ((level == 2) && (class_name == "worldspawn")) { //cout << " BRUSH PLANE" << std::endl; -- cgit v1.2.3