qbsp: _phong_angle_concave support

This commit is contained in:
Eric Wasylishen 2018-01-12 00:44:40 -07:00
parent 93e06d4933
commit 94dbd0a705
3 changed files with 12 additions and 3 deletions

View File

@ -339,6 +339,8 @@ typedef struct {
#define TEX_MINLIGHT_COLOR_B_SHIFT 36
#define TEX_MINLIGHT_COLOR_B_MASK (255ULL << TEX_MINLIGHT_COLOR_B_SHIFT) /* 8 bit value, blue minlight color for this face. */
#define TEX_NOSHADOW (1ULL << 44) /* don't cast a shadow */
#define TEX_PHONG_ANGLE_CONCAVE_SHIFT 45
#define TEX_PHONG_ANGLE_CONCAVE_MASK (255ULL << TEX_PHONG_ANGLE_CONCAVE_SHIFT) /* 8 bit value. if non zero, overrides _phong_angle for concave joints. */
// Q2 Texture flags.
#define Q2_SURF_LIGHT 0x1 // value will hold the light strength

View File

@ -134,8 +134,9 @@
#define TEX_MINLIGHT_COLOR_G_MASK (255ULL << TEX_MINLIGHT_COLOR_G_SHIFT) /* 8 bit value, green minlight color for this face. */
#define TEX_MINLIGHT_COLOR_B_SHIFT 36
#define TEX_MINLIGHT_COLOR_B_MASK (255ULL << TEX_MINLIGHT_COLOR_B_SHIFT) /* 8 bit value, blue minlight color for this face. */
#define TEX_NOSHADOW (1ULL << 44) /* don't cast a shadow */
#define TEX_PHONG_ANGLE_CONCAVE_SHIFT 45
#define TEX_PHONG_ANGLE_CONCAVE_MASK (255ULL << TEX_PHONG_ANGLE_CONCAVE_SHIFT) /* 8 bit value. if non zero, overrides _phong_angle for concave joints. */
/*
* The quality of the bsp output is highly sensitive to these epsilon values.

View File

@ -303,7 +303,7 @@ FindTexinfoEnt(mtexinfo_t *texinfo, const mapentity_t *entity)
}
}
// handle "_phong" and "_phong_angle"
// handle "_phong" and "_phong_angle" and "_phong_angle_concave"
vec_t phongangle = atof(ValueForKey(entity, "_phong_angle"));
const int phong = atoi(ValueForKey(entity, "_phong"));
@ -312,10 +312,16 @@ FindTexinfoEnt(mtexinfo_t *texinfo, const mapentity_t *entity)
}
if (phongangle) {
const uint8_t phongangle_byte = (uint8_t) qmax(0, qmin(255, (int)rint(phongangle)));
const uint64_t phongangle_byte = (uint64_t) qmax(0, qmin(255, (int)rint(phongangle)));
flags |= (phongangle_byte << TEX_PHONG_ANGLE_SHIFT);
}
const vec_t phong_angle_concave = atof(ValueForKey(entity, "_phong_angle_concave"));
{
const uint64_t phong_angle_concave_byte = (uint64_t) qmax(0, qmin(255, (int)rint(phong_angle_concave)));
flags |= (phong_angle_concave_byte << TEX_PHONG_ANGLE_CONCAVE_SHIFT);
}
// handle "_minlight"
const vec_t minlight = atof(ValueForKey(entity, "_minlight"));
if (minlight > 0) {