light: adjust Light_PointInSolid to take a model param
This commit is contained in:
parent
1f40e3a58f
commit
9aae46bd1c
|
|
@ -215,10 +215,15 @@ static bool Light_PointInSolid_r(const bsp2_t *bsp, int nodenum, const vec3_t po
|
|||
}
|
||||
}
|
||||
|
||||
// only check hull 0 of model 0 (world)
|
||||
bool Light_PointInSolid(const bsp2_t *bsp, const vec3_t point )
|
||||
// Tests model 0 of the given model
|
||||
bool Light_PointInSolid(const bsp2_t *bsp, const dmodel_t *model, const vec3_t point)
|
||||
{
|
||||
return Light_PointInSolid_r(bsp, bsp->dmodels[0].headnode[0], point);
|
||||
return Light_PointInSolid_r(bsp, model->headnode[0], point);
|
||||
}
|
||||
|
||||
bool Light_PointInWorld(const bsp2_t *bsp, const vec3_t point)
|
||||
{
|
||||
return Light_PointInSolid(bsp, &bsp->dmodels[0], point);
|
||||
}
|
||||
|
||||
plane_t *
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ int TextureName_Contents(const char *texname);
|
|||
int Face_Contents(const bsp2_t *bsp, const bsp2_dface_t *face);
|
||||
const dmodel_t *BSP_DModelForModelString(const bsp2_t *bsp, const std::string &submodel_str);
|
||||
vec_t Plane_Dist(const vec3_t point, const dplane_t *plane);
|
||||
bool Light_PointInSolid(const bsp2_t *bsp, const vec3_t point );
|
||||
bool Light_PointInSolid(const bsp2_t *bsp, const dmodel_t *model, const vec3_t point);
|
||||
bool Light_PointInWorld(const bsp2_t *bsp, const vec3_t point);
|
||||
plane_t *Face_AllocInwardFacingEdgePlanes(const bsp2_t *bsp, const bsp2_dface_t *face);
|
||||
bool EdgePlanes_PointInside(const bsp2_dface_t *face, const plane_t *edgeplanes, const vec3_t point);
|
||||
|
||||
|
|
|
|||
|
|
@ -173,9 +173,6 @@ std::string WorldValueForKey(const std::string &key);
|
|||
void LoadEntities(const globalconfig_t &cfg, const bsp2_t *bsp);
|
||||
void SetupLights(const globalconfig_t &cfg, const bsp2_t *bsp);
|
||||
void WriteEntitiesToString(bsp2_t *bsp);
|
||||
|
||||
bool Light_PointInSolid(const bsp2_t *bsp, const vec3_t point );
|
||||
|
||||
void EstimateVisibleBoundsAtPoint(const vec3_t point, vec3_t mins, vec3_t maxs);
|
||||
|
||||
bool EntDict_CheckNoEmptyValues(const bsp2_t *bsp, const entdict_t &entdict);
|
||||
|
|
|
|||
|
|
@ -1084,7 +1084,8 @@ LoadEntities(const globalconfig_t &cfg, const bsp2_t *bsp)
|
|||
static void
|
||||
FixLightOnFace(const bsp2_t *bsp, const vec3_t point, vec3_t point_out)
|
||||
{
|
||||
if (!Light_PointInSolid(bsp, point)) {
|
||||
// FIXME: Check all shadow casters
|
||||
if (!Light_PointInWorld(bsp, point)) {
|
||||
VectorCopy(point, point_out);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1096,8 +1097,9 @@ FixLightOnFace(const bsp2_t *bsp, const vec3_t point, vec3_t point_out)
|
|||
int axis = i/2;
|
||||
bool add = i%2;
|
||||
testpoint[axis] += (add ? 2 : -2); // sample points are 1 unit off faces. so nudge by 2 units, so the lights are above the sample points
|
||||
|
||||
if (!Light_PointInSolid(bsp, testpoint)) {
|
||||
|
||||
// FIXME: Check all shadow casters
|
||||
if (!Light_PointInWorld(bsp, testpoint)) {
|
||||
VectorCopy(testpoint, point_out);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue