qbsp, light: allow _minlight to go up to 510 instead of 255 on func_detail/etc.

This commit is contained in:
Eric Wasylishen 2021-09-25 13:11:15 -06:00
parent 4b25b6b095
commit f7c0c80a26
3 changed files with 7 additions and 3 deletions

View File

@ -457,10 +457,14 @@ struct surfflags_t {
// if non zero, enables phong shading and gives the angle threshold to use
uint8_t phong_angle;
// minlight value for this face
// minlight value for this face, multiplied by 0.5, so we can store overbrights in 8 bits
// FIXME: skip the compression and just store a float? serialize all of these to a JSON .texinfo
// for better extensibility?
uint8_t minlight;
// red minlight colors for this face
// FIXME: this probably makes it illegal to memcpy() from a surfflags_t, which is done in
// WriteExtendedTexinfoFlags. Again, points to switching to JSON serialization.
std::array<uint8_t, 3> minlight_color;
// if non zero, overrides _phong_angle for concave joints

View File

@ -781,7 +781,7 @@ Lightsurf_Init(const modelinfo_t *modelinfo, const bsp2_dface_t *face,
if (modelinfo->minlight.isChanged()) {
lightsurf->minlight = modelinfo->minlight.floatValue();
} else {
lightsurf->minlight = extended_flags.minlight;
lightsurf->minlight = (float)extended_flags.minlight * 2; // see SurfFlagsForEntity
}
// minlight_color

View File

@ -450,7 +450,7 @@ SurfFlagsForEntity(const mtexinfo_t &texinfo, const mapentity_t *entity)
// handle "_minlight"
const vec_t minlight = atof(ValueForKey(entity, "_minlight"));
if (minlight > 0) {
flags.minlight = qclamp((int)rint(minlight), 0, 255);
flags.minlight = qclamp((int)rint(minlight), 0, 510) / 2; // map 0..510 to 0..255, so we can handle overbright
}
// handle "_mincolor"