diff --git a/include/common/bspfile.hh b/include/common/bspfile.hh index 62d96015..5357d32f 100644 --- a/include/common/bspfile.hh +++ b/include/common/bspfile.hh @@ -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 diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index 4b85f751..31c97eea 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -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. diff --git a/qbsp/map.cc b/qbsp/map.cc index 56b6c517..569853ae 100644 --- a/qbsp/map.cc +++ b/qbsp/map.cc @@ -295,7 +295,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")); @@ -304,10 +304,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) {