X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpartcache.h;h=969912431271d501b68267f9f09bb7b05f0427b6;hb=HEAD;hp=8099676f95d177ecc3855bf00006db2a3aa11263;hpb=6d9570c97584758e3cfcac6827d439b7fb844cf4;p=libs%2Fgltk.git diff --git a/source/partcache.h b/source/partcache.h index 8099676..a10efdd 100644 --- a/source/partcache.h +++ b/source/partcache.h @@ -1,6 +1,7 @@ #ifndef MSP_GLTK_PARTCACHE_H_ #define MSP_GLTK_PARTCACHE_H_ +#include #include #include #include "mspgltk_api.h" @@ -14,12 +15,7 @@ struct CachedPart { const Part *part = nullptr; const GL::Texture2D *texture = nullptr; - GL::Mesh *mesh = nullptr; - - CachedPart() = default; - CachedPart(CachedPart &&); - CachedPart &operator=(CachedPart &&); - ~CachedPart(); + std::unique_ptr mesh; }; class MSPGLTK_API PartCache @@ -35,13 +31,11 @@ public: ~Rebuild() { cache.end_rebuild(); } }; - typedef std::list PartList; - private: bool rebuilding = false; - PartList parts; - PartList::iterator next; - PartList::iterator current; + std::vector parts; + std::vector::iterator next; + std::vector::iterator current; public: void begin_rebuild(); @@ -49,7 +43,7 @@ public: GL::Mesh &create_mesh(const Part &, const GL::Texture2D &); void end_rebuild(); - const PartList &get_parts() const { return parts; } + const std::vector &get_parts() const { return parts; } }; } // namespace GLtk