light: rename dynamic shadow stuff to switchshadstyle" for QC,
and "_switchableshadow" for the mapper.
This commit is contained in:
parent
b71f769c0a
commit
6e707130be
|
|
@ -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<const modelinfo_t *> tracelist;
|
||||
extern std::vector<const modelinfo_t *> selfshadowlist;
|
||||
extern std::vector<const modelinfo_t *> dynamicshadowlist;
|
||||
extern std::vector<const modelinfo_t *> 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
|
||||
}};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ static byte *lux_file_end; // end of space for luxfile data
|
|||
std::vector<modelinfo_t *> modelinfo;
|
||||
std::vector<const modelinfo_t *> tracelist;
|
||||
std::vector<const modelinfo_t *> selfshadowlist;
|
||||
std::vector<const modelinfo_t *> dynamicshadowlist;
|
||||
std::vector<const modelinfo_t *> 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()){
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ CreateGeometryFromWindings(RTCScene scene, const std::vector<winding_t *> &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<const bsp2_dface_t *> skyfaces, solidfaces, fencefaces, selfshadowfaces, dynamicshadowfaces;
|
||||
std::vector<const bsp2_dface_t *> 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; i<model->model->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<filtertype_t::INTERSECTION>);
|
||||
|
|
@ -616,17 +616,17 @@ Embree_TraceInit(const bsp2_t *bsp)
|
|||
rtcSetIntersectionFilterFunctionN(scene, selfshadowgeom.geomID, Embree_FilterFuncN<filtertype_t::INTERSECTION>);
|
||||
rtcSetOcclusionFilterFunctionN(scene, selfshadowgeom.geomID, Embree_FilterFuncN<filtertype_t::OCCLUSION>);
|
||||
|
||||
rtcSetIntersectionFilterFunctionN(scene, dynamicshadowgeom.geomID, Embree_FilterFuncN<filtertype_t::INTERSECTION>);
|
||||
rtcSetOcclusionFilterFunctionN(scene, dynamicshadowgeom.geomID, Embree_FilterFuncN<filtertype_t::OCCLUSION>);
|
||||
rtcSetIntersectionFilterFunctionN(scene, switchableshadowgeom.geomID, Embree_FilterFuncN<filtertype_t::INTERSECTION>);
|
||||
rtcSetOcclusionFilterFunctionN(scene, switchableshadowgeom.geomID, Embree_FilterFuncN<filtertype_t::OCCLUSION>);
|
||||
|
||||
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).
|
||||
|
|
|
|||
Loading…
Reference in New Issue