light: fix "_mincolor" bmodel key which was only accepting 0-255

now accepts 0-1 or 0-255.
This commit is contained in:
Eric Wasylishen 2015-11-20 14:19:05 -08:00
parent f70557ea85
commit 96f1ad3184
3 changed files with 5 additions and 1 deletions

View File

@ -112,6 +112,9 @@ typedef struct entity_s {
#define MAX_LIGHTS 65536 #define MAX_LIGHTS 65536
extern entity_t *lights[MAX_LIGHTS]; extern entity_t *lights[MAX_LIGHTS];
/* detect colors with components in 0-1 and scale them to 0-255 */
void normalize_color_format(vec3_t color);
entity_t *FindEntityWithKeyPair(const char *key, const char *value); entity_t *FindEntityWithKeyPair(const char *key, const char *value);
const char *ValueForKey(const entity_t *ent, const char *key); const char *ValueForKey(const entity_t *ent, const char *key);
void GetVectorForKey(const entity_t *ent, const char *key, vec3_t vec); void GetVectorForKey(const entity_t *ent, const char *key, vec3_t vec);

View File

@ -190,7 +190,7 @@ vec_from_mangle(vec3_t v, const vec3_t m)
} }
/* detect colors with components in 0-1 and scale them to 0-255 */ /* detect colors with components in 0-1 and scale them to 0-255 */
static void void
normalize_color_format(vec3_t color) normalize_color_format(vec3_t color)
{ {
if (color[0] >= 0 && color[0] <= 1 && if (color[0] >= 0 && color[0] <= 1 &&

View File

@ -195,6 +195,7 @@ FindModelInfo(const bsp2_t *bsp)
if (attribute[0]) if (attribute[0])
info->minlight.light = atoi(attribute); info->minlight.light = atoi(attribute);
GetVectorForKey(entity, "_mincolor", info->minlight.color); GetVectorForKey(entity, "_mincolor", info->minlight.color);
normalize_color_format(info->minlight.color);
if (!VectorCompare(info->minlight.color, vec3_origin)) { if (!VectorCompare(info->minlight.color, vec3_origin)) {
if (!write_litfile) if (!write_litfile)
write_litfile = true; write_litfile = true;