Cycles: Cleanup, move EdgeMap to blender_util

it's better place for such an utility structure. Still not fully ideal tho.
This commit is contained in:
Sergey Sharybin 2017-02-10 13:33:02 +01:00
parent 0178915ce9
commit cd4309ced0
2 changed files with 30 additions and 30 deletions

View 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,

View 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__ */