X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpartcache.h;h=969912431271d501b68267f9f09bb7b05f0427b6;hb=HEAD;hp=4eef1166d1d9e75f0bc39bd27b087350e8cbf3c1;hpb=01d30637b393b2f8a932b1d943076db580b1e951;p=libs%2Fgltk.git diff --git a/source/partcache.h b/source/partcache.h index 4eef116..a10efdd 100644 --- a/source/partcache.h +++ b/source/partcache.h @@ -1,8 +1,10 @@ #ifndef MSP_GLTK_PARTCACHE_H_ #define MSP_GLTK_PARTCACHE_H_ +#include #include #include +#include "mspgltk_api.h" namespace Msp { namespace GLtk { @@ -11,15 +13,12 @@ class Part; struct CachedPart { - const Part *part; - const GL::Texture2D *texture; - GL::Mesh *mesh; - - CachedPart(); - ~CachedPart(); + const Part *part = nullptr; + const GL::Texture2D *texture = nullptr; + std::unique_ptr mesh; }; -class PartCache +class MSPGLTK_API PartCache { public: class Rebuild @@ -32,23 +31,19 @@ public: ~Rebuild() { cache.end_rebuild(); } }; - typedef std::list PartList; - private: - bool rebuilding; - PartList parts; - PartList::iterator next; - PartList::iterator current; + bool rebuilding = false; + std::vector parts; + std::vector::iterator next; + std::vector::iterator current; public: - PartCache(); - void begin_rebuild(); void insert_special(const Part &); 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