From 42657f96079dc8817c8539fb200cc8ce69782b33 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 13 Jul 2016 21:33:38 -0600 Subject: [PATCH] light: record setting names --- include/light/light.hh | 26 +++++++++++++++++++------- light/entities.cc | 28 +++++++++++++++------------- light/light.cc | 22 ++++++++++++---------- 3 files changed, 46 insertions(+), 30 deletions(-) diff --git a/include/light/light.hh b/include/light/light.hh index 6234e441..cf7b6330 100644 --- a/include/light/light.hh +++ b/include/light/light.hh @@ -29,6 +29,9 @@ #include +#include +#include + #define ON_EPSILON 0.1 #define ANGLE_EPSILON 0.001 @@ -232,26 +235,35 @@ extern bool dump_face; /* command-line options */ class lockable_vec_t { +private: + std::vector _names; public: vec_t value; bool locked; - lockable_vec_t(vec_t v, bool l = false) : value(v), locked(l) {} - lockable_vec_t() : lockable_vec_t(0.0f, false) {} + lockable_vec_t(std::vector names, vec_t v, bool l = false) + : _names(names), value(v), locked(l) {} + + lockable_vec_t(std::string name, vec_t v, bool l = false) + : lockable_vec_t(std::vector { name }, v, l) {} }; class lockable_vec3_t { +private: + std::vector _names; + public: vec3_t value; bool locked; - lockable_vec3_t(const vec3_t v, bool l = false) : locked(l) { - VectorCopy(v, value); - } - lockable_vec3_t(vec_t a, vec_t b, vec_t c, bool l = false) : locked(l) { + lockable_vec3_t(std::vector names, vec_t a, vec_t b, vec_t c, bool l = false) + : _names(names), locked(l) + { VectorSet(value, a, b, c); } - lockable_vec3_t() : lockable_vec3_t(0.0f, 0.0f, 0.0f, false) {} + + lockable_vec3_t(std::string name, vec_t a, vec_t b, vec_t c, bool l = false) + : lockable_vec3_t(std::vector { name }, a,b,c,l) {} }; /* dirt */ diff --git a/light/entities.cc b/light/entities.cc index 1c5acc9d..8dfbc5e6 100644 --- a/light/entities.cc +++ b/light/entities.cc @@ -37,20 +37,22 @@ entity_t *surfacelight_templates[MAX_SURFLIGHT_TEMPLATES]; int num_surfacelight_templates; static void MakeSurfaceLights(const bsp2_t *bsp); +using strings = std::vector; + /* temporary storage for sunlight settings before the sun_t objects are created. */ -lockable_vec_t sunlight { 0.0f }; /* main sun */ -lockable_vec3_t sunlight_color { 255.0f, 255.0f, 255.0f }; -lockable_vec_t sun2 { 0.0f }; /* second sun */ -lockable_vec3_t sun2_color { 255.0f, 255.0f, 255.0f }; -lockable_vec_t sunlight2 { 0.0f }; /* top sky dome */ -lockable_vec3_t sunlight2_color { 255.0f, 255.0f, 255.0f }; -lockable_vec_t sunlight3 { 0.0f }; /* bottom sky dome */ -lockable_vec3_t sunlight3_color { 255.0f, 255.0f, 255.0f }; -lockable_vec_t sunlight_dirt { 0.0f }; -lockable_vec_t sunlight2_dirt { 0.0f }; -lockable_vec3_t sunvec { 0.0f, 0.0f, -1.0f }; /* defaults to straight down */ -lockable_vec3_t sun2vec { 0.0f, 0.0f, -1.0f }; /* defaults to straight down */ -lockable_vec_t sun_deviance { 0.0f }; +lockable_vec_t sunlight { "sunlight", 0.0f }; /* main sun */ +lockable_vec3_t sunlight_color { "sunlight_color", 255.0f, 255.0f, 255.0f }; +lockable_vec_t sun2 { "sun2", 0.0f }; /* second sun */ +lockable_vec3_t sun2_color { "sun2_color", 255.0f, 255.0f, 255.0f }; +lockable_vec_t sunlight2 { "sunlight2", 0.0f }; /* top sky dome */ +lockable_vec3_t sunlight2_color { strings{"sunlight2_color", "sunlight_color2"}, 255.0f, 255.0f, 255.0f }; +lockable_vec_t sunlight3 { "sunlight3", 0.0f }; /* bottom sky dome */ +lockable_vec3_t sunlight3_color { strings{"sunlight3_color", "sunlight_color3"}, 255.0f, 255.0f, 255.0f }; +lockable_vec_t sunlight_dirt { "sunlight_dirt", 0.0f }; +lockable_vec_t sunlight2_dirt { "sunlight2_dirt", 0.0f }; +lockable_vec3_t sunvec { strings{"sunlight_mangle", "sun_mangle"}, 0.0f, 0.0f, -1.0f }; /* defaults to straight down */ +lockable_vec3_t sun2vec { "sun2_mangle", 0.0f, 0.0f, -1.0f }; /* defaults to straight down */ +lockable_vec_t sun_deviance { "sunlight_penumbra", 0.0f }; // entity_t diff --git a/light/light.cc b/light/light.cc index 16adfef1..8036675f 100644 --- a/light/light.cc +++ b/light/light.cc @@ -56,24 +56,26 @@ qboolean addminlight = false; lightsample_t minlight = { 0, { 255, 255, 255 } }; sun_t *suns = NULL; +using strings = std::vector; + /* dirt */ -lockable_vec_t dirty {0.0f}; -lockable_vec_t dirtMode {0.0f}; -lockable_vec_t dirtDepth {128.0f}; -lockable_vec_t dirtScale {1.0f}; -lockable_vec_t dirtGain {1.0f}; -lockable_vec_t dirtAngle {88.0f}; +lockable_vec_t dirty {strings{"dirt", "dirty"}, 0.0f}; +lockable_vec_t dirtMode {"dirtmode", 0.0f}; +lockable_vec_t dirtDepth {"dirtdepth", 128.0f}; +lockable_vec_t dirtScale {"dirtscale", 1.0f}; +lockable_vec_t dirtGain {"dirtgain", 1.0f}; +lockable_vec_t dirtAngle {"dirtangle", 88.0f}; qboolean globalDirt = false; qboolean minlightDirt = false; /* phong */ -lockable_vec_t phongallowed {1.0f}; +lockable_vec_t phongallowed {"phong", 1.0f}; /* bounce */ -lockable_vec_t bounce {0.0f}; -lockable_vec_t bouncescale {1.0f}; -lockable_vec_t bouncecolorscale {0.0f}; +lockable_vec_t bounce {"bounce", 0.0f}; +lockable_vec_t bouncescale {"bouncescale", 1.0f}; +lockable_vec_t bouncecolorscale {"bouncecolorscale", 0.0f}; qboolean surflight_dump = false;