light: fixes for degenerate faces
This commit is contained in:
parent
014b5265b8
commit
c0b88b7e99
|
|
@ -2760,6 +2760,10 @@ LightFace(const bsp2_t *bsp, bsp2_dface_t *face, facesup_t *facesup, const globa
|
||||||
if (!Q_strcasecmp(texname, "skip"))
|
if (!Q_strcasecmp(texname, "skip"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* don't bother with degenerate faces */
|
||||||
|
if (face->numedges < 3)
|
||||||
|
return;
|
||||||
|
|
||||||
/* all good, this face is going to be lightmapped. */
|
/* all good, this face is going to be lightmapped. */
|
||||||
lightsurf_t *lightsurf = new lightsurf_t {};
|
lightsurf_t *lightsurf = new lightsurf_t {};
|
||||||
lightsurf->cfg = &cfg;
|
lightsurf->cfg = &cfg;
|
||||||
|
|
|
||||||
|
|
@ -150,8 +150,13 @@ const qvec3f GetSurfaceVertexNormal(const bsp2_t *bsp, const bsp2_dface_t *f, co
|
||||||
{
|
{
|
||||||
Q_assert(s_builtPhongCaches);
|
Q_assert(s_builtPhongCaches);
|
||||||
|
|
||||||
const auto &face_normals_vector = vertex_normals.at(f);
|
// handle degenerate faces
|
||||||
return face_normals_vector.at(vertindex);
|
const auto it = vertex_normals.find(f);
|
||||||
|
if (it == vertex_normals.end()) {
|
||||||
|
return qvec3f(0,0,0);
|
||||||
|
}
|
||||||
|
const auto &face_normals_vec = it->second;
|
||||||
|
return face_normals_vec.at(vertindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue