#include <msp/gl/mesh.h>
#include <msp/gl/texture2d.h>
+#include "mspgltk_api.h"
namespace Msp {
namespace GLtk {
struct CachedPart
{
- const Part *part;
- const GL::Texture2D *texture;
- GL::Mesh *mesh;
+ const Part *part = nullptr;
+ const GL::Texture2D *texture = nullptr;
+ GL::Mesh *mesh = nullptr;
- CachedPart();
~CachedPart();
};
-class PartCache
+class MSPGLTK_API PartCache
{
public:
+ class Rebuild
+ {
+ private:
+ PartCache &cache;
+
+ public:
+ Rebuild(PartCache &c): cache(c) { cache.begin_rebuild(); }
+ ~Rebuild() { cache.end_rebuild(); }
+ };
+
typedef std::list<CachedPart> PartList;
private:
+ bool rebuilding = false;
PartList parts;
PartList::iterator next;
PartList::iterator current;