light: use lightsample_t for modelinfo->minlight
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
46277eec41
commit
d57e7d50fd
|
|
@ -38,11 +38,15 @@ qboolean TestLine(const vec3_t start, const vec3_t stop);
|
|||
qboolean TestLineModel(const dmodel_t *model,
|
||||
const vec3_t start, const vec3_t stop);
|
||||
|
||||
typedef struct {
|
||||
vec_t light;
|
||||
vec3_t color;
|
||||
} lightsample_t;
|
||||
|
||||
typedef struct {
|
||||
const dmodel_t *model;
|
||||
qboolean shadowself;
|
||||
int minlight;
|
||||
vec3_t mincolor;
|
||||
lightsample_t minlight;
|
||||
vec3_t offset;
|
||||
} modelinfo_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ FindModelInfo(void)
|
|||
char modelname[20];
|
||||
const char *attribute;
|
||||
const dmodel_t **shadowmodels;
|
||||
modelinfo_t *info;
|
||||
|
||||
shadowmodels = malloc(sizeof(dmodel_t *) * (nummodels + 1));
|
||||
memset(shadowmodels, 0, sizeof(dmodel_t *) * (nummodels + 1));
|
||||
|
|
@ -120,8 +121,8 @@ FindModelInfo(void)
|
|||
memset(modelinfo, 0, sizeof(*modelinfo) * nummodels);
|
||||
modelinfo[0].model = &dmodels[0];
|
||||
|
||||
for (i = 1; i < nummodels; i++) {
|
||||
modelinfo[i].model = &dmodels[i];
|
||||
for (i = 1, info = modelinfo + 1; i < nummodels; i++, info++) {
|
||||
info->model = &dmodels[i];
|
||||
|
||||
/* Find the entity for the model */
|
||||
snprintf(modelname, sizeof(modelname), "*%d", i);
|
||||
|
|
@ -137,27 +138,27 @@ FindModelInfo(void)
|
|||
} else {
|
||||
shadow = atoi(ValueForKey(entity, "_shadowself"));
|
||||
if (shadow)
|
||||
modelinfo[i].shadowself = true;
|
||||
info->shadowself = true;
|
||||
}
|
||||
|
||||
/* Set up the offset for rotate_* entities */
|
||||
attribute = ValueForKey(entity, "classname");
|
||||
if (!strncmp(attribute, "rotate_", 7))
|
||||
GetVectorForKey(entity, "origin", modelinfo[i].offset);
|
||||
GetVectorForKey(entity, "origin", info->offset);
|
||||
|
||||
/* Grab the bmodel minlight values, if any */
|
||||
attribute = ValueForKey(entity, "_minlight");
|
||||
if (attribute[0])
|
||||
modelinfo[i].minlight = atoi(attribute);
|
||||
GetVectorForKey(entity, "_mincolor", modelinfo[i].mincolor);
|
||||
if (!VectorCompare(modelinfo[i].mincolor, vec3_origin)) {
|
||||
info->minlight.light = atoi(attribute);
|
||||
GetVectorForKey(entity, "_mincolor", info->minlight.color);
|
||||
if (!VectorCompare(info->minlight.color, vec3_origin)) {
|
||||
if (!colored) {
|
||||
colored = true;
|
||||
logprint("Colored light entities detected: "
|
||||
".lit output enabled.\n");
|
||||
}
|
||||
} else {
|
||||
VectorCopy(vec3_white, modelinfo[i].mincolor);
|
||||
VectorCopy(vec3_white, info->minlight.color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,11 +160,6 @@ typedef struct {
|
|||
vec3_t points[SINGLEMAP];
|
||||
} lightsurf_t;
|
||||
|
||||
typedef struct {
|
||||
vec_t light;
|
||||
vec3_t color;
|
||||
} lightsample_t;
|
||||
|
||||
typedef struct {
|
||||
int style;
|
||||
lightsample_t samples[SINGLEMAP];
|
||||
|
|
@ -950,14 +945,13 @@ LightFace(dface_t *face, const modelinfo_t *modelinfo)
|
|||
}
|
||||
|
||||
/* Minimum lighting - Use the greater of global or model minlight. */
|
||||
if (modelinfo->minlight > worldminlight) {
|
||||
light.light = modelinfo->minlight;
|
||||
VectorCopy(modelinfo->mincolor, light.color);
|
||||
if (modelinfo->minlight.light > worldminlight) {
|
||||
FixMinlight(&modelinfo->minlight, &lightsurf, lightmaps);
|
||||
} else {
|
||||
light.light = worldminlight;
|
||||
VectorCopy(minlight_color, light.color);
|
||||
FixMinlight(&light, &lightsurf, lightmaps);
|
||||
}
|
||||
FixMinlight(&light, &lightsurf, lightmaps);
|
||||
|
||||
if (nominlimit) {
|
||||
/* cast only negative lights */
|
||||
|
|
|
|||
Loading…
Reference in New Issue