light: move Face_Contents to common
This commit is contained in:
parent
cc12810da3
commit
d9bb0be32e
|
|
@ -104,3 +104,25 @@ const float *GetSurfaceVertexPoint(const bsp2_t *bsp, const bsp2_dface_t *f, int
|
||||||
{
|
{
|
||||||
return bsp->dvertexes[Face_VertexAtIndex(bsp, f, v)].point;
|
return bsp->dvertexes[Face_VertexAtIndex(bsp, f, v)].point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
TextureName_Contents(const char *texname)
|
||||||
|
{
|
||||||
|
if (!Q_strncasecmp(texname, "sky", 3))
|
||||||
|
return CONTENTS_SKY;
|
||||||
|
else if (!Q_strncasecmp(texname, "*lava", 5))
|
||||||
|
return CONTENTS_LAVA;
|
||||||
|
else if (!Q_strncasecmp(texname, "*slime", 6))
|
||||||
|
return CONTENTS_SLIME;
|
||||||
|
else if (texname[0] == '*')
|
||||||
|
return CONTENTS_WATER;
|
||||||
|
|
||||||
|
return CONTENTS_SOLID;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
Face_Contents(const bsp2_t *bsp, const bsp2_dface_t *face)
|
||||||
|
{
|
||||||
|
const char *texname = Face_TextureName(bsp, face);
|
||||||
|
return TextureName_Contents(texname);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,9 @@ plane_t Face_Plane(const bsp2_t *bsp, const bsp2_dface_t *f);
|
||||||
const miptex_t *Face_Miptex(const bsp2_t *bsp, const bsp2_dface_t *face);
|
const miptex_t *Face_Miptex(const bsp2_t *bsp, const bsp2_dface_t *face);
|
||||||
const char *Face_TextureName(const bsp2_t *bsp, const bsp2_dface_t *face);
|
const char *Face_TextureName(const bsp2_t *bsp, const bsp2_dface_t *face);
|
||||||
const float *GetSurfaceVertexPoint(const bsp2_t *bsp, const bsp2_dface_t *f, int v);
|
const float *GetSurfaceVertexPoint(const bsp2_t *bsp, const bsp2_dface_t *f, int v);
|
||||||
|
int TextureName_Contents(const char *texname);
|
||||||
|
int Face_Contents(const bsp2_t *bsp, const bsp2_dface_t *face);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -197,23 +197,6 @@ static inline bool SphereCullPoint(const faceinfo_t *info, const vec3_t point)
|
||||||
return deltaLengthSquared > info->radiusSquared;
|
return deltaLengthSquared > info->radiusSquared;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
Face_Contents(const bsp2_t *bsp, const bsp2_dface_t *face)
|
|
||||||
{
|
|
||||||
const char *texname = Face_TextureName(bsp, face);
|
|
||||||
|
|
||||||
if (!Q_strncasecmp(texname, "sky", 3))
|
|
||||||
return CONTENTS_SKY;
|
|
||||||
else if (!Q_strncasecmp(texname, "*lava", 5))
|
|
||||||
return CONTENTS_LAVA;
|
|
||||||
else if (!Q_strncasecmp(texname, "*slime", 6))
|
|
||||||
return CONTENTS_SLIME;
|
|
||||||
else if (texname[0] == '*')
|
|
||||||
return CONTENTS_WATER;
|
|
||||||
|
|
||||||
return CONTENTS_SOLID;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Face_MakeInwardFacingEdgePlanes(const bsp2_t *bsp, const bsp2_dface_t *face, plane_t *out)
|
Face_MakeInwardFacingEdgePlanes(const bsp2_t *bsp, const bsp2_dface_t *face, plane_t *out)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue