light: rename Face_MakeInwardFacingEdgePlanes() to Face_AllocInwardFacingEdgePlanes()
do memory allocation inside the function.
This commit is contained in:
parent
be3c84ec98
commit
9330d2c087
|
|
@ -198,9 +198,11 @@ bool Light_PointInSolid(const bsp2_t *bsp, const vec3_t point )
|
|||
return Light_PointInSolid_r(bsp, bsp->dmodels[0].headnode[0], point);
|
||||
}
|
||||
|
||||
void
|
||||
Face_MakeInwardFacingEdgePlanes(const bsp2_t *bsp, const bsp2_dface_t *face, plane_t *out)
|
||||
plane_t *
|
||||
Face_AllocInwardFacingEdgePlanes(const bsp2_t *bsp, const bsp2_dface_t *face)
|
||||
{
|
||||
plane_t *out = (plane_t *)calloc(face->numedges, sizeof(plane_t));
|
||||
|
||||
const plane_t faceplane = Face_Plane(bsp, face);
|
||||
for (int i=0; i<face->numedges; i++)
|
||||
{
|
||||
|
|
@ -216,6 +218,8 @@ Face_MakeInwardFacingEdgePlanes(const bsp2_t *bsp, const bsp2_dface_t *face, pla
|
|||
CrossProduct(edgevec, faceplane.normal, dest->normal);
|
||||
dest->dist = DotProduct(dest->normal, v0);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ 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 );
|
||||
void Face_MakeInwardFacingEdgePlanes(const bsp2_t *bsp, const bsp2_dface_t *face, plane_t *out);
|
||||
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);
|
||||
|
||||
#endif /* __COMMON_BSPUTILS_HH__ */
|
||||
|
|
|
|||
|
|
@ -494,8 +494,7 @@ static void CalcPointNormal(const bsp2_t *bsp, const bsp2_dface_t *face, vec_t *
|
|||
// not in any triangle. among the edges this point is _behind_,
|
||||
// search for the one that the point is least past the endpoints of the edge
|
||||
{
|
||||
plane_t *edgeplanes = (plane_t *)calloc(face->numedges, sizeof(plane_t));
|
||||
Face_MakeInwardFacingEdgePlanes(bsp, face, edgeplanes);
|
||||
plane_t *edgeplanes = Face_AllocInwardFacingEdgePlanes(bsp, face);
|
||||
|
||||
int bestplane = -1;
|
||||
vec_t bestdist = VECT_MAX;
|
||||
|
|
|
|||
|
|
@ -190,13 +190,10 @@ MakeFaceInfo(const bsp2_t *bsp, const bsp2_dface_t *face, faceinfo_t *info)
|
|||
{
|
||||
info->face = face;
|
||||
info->numedges = face->numedges;
|
||||
info->edgeplanes = (plane_t *) calloc(face->numedges, sizeof(plane_t));
|
||||
info->edgeplanes = Face_AllocInwardFacingEdgePlanes(bsp, face);
|
||||
|
||||
info->plane = Face_Plane(bsp, face);
|
||||
|
||||
// make edge planes
|
||||
Face_MakeInwardFacingEdgePlanes(bsp, face, info->edgeplanes);
|
||||
|
||||
// make sphere that bounds the face
|
||||
vec3_t centroid = {0,0,0};
|
||||
for (int i=0; i<face->numedges; i++)
|
||||
|
|
|
|||
Loading…
Reference in New Issue