From 6e707130be95ba241ab9158912f28b7b20985b84 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 26 Jun 2017 13:41:24 -0600 Subject: [PATCH] light: rename dynamic shadow stuff to switchshadstyle" for QC, and "_switchableshadow" for the mapper. --- include/light/light.hh | 10 +++++----- light/entities.cc | 4 ++-- light/light.cc | 12 +++++------- light/trace_embree.cc | 28 ++++++++++++++-------------- 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/include/light/light.hh b/include/light/light.hh index 30a6df9e..98f03057 100644 --- a/include/light/light.hh +++ b/include/light/light.hh @@ -167,7 +167,7 @@ extern byte thepalette[768]; /* tracelist is a std::vector of pointers to modelinfo_t to use for LOS tests */ extern std::vector tracelist; extern std::vector selfshadowlist; -extern std::vector dynamicshadowlist; +extern std::vector switchableshadowlist; extern int numDirtVectors; @@ -197,7 +197,7 @@ public: vec3_t offset; public: - lockable_vec_t minlight, shadow, shadowself, dynamicshadow, dynshadowstyle, dirt, phong, phong_angle, alpha; + lockable_vec_t minlight, shadow, shadowself, switchableshadow, switchshadstyle, dirt, phong, phong_angle, alpha; lockable_string_t minlight_exclude; lockable_vec3_t minlight_color; lockable_bool_t lightignore; @@ -220,8 +220,8 @@ public: minlight { "minlight", 0 }, shadow { "shadow", 0 }, shadowself { "shadowself", 0 }, - dynamicshadow { "dynamicshadow", 0 }, - dynshadowstyle { "dynshadowstyle", 0}, + switchableshadow { "switchableshadow", 0 }, + switchshadstyle { "switchshadstyle", 0}, dirt { "dirt", 0 }, phong { "phong", 0 }, phong_angle { "phong_angle", 0 }, @@ -235,7 +235,7 @@ public: settingsdict_t settings() { return {{ - &minlight, &shadow, &shadowself, &dynamicshadow, &dynshadowstyle, &dirt, &phong, &phong_angle, &alpha, + &minlight, &shadow, &shadowself, &switchableshadow, &switchshadstyle, &dirt, &phong, &phong_angle, &alpha, &minlight_exclude, &minlight_color, &lightignore }}; } diff --git a/light/entities.cc b/light/entities.cc index 400fa060..63f0cb7f 100644 --- a/light/entities.cc +++ b/light/entities.cc @@ -1010,12 +1010,12 @@ LoadEntities(const globalconfig_t &cfg, const bsp2_t *bsp) } // setup light styles for dynamic shadow entities - if (EntDict_StringForKey(entdict, "_dynamicshadow") == "1") { + if (EntDict_StringForKey(entdict, "_switchableshadow") == "1") { std::string targetname = EntDict_StringForKey(entdict, "targetname"); // if targetname is "", generates a new unique lightstyle const int style = LightStyleForTargetname(targetname); // TODO: Configurable key? - entdict["dynshadowstyle"] = std::to_string(style); + entdict["switchshadstyle"] = std::to_string(style); } // parse escape sequences diff --git a/light/light.cc b/light/light.cc index f3dcf166..9da543a5 100644 --- a/light/light.cc +++ b/light/light.cc @@ -81,7 +81,7 @@ static byte *lux_file_end; // end of space for luxfile data std::vector modelinfo; std::vector tracelist; std::vector selfshadowlist; -std::vector dynamicshadowlist; +std::vector switchableshadowlist; int oversample = 1; int write_litfile = 0; /* 0 for none, 1 for .lit, 2 for bspx, 3 for both */ @@ -275,7 +275,7 @@ FindModelInfo(const bsp2_t *bsp, const char *lmscaleoverride) Q_assert(modelinfo.size() == 0); Q_assert(tracelist.size() == 0); Q_assert(selfshadowlist.size() == 0); - Q_assert(dynamicshadowlist.size() == 0); + Q_assert(switchableshadowlist.size() == 0); if (!bsp->nummodels) { Error("Corrupt .BSP: bsp->nummodels is 0!"); @@ -326,11 +326,9 @@ FindModelInfo(const bsp2_t *bsp, const char *lmscaleoverride) info->settings().setSettings(*entdict, false); /* Check if this model will cast shadows (shadow => shadowself) */ - if (info->dynamicshadow.boolValue()) { - Q_assert(info->dynshadowstyle.intValue() != 0); - logprint("Found a bmodel using dynamic shadow lightstyle: %d\n", info->dynshadowstyle.intValue()); - - dynamicshadowlist.push_back(info); + if (info->switchableshadow.boolValue()) { + Q_assert(info->switchshadstyle.intValue() != 0); + switchableshadowlist.push_back(info); } else if (info->shadow.boolValue()) { tracelist.push_back(info); } else if (info->shadowself.boolValue()){ diff --git a/light/trace_embree.cc b/light/trace_embree.cc index a7d9a503..57f5d54b 100644 --- a/light/trace_embree.cc +++ b/light/trace_embree.cc @@ -159,7 +159,7 @@ CreateGeometryFromWindings(RTCScene scene, const std::vector &windi RTCDevice device; RTCScene scene; /* global shadow casters */ -sceneinfo skygeom, solidgeom, fencegeom, selfshadowgeom, dynamicshadowgeom; +sceneinfo skygeom, solidgeom, fencegeom, selfshadowgeom, switchableshadowgeom; static const bsp2_t *bsp_static; @@ -179,8 +179,8 @@ Embree_SceneinfoForGeomID(unsigned int geomID) return fencegeom; } else if (geomID == selfshadowgeom.geomID) { return selfshadowgeom; - } else if (geomID == dynamicshadowgeom.geomID) { - return dynamicshadowgeom; + } else if (geomID == switchableshadowgeom.geomID) { + return switchableshadowgeom; } else { Error("unexpected geomID"); } @@ -261,11 +261,11 @@ Embree_FilterFuncN(int* valid, valid[i] = INVALID; continue; } - } else if (geomID == dynamicshadowgeom.geomID) { + } else if (geomID == switchableshadowgeom.geomID) { // we hit a dynamic shadow caster. reject the hit, but store the // info about what we hit. const modelinfo_t *modelinfo = Embree_LookupModelinfo(geomID, primID); - int style = modelinfo->dynshadowstyle.intValue(); + int style = modelinfo->switchshadstyle.intValue(); AddDynamicOccluderToRay(context, rayIndex, style); @@ -526,7 +526,7 @@ Embree_TraceInit(const bsp2_t *bsp) bsp_static = bsp; Q_assert(device == nullptr); - std::vector skyfaces, solidfaces, fencefaces, selfshadowfaces, dynamicshadowfaces; + std::vector skyfaces, solidfaces, fencefaces, selfshadowfaces, switchableshadowfaces; /* Check against the list of global shadow casters */ for (const modelinfo_t *model : tracelist) { @@ -569,10 +569,10 @@ Embree_TraceInit(const bsp2_t *bsp) } /* Dynamic-shadow models */ - for (const modelinfo_t *model : dynamicshadowlist) { + for (const modelinfo_t *model : switchableshadowlist) { for (int i=0; imodel->numfaces; i++) { const bsp2_dface_t *face = BSP_GetFace(bsp, model->model->firstface + i); - dynamicshadowfaces.push_back(face); + switchableshadowfaces.push_back(face); } } @@ -607,7 +607,7 @@ Embree_TraceInit(const bsp2_t *bsp) solidgeom = CreateGeometry(bsp, scene, solidfaces); fencegeom = CreateGeometry(bsp, scene, fencefaces); selfshadowgeom = CreateGeometry(bsp, scene, selfshadowfaces); - dynamicshadowgeom = CreateGeometry(bsp, scene, dynamicshadowfaces); + switchableshadowgeom = CreateGeometry(bsp, scene, switchableshadowfaces); CreateGeometryFromWindings(scene, skipwindings); rtcSetIntersectionFilterFunctionN(scene, fencegeom.geomID, Embree_FilterFuncN); @@ -616,17 +616,17 @@ Embree_TraceInit(const bsp2_t *bsp) rtcSetIntersectionFilterFunctionN(scene, selfshadowgeom.geomID, Embree_FilterFuncN); rtcSetOcclusionFilterFunctionN(scene, selfshadowgeom.geomID, Embree_FilterFuncN); - rtcSetIntersectionFilterFunctionN(scene, dynamicshadowgeom.geomID, Embree_FilterFuncN); - rtcSetOcclusionFilterFunctionN(scene, dynamicshadowgeom.geomID, Embree_FilterFuncN); + rtcSetIntersectionFilterFunctionN(scene, switchableshadowgeom.geomID, Embree_FilterFuncN); + rtcSetOcclusionFilterFunctionN(scene, switchableshadowgeom.geomID, Embree_FilterFuncN); rtcCommit (scene); - logprint("Embree_TraceInit: %d skyfaces %d solidfaces %d fencefaces %d selfshadowfaces %d dynamicshadowfaces %d skipwindings\n", + logprint("Embree_TraceInit: %d skyfaces %d solidfaces %d fencefaces %d selfshadowfaces %d switchableshadowfaces %d skipwindings\n", (int)skyfaces.size(), (int)solidfaces.size(), (int)fencefaces.size(), (int)selfshadowfaces.size(), - (int)dynamicshadowfaces.size(), + (int)switchableshadowfaces.size(), (int)skipwindings.size()); FreeWindings(skipwindings); @@ -761,7 +761,7 @@ public: vec3_t *_ray_colors; vec3_t *_ray_normalcontribs; - // This is set to the modelinfo's dynshadowstyle if the ray hit + // This is set to the modelinfo's switchshadstyle if the ray hit // a dynamic shadow caster. (note that for rays that hit dynamic // shadow casters, all of the other hit data is assuming the ray went // straight through).