Merge remote-tracking branch 'origin/master' into hlbsp

# Conflicts:
#	include/qbsp/qbsp.hh
This commit is contained in:
Eric Wasylishen 2019-07-04 19:28:06 -06:00
commit 6653760982
9 changed files with 24 additions and 16 deletions

View File

@ -352,6 +352,7 @@ typedef struct {
#define TEX_PHONG_ANGLE_CONCAVE_SHIFT 45 #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. */ #define TEX_PHONG_ANGLE_CONCAVE_MASK (255ULL << TEX_PHONG_ANGLE_CONCAVE_SHIFT) /* 8 bit value. if non zero, overrides _phong_angle for concave joints. */
#define TEX_NOBOUNCE (1ULL << 53) /* light doesn't bounce off this face */ #define TEX_NOBOUNCE (1ULL << 53) /* light doesn't bounce off this face */
#define TEX_NOMINLIGHT (1ULL << 54) /* opt out of minlight on this face */
// Q2 Texture flags. // Q2 Texture flags.
#define Q2_SURF_LIGHT 0x1 // value will hold the light strength #define Q2_SURF_LIGHT 0x1 // value will hold the light strength

View File

@ -45,6 +45,9 @@
#define ANGLE_EPSILON 0.001f #define ANGLE_EPSILON 0.001f
#define EQUAL_EPSILON 0.001f #define EQUAL_EPSILON 0.001f
// FIXME: use maximum dimension of level
#define MAX_SKY_DIST 1000000.0f
typedef struct { typedef struct {
vec3_t color; vec3_t color;
vec3_t direction; vec3_t direction;
@ -204,7 +207,6 @@ public:
public: public:
lockable_vec_t minlight, shadow, shadowself, shadowworldonly, switchableshadow, switchshadstyle, dirt, phong, phong_angle, alpha; lockable_vec_t minlight, shadow, shadowself, shadowworldonly, switchableshadow, switchshadstyle, dirt, phong, phong_angle, alpha;
lockable_string_t minlight_exclude;
lockable_vec3_t minlight_color; lockable_vec3_t minlight_color;
lockable_bool_t lightignore; lockable_bool_t lightignore;
@ -238,7 +240,6 @@ public:
phong { "phong", 0 }, phong { "phong", 0 },
phong_angle { "phong_angle", 0 }, phong_angle { "phong_angle", 0 },
alpha { "alpha", 1.0f }, alpha { "alpha", 1.0f },
minlight_exclude { "minlight_exclude", "" },
minlight_color { strings{"minlight_color", "mincolor"}, 255, 255, 255, vec3_transformer_t::NORMALIZE_COLOR_TO_255 }, minlight_color { strings{"minlight_color", "mincolor"}, 255, 255, 255, vec3_transformer_t::NORMALIZE_COLOR_TO_255 },
lightignore { "lightignore", false } lightignore { "lightignore", false }
{ {
@ -248,7 +249,7 @@ public:
settingsdict_t settings() { settingsdict_t settings() {
return {{ return {{
&minlight, &shadow, &shadowself, &shadowworldonly, &switchableshadow, &switchshadstyle, &dirt, &phong, &phong_angle, &alpha, &minlight, &shadow, &shadowself, &shadowworldonly, &switchableshadow, &switchshadstyle, &dirt, &phong, &phong_angle, &alpha,
&minlight_exclude, &minlight_color, &lightignore &minlight_color, &lightignore
}}; }};
} }
}; };

View File

@ -147,7 +147,8 @@ private:
public: public:
bool boolValue() const { bool boolValue() const {
return static_cast<bool>(_value); // we use -1 to mean false
return intValue() == 1;
} }
int intValue() const { int intValue() const {

View File

@ -141,7 +141,8 @@
#define TEX_PHONG_ANGLE_CONCAVE_SHIFT 45 #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. */ #define TEX_PHONG_ANGLE_CONCAVE_MASK (255ULL << TEX_PHONG_ANGLE_CONCAVE_SHIFT) /* 8 bit value. if non zero, overrides _phong_angle for concave joints. */
#define TEX_NOBOUNCE (1ULL << 53) /* light doesn't bounce off this face */ #define TEX_NOBOUNCE (1ULL << 53) /* light doesn't bounce off this face */
#define TEX_NOEXPAND (1ULL << 54) /* don't expand this face for larger clip hulls */ #define TEX_NOMINLIGHT (1ULL << 54) /* opt out of minlight on this face */
#define TEX_NOEXPAND (1ULL << 55) /* don't expand this face for larger clip hulls */
/* /*
* The quality of the bsp output is highly sensitive to these epsilon values. * The quality of the bsp output is highly sensitive to these epsilon values.

View File

@ -328,8 +328,7 @@ MakeBounceLights (const globalconfig_t &cfg, const mbsp_t *bsp)
{ {
logprint("--- MakeBounceLights ---\n"); logprint("--- MakeBounceLights ---\n");
const dmodel_t *model = &bsp->dmodels[0];
make_bounce_lights_args_t args { bsp, &cfg }; //mxd. https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.html make_bounce_lights_args_t args { bsp, &cfg }; //mxd. https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-pro-type-member-init.html
RunThreadsOn(model->firstface, model->firstface + model->numfaces, MakeBounceLightsThread, (void *)&args); RunThreadsOn(0, bsp->numfaces, MakeBounceLightsThread, (void *)&args);
} }

View File

@ -1530,7 +1530,6 @@ static void
LightFace_Sky(const sun_t *sun, const lightsurf_t *lightsurf, lightmapdict_t *lightmaps) LightFace_Sky(const sun_t *sun, const lightsurf_t *lightsurf, lightmapdict_t *lightmaps)
{ {
const globalconfig_t &cfg = *lightsurf->cfg; const globalconfig_t &cfg = *lightsurf->cfg;
const float MAX_SKY_DIST = 65536.0f;
const modelinfo_t *modelinfo = lightsurf->modelinfo; const modelinfo_t *modelinfo = lightsurf->modelinfo;
const plane_t *plane = &lightsurf->plane; const plane_t *plane = &lightsurf->plane;
@ -1635,11 +1634,11 @@ LightFace_Min(const mbsp_t *bsp, const bsp2_dface_t *face,
const globalconfig_t &cfg = *lightsurf->cfg; const globalconfig_t &cfg = *lightsurf->cfg;
const modelinfo_t *modelinfo = lightsurf->modelinfo; const modelinfo_t *modelinfo = lightsurf->modelinfo;
const char *texname = Face_TextureName(bsp, face); const uint64_t extended_flags = extended_texinfo_flags[face->texinfo];
if (texname[0] != '\0' && modelinfo->minlight_exclude.stringValue() == std::string{ texname }) { if ((extended_flags & TEX_NOMINLIGHT) != 0) {
return; /* this texture is excluded from minlight */ return; /* this face is excluded from minlight */
} }
/* Find a style 0 lightmap */ /* Find a style 0 lightmap */
lightmap_t *lightmap = Lightmap_ForStyle(lightmaps, 0, lightsurf); lightmap_t *lightmap = Lightmap_ForStyle(lightmaps, 0, lightsurf);

View File

@ -37,8 +37,6 @@
using namespace std; using namespace std;
using namespace polylib; using namespace polylib;
static const float MAX_SKY_RAY_DEPTH = 8192.0f;
class sceneinfo { class sceneinfo {
public: public:
unsigned geomID; unsigned geomID;
@ -754,7 +752,7 @@ qboolean Embree_TestSky(const vec3_t start, const vec3_t dirn, const modelinfo_t
VectorCopy(dirn, dir_normalized); VectorCopy(dirn, dir_normalized);
VectorNormalize(dir_normalized); VectorNormalize(dir_normalized);
RTCRay ray = SetupRay(0, start, dir_normalized, MAX_SKY_RAY_DEPTH, self); RTCRay ray = SetupRay(0, start, dir_normalized, MAX_SKY_DIST, self);
rtcIntersect(scene, ray); rtcIntersect(scene, ray);
qboolean hit_sky = (ray.geomID == skygeom.geomID); qboolean hit_sky = (ray.geomID == skygeom.geomID);

View File

@ -469,7 +469,7 @@ CreateBrushFaces(hullbrush_t *hullbrush, const vec3_t rotate_offset,
// Rotatable objects must have a bounding box big enough to // Rotatable objects must have a bounding box big enough to
// account for all its rotations // account for all its rotations
if (rotate_offset[0] || rotate_offset[1] || rotate_offset[2]) { if (0 /*rotate_offset[0] || rotate_offset[1] || rotate_offset[2]*/) {
vec_t delta; vec_t delta;
delta = fabs(max); delta = fabs(max);

View File

@ -310,6 +310,14 @@ FindTexinfoEnt(mtexinfo_t *texinfo, const mapentity_t *entity)
flags |= TEX_NODIRT; flags |= TEX_NODIRT;
if (atoi(ValueForKey(entity, "_bounce")) == -1) if (atoi(ValueForKey(entity, "_bounce")) == -1)
flags |= TEX_NOBOUNCE; flags |= TEX_NOBOUNCE;
if (atoi(ValueForKey(entity, "_minlight")) == -1)
flags |= TEX_NOMINLIGHT;
const char *excludeTex = ValueForKey(entity, "_minlight_exclude");
if (strlen(excludeTex) > 0 && !Q_strcasecmp(texname, excludeTex)) {
flags |= TEX_NOMINLIGHT;
}
if (shadow == -1) if (shadow == -1)
flags |= TEX_NOSHADOW; flags |= TEX_NOSHADOW;
if (!Q_strcasecmp("func_detail_illusionary", ValueForKey(entity, "classname"))) { if (!Q_strcasecmp("func_detail_illusionary", ValueForKey(entity, "classname"))) {