From cd4309ced0e65e7800bfd17b5869daf40b8dc601 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 10 Feb 2017 13:33:02 +0100 Subject: Cycles: Cleanup, move EdgeMap to blender_util it's better place for such an utility structure. Still not fully ideal tho. --- intern/cycles/blender/blender_util.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'intern/cycles/blender/blender_util.h') diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index b67834cdea3..8120de96362 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -19,6 +19,7 @@ #include "mesh.h" +#include "util_algorithm.h" #include "util_map.h" #include "util_path.h" #include "util_set.h" @@ -786,6 +787,35 @@ struct ParticleSystemKey { } }; +class EdgeMap { +public: + EdgeMap() { + } + + void clear() { + edges_.clear(); + } + + void insert(int v0, int v1) { + get_sorted_verts(v0, v1); + edges_.insert(std::pair(v0, v1)); + } + + bool exists(int v0, int v1) { + get_sorted_verts(v0, v1); + return edges_.find(std::pair(v0, v1)) != edges_.end(); + } + +protected: + void get_sorted_verts(int& v0, int& v1) { + if(v0 > v1) { + swap(v0, v1); + } + } + + set< std::pair > edges_; +}; + CCL_NAMESPACE_END #endif /* __BLENDER_UTIL_H__ */ -- cgit v1.2.3