1 #ifndef MSP_GLTK_PARTCACHE_H_
2 #define MSP_GLTK_PARTCACHE_H_
5 #include <msp/gl/mesh.h>
6 #include <msp/gl/texture2d.h>
7 #include "mspgltk_api.h"
16 const Part *part = nullptr;
17 const GL::Texture2D *texture = nullptr;
18 std::unique_ptr<GL::Mesh> mesh;
21 class MSPGLTK_API PartCache
30 Rebuild(PartCache &c): cache(c) { cache.begin_rebuild(); }
31 ~Rebuild() { cache.end_rebuild(); }
35 bool rebuilding = false;
36 std::vector<CachedPart> parts;
37 std::vector<CachedPart>::iterator next;
38 std::vector<CachedPart>::iterator current;
42 void insert_special(const Part &);
43 GL::Mesh &create_mesh(const Part &, const GL::Texture2D &);
46 const std::vector<CachedPart> &get_parts() const { return parts; }