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;
|
const dmodel_t *model;
|
||||||
qboolean shadowself;
|
qboolean shadowself;
|
||||||
lightsample_t minlight;
|
lightsample_t minlight;
|
||||||
|
char minlight_exclude[16]; /* texture name to exclude from minlight */
|
||||||
float lightmapscale;
|
float lightmapscale;
|
||||||
vec3_t offset;
|
vec3_t offset;
|
||||||
qboolean nodirt;
|
qboolean nodirt;
|
||||||
|
|
@ -290,6 +291,9 @@ extern char mapfilename[1024];
|
||||||
void
|
void
|
||||||
PrintFaceInfo(const bsp2_dface_t *face, const bsp2_t *bsp);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,11 @@ FindModelInfo(const bsp2_t *bsp, const char *lmscaleoverride)
|
||||||
attribute = ValueForKey(entity, "_minlight");
|
attribute = ValueForKey(entity, "_minlight");
|
||||||
if (attribute[0])
|
if (attribute[0])
|
||||||
info->minlight.light = atoi(attribute);
|
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);
|
GetVectorForKey(entity, "_mincolor", info->minlight.color);
|
||||||
normalize_color_format(info->minlight.color);
|
normalize_color_format(info->minlight.color);
|
||||||
if (!VectorCompare(info->minlight.color, vec3_origin)) {
|
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
|
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 lightsurf_t *lightsurf, lightmap_t *lightmaps)
|
||||||
{
|
{
|
||||||
const modelinfo_t *modelinfo = lightsurf->modelinfo;
|
const modelinfo_t *modelinfo = lightsurf->modelinfo;
|
||||||
|
|
@ -1387,6 +1388,10 @@ LightFace_Min(const lightsample_t *light,
|
||||||
lightsample_t *sample;
|
lightsample_t *sample;
|
||||||
lightmap_t *lightmap;
|
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 */
|
/* Find a style 0 lightmap */
|
||||||
lightmap = Lightmap_ForStyle(lightmaps, 0, lightsurf);
|
lightmap = Lightmap_ForStyle(lightmaps, 0, lightsurf);
|
||||||
|
|
||||||
|
|
@ -1865,7 +1870,7 @@ void LightFaceShutdown(struct ltface_ctx *ctx)
|
||||||
free(ctx);
|
free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
const char *
|
||||||
Face_TextureName(const bsp2_t *bsp, const bsp2_dface_t *face)
|
Face_TextureName(const bsp2_t *bsp, const bsp2_dface_t *face)
|
||||||
{
|
{
|
||||||
int texnum = bsp->texinfo[face->texinfo].miptex;
|
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. */
|
/* minlight - Use the greater of global or model minlight. */
|
||||||
if (lightsurf->minlight.light > minlight.light)
|
if (lightsurf->minlight.light > minlight.light)
|
||||||
LightFace_Min(&lightsurf->minlight, lightsurf, lightmaps);
|
LightFace_Min(bsp, face, &lightsurf->minlight, lightsurf, lightmaps);
|
||||||
else
|
else
|
||||||
LightFace_Min(&minlight, lightsurf, lightmaps);
|
LightFace_Min(bsp, face, &minlight, lightsurf, lightmaps);
|
||||||
|
|
||||||
/* negative lights */
|
/* negative lights */
|
||||||
for (lighte = lights; (entity = *lighte); lighte++)
|
for (lighte = lights; (entity = *lighte); lighte++)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue