2015-05-22 10:01:59 -05:00
|
|
|
#pragma once
|
2015-05-27 07:50:12 -05:00
|
|
|
#include <cstddef>
|
2015-05-22 10:01:59 -05:00
|
|
|
#include "cvfObject.h"
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
class RivGeoMechPartMgr;
|
|
|
|
|
|
|
|
class RivGeoMechPartMgrCache : public cvf::Object
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RivGeoMechPartMgrCache();
|
|
|
|
~RivGeoMechPartMgrCache();
|
|
|
|
|
|
|
|
class Key
|
|
|
|
{
|
|
|
|
public:
|
2015-06-18 02:13:45 -05:00
|
|
|
Key() : m_geometryType(-1), m_frameIndex(-1) {}
|
|
|
|
|
|
|
|
Key( unsigned short aGeometryType, int aFrameIndex);
|
|
|
|
|
|
|
|
void set(unsigned short aGeometryType, int aFrameIndex);
|
|
|
|
|
|
|
|
int frameIndex() const { return m_frameIndex;}
|
|
|
|
unsigned short geometryType() const { return m_geometryType; }
|
|
|
|
|
|
|
|
bool operator< (const Key& other) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_frameIndex;
|
|
|
|
unsigned short m_geometryType;
|
2015-05-22 10:01:59 -05:00
|
|
|
};
|
|
|
|
|
2015-06-18 02:13:45 -05:00
|
|
|
bool needsRegeneration (const Key& key);
|
|
|
|
void scheduleRegeneration (const Key& key);
|
|
|
|
void generationFinished (const Key& key);
|
|
|
|
RivGeoMechPartMgr* partMgr (const Key& key);
|
2015-05-22 10:01:59 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
class CacheEntry
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CacheEntry() : needsRegen(true) {}
|
|
|
|
|
|
|
|
bool needsRegen;
|
|
|
|
cvf::ref<RivGeoMechPartMgr> partMgr;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::map<Key, CacheEntry > m_partMgrs;
|
|
|
|
};
|
|
|
|
|