Sun, 03 Jul 2022 13:44:11 +0300
Extract the triangulation and triangle merging code into a new source file and clean it up somewhat
#pragma once #include "src/basics.h" #include "src/model.h" #include "src/gl/common.h" #include "src/documentmanager.h" template<typename T> struct WithId : T { ElementId id; }; struct GetPolygonsContext { ModelId modelId; class DocumentManager* documents; }; struct PolygonCache { using vector_type = std::vector<WithId<PolygonElement>>; vector_type polygons; bool needRecache = true; }; void recacheIfNeeded( PolygonCache* cache, Model* model, class DocumentManager* documents); PolygonCache* findPolygonCacheForModel(Model* model, DocumentManager* context);