From 501fb9ee403d45acc7b536963c40064c8dd0a492 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sun, 19 Nov 2017 23:47:29 -0700 Subject: [PATCH] light: add FacesUsingVert --- include/light/phong.hh | 1 + light/phong.cc | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/light/phong.hh b/include/light/phong.hh index 9c9aa360..983b26bb 100644 --- a/include/light/phong.hh +++ b/include/light/phong.hh @@ -46,6 +46,7 @@ const bsp2_dface_t *Face_EdgeIndexSmoothed(const mbsp_t *bsp, const bsp2_dface_t /// 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::vector>; +std::vector FacesUsingVert(int vertnum); const edgeToFaceMap_t &GetEdgeToFaceMap(); class face_cache_t { diff --git a/light/phong.cc b/light/phong.cc index 2c848b22..7a97556d 100644 --- a/light/phong.cc +++ b/light/phong.cc @@ -76,6 +76,16 @@ static map> planesToFaces; static edgeToFaceMap_t EdgeToFaceMap; static vector FaceCache; +vector FacesUsingVert(int vertnum) +{ + const auto &vertsToFaces_const = vertsToFaces; + + auto it = vertsToFaces_const.find(vertnum); + if (it != vertsToFaces_const.end()) + return it->second; + return {}; +} + const edgeToFaceMap_t &GetEdgeToFaceMap() { Q_assert(s_builtPhongCaches);