diff --git a/dmc/mesh_builder.h b/dmc/mesh_builder.h index 25c159c..41e63e6 100644 --- a/dmc/mesh_builder.h +++ b/dmc/mesh_builder.h @@ -2,8 +2,8 @@ #define MESH_BUILDER_H #include "../utility.h" +#include #include -#include #include namespace dmc { @@ -18,15 +18,17 @@ public: int i = 0; - if (_position_to_index.find(position) != _position_to_index.end()) { + Map::Element *e = _position_to_index.find(position); - i = _position_to_index[position]; + if (e) { + + i = e->get(); ++_reused_vertices; } else { i = _positions.size(); - _position_to_index[position] = i; + _position_to_index.insert(position, i); _positions.push_back(position); _normals.push_back(normal); @@ -44,7 +46,7 @@ private: std::vector _positions; std::vector _normals; std::vector _indices; - std::map _position_to_index; + Map _position_to_index; int _reused_vertices; };