fix for Q2 phong values not applying properly

(cherry picked from commit 0d76e62846)
This commit is contained in:
Jonathan 2022-07-06 19:32:33 -04:00
parent 6e43004b36
commit 14455e97e6
3 changed files with 3 additions and 2 deletions

View File

@ -49,6 +49,7 @@ bool FacesSmoothed(const mface_t *f1, const mface_t *f2);
const std::set<const mface_t *> &GetSmoothFaces(const mface_t *face);
const std::vector<const mface_t *> &GetPlaneFaces(const mface_t *face);
const mface_t *Face_EdgeIndexSmoothed(const mbsp_t *bsp, const mface_t *f, const int edgeindex);
int Q2_FacePhongValue(const mbsp_t *bsp, const mface_t *face);
/// a directed edge can be used by more than one face, e.g. two cube touching just along an edge
using edgeToFaceMap_t = std::map<std::pair<int, int>, std::vector<const mface_t *>>;

View File

@ -874,7 +874,7 @@ static std::unique_ptr<lightsurf_t> Lightsurf_Init(
lightsurf->lightmapscale = (facesup && facesup->lmscale > modelinfo->lightmapscale) ? facesup->lmscale : modelinfo->lightmapscale;
const surfflags_t &extended_flags = extended_texinfo_flags[face->texinfo];
lightsurf->curved = extended_flags.phong_angle != 0;
lightsurf->curved = extended_flags.phong_angle != 0 || Q2_FacePhongValue(bsp, face);
// nodirt
if (modelinfo->dirt.isChanged()) {

View File

@ -389,7 +389,7 @@ static vector<face_cache_t> MakeFaceCache(const mbsp_t *bsp)
* Q2: Returns nonzero if phong is requested on this face, in which case that is
* the face tag to smooth with. Otherwise returns 0.
*/
static int Q2_FacePhongValue(const mbsp_t *bsp, const mface_t *face)
int Q2_FacePhongValue(const mbsp_t *bsp, const mface_t *face)
{
const mtexinfo_t *texinfo = BSP_GetTexinfo(bsp, face->texinfo);
if (texinfo != nullptr) {