Tue, 27 Jul 2021 13:23:34 +0300
Add vertex map
#include "vertexmap.h" #include "linetypes/polygonobject.h" VertexMap::VertexMap(const Model *model) : model{model} { connect( model, &Model::dataChanged, this, &VertexMap::build ); connect( model, &Model::rowsInserted, this, &VertexMap::build ); connect( model, &Model::rowsRemoved, this, &VertexMap::build ); this->build(); } void VertexMap::build() { this->map.clear(); this->model->apply<ldraw::Object>([&](const ldraw::Object* object) { for (int i = 0; i < object->numPoints(); i += 1) { const glm::vec3& point = object->getPoint(i); this->map[qHash(point)].insert(object->id); } }); }