light: add _minlight_exclude bmodel key
This commit is contained in:
parent
1340529234
commit
2a4168f35c
|
|
@ -114,6 +114,7 @@ typedef struct {
|
|||
const dmodel_t *model;
|
||||
qboolean shadowself;
|
||||
lightsample_t minlight;
|
||||
char minlight_exclude[16]; /* texture name to exclude from minlight */
|
||||
float lightmapscale;
|
||||
vec3_t offset;
|
||||
qboolean nodirt;
|
||||
|
|
@ -290,6 +291,9 @@ extern char mapfilename[1024];
|
|||
void
|
||||
PrintFaceInfo(const bsp2_dface_t *face, const bsp2_t *bsp);
|
||||
|
||||
const char *
|
||||
Face_TextureName(const bsp2_t *bsp, const bsp2_dface_t *face);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -278,6 +278,11 @@ FindModelInfo(const bsp2_t *bsp, const char *lmscaleoverride)
|
|||
attribute = ValueForKey(entity, "_minlight");
|
||||
if (attribute[0])
|
||||
info->minlight.light = atoi(attribute);
|
||||
const char *minlight_exclude = ValueForKey(entity, "_minlight_exclude");
|
||||
if (minlight_exclude[0] != '\0') {
|
||||
strncpy(info->minlight_exclude, minlight_exclude, 15);
|
||||
info->minlight_exclude[15] = '\0';
|
||||
}
|
||||
GetVectorForKey(entity, "_mincolor", info->minlight.color);
|
||||
normalize_color_format(info->minlight.color);
|
||||
if (!VectorCompare(info->minlight.color, vec3_origin)) {
|
||||
|
|
|
|||
|
|
@ -1375,7 +1375,8 @@ LightFace_Sky(const sun_t *sun, const lightsurf_t *lightsurf, lightmap_t *lightm
|
|||
* ============
|
||||
*/
|
||||
static void
|
||||
LightFace_Min(const lightsample_t *light,
|
||||
LightFace_Min(const bsp2_t *bsp, const bsp2_dface_t *face,
|
||||
const lightsample_t *light,
|
||||
const lightsurf_t *lightsurf, lightmap_t *lightmaps)
|
||||
{
|
||||
const modelinfo_t *modelinfo = lightsurf->modelinfo;
|
||||
|
|
@ -1387,6 +1388,10 @@ LightFace_Min(const lightsample_t *light,
|
|||
lightsample_t *sample;
|
||||
lightmap_t *lightmap;
|
||||
|
||||
const char *texname = Face_TextureName(bsp, face);
|
||||
if (texname[0] != '\0' && !strcmp(texname, modelinfo->minlight_exclude))
|
||||
return; /* this texture is excluded from minlight */
|
||||
|
||||
/* Find a style 0 lightmap */
|
||||
lightmap = Lightmap_ForStyle(lightmaps, 0, lightsurf);
|
||||
|
||||
|
|
@ -1865,7 +1870,7 @@ void LightFaceShutdown(struct ltface_ctx *ctx)
|
|||
free(ctx);
|
||||
}
|
||||
|
||||
static const char *
|
||||
const char *
|
||||
Face_TextureName(const bsp2_t *bsp, const bsp2_dface_t *face)
|
||||
{
|
||||
int texnum = bsp->texinfo[face->texinfo].miptex;
|
||||
|
|
@ -1966,9 +1971,9 @@ LightFace(bsp2_dface_t *face, facesup_t *facesup, const modelinfo_t *modelinfo,
|
|||
|
||||
/* minlight - Use the greater of global or model minlight. */
|
||||
if (lightsurf->minlight.light > minlight.light)
|
||||
LightFace_Min(&lightsurf->minlight, lightsurf, lightmaps);
|
||||
LightFace_Min(bsp, face, &lightsurf->minlight, lightsurf, lightmaps);
|
||||
else
|
||||
LightFace_Min(&minlight, lightsurf, lightmaps);
|
||||
LightFace_Min(bsp, face, &minlight, lightsurf, lightmaps);
|
||||
|
||||
/* negative lights */
|
||||
for (lighte = lights; (entity = *lighte); lighte++)
|
||||
|
|
|
|||
Loading…
Reference in New Issue