Cycles: Cleanup, move EdgeMap to blender_util
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 10 Feb 2017 12:33:02 +0000 (13:33 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 10 Feb 2017 12:34:10 +0000 (13:34 +0100)
it's better place for such an utility structure. Still not fully ideal tho.

intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_util.h

index 7e527ed625039aa307117e2083c40106607447b3..ebf295ab03f69b4b7f1583e621f00b214a0e4290 100644 (file)
@@ -524,36 +524,6 @@ static void attr_create_uv_map(Scene *scene,
        }
 }
 
-/* TODO(sergey): Move this to some better place? */
-class EdgeMap {
-public:
-       EdgeMap() {
-       }
-
-       void clear() {
-               edges_.clear();
-       }
-
-       void insert(int v0, int v1) {
-               get_sorted_verts(v0, v1);
-               edges_.insert(std::pair<int, int>(v0, v1));
-       }
-
-       bool exists(int v0, int v1) {
-               get_sorted_verts(v0, v1);
-               return edges_.find(std::pair<int, int>(v0, v1)) != edges_.end();
-       }
-
-protected:
-       void get_sorted_verts(int& v0, int& v1) {
-               if(v0 > v1) {
-                       swap(v0, v1);
-               }
-       }
-
-       set< std::pair<int, int> > edges_;
-};
-
 /* Create vertex pointiness attributes. */
 static void attr_create_pointiness(Scene *scene,
                                    Mesh *mesh,
index b67834cdea3d41801821d52de0edace4edb75788..8120de9636246b2bbc8b296413d512f74edd9cbd 100644 (file)
@@ -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<int, int>(v0, v1));
+       }
+
+       bool exists(int v0, int v1) {
+               get_sorted_verts(v0, v1);
+               return edges_.find(std::pair<int, int>(v0, v1)) != edges_.end();
+       }
+
+protected:
+       void get_sorted_verts(int& v0, int& v1) {
+               if(v0 > v1) {
+                       swap(v0, v1);
+               }
+       }
+
+       set< std::pair<int, int> > edges_;
+};
+
 CCL_NAMESPACE_END
 
 #endif /* __BLENDER_UTIL_H__ */