From 6da4ab87aeadecc88e30a4287f153f6ec231f5dc Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Wed, 27 Jul 2016 00:49:34 -0600 Subject: [PATCH] light: reorganize settings --- include/light/light.hh | 37 +++++++++++++++++++++++-------------- light/entities.cc | 15 --------------- light/light.cc | 41 ++++++++++++++++++++++++++++++++--------- 3 files changed, 55 insertions(+), 38 deletions(-) diff --git a/include/light/light.hh b/include/light/light.hh index b6dbb549..73ab8004 100644 --- a/include/light/light.hh +++ b/include/light/light.hh @@ -499,31 +499,21 @@ public: void SetGlobalSetting(std::string name, std::string value, bool cmdline); +// +// worldspawn keys / command-line settings +// + extern lockable_vec_t scaledist; extern lockable_vec_t rangescale; extern lockable_vec_t global_anglescale; -extern float fadegate; -extern int softsamples; extern lockable_vec_t lightmapgamma; -extern const vec3_t vec3_white; -extern float surflight_subdivide; -extern int sunsamples; extern lockable_bool_t addminlight; extern lockable_vec_t minlight; extern lockable_vec3_t minlight_color; -extern sun_t *suns; - -extern int dump_facenum; -extern bool dump_face; - -extern int dump_vertnum; -extern bool dump_vert; - /* dirt */ -extern bool dirt_in_use; // should any dirtmapping take place? set in SetupDirt extern lockable_bool_t globalDirt; // apply dirt to all lights (unless they override it) + sunlight + minlight? extern lockable_vec_t dirtMode; extern lockable_vec_t dirtDepth; @@ -559,6 +549,25 @@ extern lockable_vec3_t sunvec; extern lockable_vec3_t sun2vec; extern lockable_vec_t sun_deviance; +// other flags + +extern bool dirt_in_use; // should any dirtmapping take place? set in SetupDirt + +extern float fadegate; +extern int softsamples; +extern const vec3_t vec3_white; +extern float surflight_subdivide; +extern int sunsamples; + +extern sun_t *suns; + +extern int dump_facenum; +extern bool dump_face; + +extern int dump_vertnum; +extern bool dump_vert; + + // settings dictionary class settingsdict_t { diff --git a/light/entities.cc b/light/entities.cc index 8b9cf5e1..3d19a9f3 100644 --- a/light/entities.cc +++ b/light/entities.cc @@ -37,21 +37,6 @@ using strings = std::vector; std::vector entdicts; -/* temporary storage for sunlight settings before the sun_t objects are created. */ -lockable_vec_t sunlight { "sunlight", 0.0f }; /* main sun */ -lockable_vec3_t sunlight_color { "sunlight_color", 255.0f, 255.0f, 255.0f, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }; -lockable_vec_t sun2 { "sun2", 0.0f }; /* second sun */ -lockable_vec3_t sun2_color { "sun2_color", 255.0f, 255.0f, 255.0f, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }; -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, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }; -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, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }; -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, -90.0f, 0.0f, vec3_transformer_t::MANGLE_TO_VEC }; /* defaults to straight down */ -lockable_vec3_t sun2vec { "sun2_mangle", 0.0f, -90.0f, 0.0f, vec3_transformer_t::MANGLE_TO_VEC }; /* defaults to straight down */ -lockable_vec_t sun_deviance { "sunlight_penumbra", 0.0f, 0.0f, 180.0f }; - // light_t const char * light_t::classname() const { diff --git a/light/light.cc b/light/light.cc index aee96fa1..c4d2e54a 100644 --- a/light/light.cc +++ b/light/light.cc @@ -43,25 +43,20 @@ using namespace std; using strings = std::vector; +// +// worldspawn keys / command-line settings +// + lockable_vec_t scaledist {"dist", 1.0, 0.0f, 100.0f}; lockable_vec_t rangescale {"range", 0.5f, 0.0f, 100.0f}; lockable_vec_t global_anglescale {strings{"anglescale", "anglesense"}, 0.5, 0.0f, 1.0f}; -float fadegate = EQUAL_EPSILON; -int softsamples = 0; lockable_vec_t lightmapgamma {"gamma", 1.0, 0.0f, 100.0f}; -const vec3_t vec3_white = { 255, 255, 255 }; -float surflight_subdivide = 128.0f; -int sunsamples = 64; -qboolean scaledonly = false; lockable_bool_t addminlight {"addmin", false}; lockable_vec_t minlight {"light", 0}; lockable_vec3_t minlight_color {strings{"minlight_color", "mincolor"}, 255.0f, 255.0f, 255.0f, vec3_transformer_t::NORMALIZE_COLOR_TO_255}; -sun_t *suns = NULL; - /* dirt */ -bool dirt_in_use = false; lockable_bool_t globalDirt {strings{"dirt", "dirty"}, false}; lockable_vec_t dirtMode {"dirtmode", 0.0f}; lockable_vec_t dirtDepth {"dirtdepth", 128.0f, 1.0f, std::numeric_limits::infinity()}; @@ -78,6 +73,34 @@ lockable_bool_t bounce {"bounce", false}; lockable_vec_t bouncescale {"bouncescale", 1.0f, 0.0f, 100.0f}; lockable_vec_t bouncecolorscale {"bouncecolorscale", 0.0f, 0.0f, 1.0f}; +/* sun */ +lockable_vec_t sunlight { "sunlight", 0.0f }; /* main sun */ +lockable_vec3_t sunlight_color { "sunlight_color", 255.0f, 255.0f, 255.0f, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }; +lockable_vec_t sun2 { "sun2", 0.0f }; /* second sun */ +lockable_vec3_t sun2_color { "sun2_color", 255.0f, 255.0f, 255.0f, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }; +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, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }; +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, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }; +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, -90.0f, 0.0f, vec3_transformer_t::MANGLE_TO_VEC }; /* defaults to straight down */ +lockable_vec3_t sun2vec { "sun2_mangle", 0.0f, -90.0f, 0.0f, vec3_transformer_t::MANGLE_TO_VEC }; /* defaults to straight down */ +lockable_vec_t sun_deviance { "sunlight_penumbra", 0.0f, 0.0f, 180.0f }; + + +bool dirt_in_use = false; + +float fadegate = EQUAL_EPSILON; +int softsamples = 0; + +const vec3_t vec3_white = { 255, 255, 255 }; +float surflight_subdivide = 128.0f; +int sunsamples = 64; +qboolean scaledonly = false; + +sun_t *suns = NULL; + qboolean surflight_dump = false; static facesup_t *faces_sup; //lit2/bspx stuff