light: record setting names

This commit is contained in:
Eric Wasylishen 2016-07-13 21:33:38 -06:00
parent c694bacc2f
commit 42657f9607
3 changed files with 46 additions and 30 deletions

View File

@ -29,6 +29,9 @@
#include <light/litfile.hh>
#include <vector>
#include <string>
#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<std::string> _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<std::string> 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<std::string> { name }, v, l) {}
};
class lockable_vec3_t {
private:
std::vector<std::string> _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<std::string> 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<std::string> { name }, a,b,c,l) {}
};
/* dirt */

View File

@ -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<std::string>;
/* 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

View File

@ -56,24 +56,26 @@ qboolean addminlight = false;
lightsample_t minlight = { 0, { 255, 255, 255 } };
sun_t *suns = NULL;
using strings = std::vector<std::string>;
/* 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;