9 #ifndef GwNavGen_InputTileInfoGrid_H
10 #define GwNavGen_InputTileInfoGrid_H
21 class GeneratorSystem;
22 class GeneratorSectorBuilder;
25 typedef Vec2i TilePos;
27 class InputTileContributionAtPos
30 friend class InputTileCache;
37 InputTileInfo() : m_sectorBuilder(
KY_NULL), m_inputTileBlob(KY_NULL) {}
38 InputTileInfo(GeneratorSectorBuilder* sectorBuilder) : m_sectorBuilder(sectorBuilder), m_inputTileBlob(
KY_NULL) {}
39 InputCellBlob* GetInputCellBlob(
const CellPos& cellPos)
const
41 KY_ASSERT(m_inputTileBlob !=
KY_NULL);
42 return m_inputTileBlob->GetInputCellBlob(cellPos);
45 GeneratorSectorBuilder* m_sectorBuilder;
46 InputTileBlob* m_inputTileBlob;
53 void Init(
KyUInt32 inputTileSizeInNbCells);
55 void AddCellContribution(
const CellPos& cellPos, GeneratorSectorBuilder* sectorBuilder);
57 const TilePos& GetTilePos()
const {
return m_tilePos; }
58 const CellBox& GetTileCellBox()
const {
return m_tileCellBox; }
61 void GetInputCellBlobsAtCellPos(
const CellPos& cellPos, KyArrayPOD<const InputCellBlob*>& inputCellBlob);
66 void ClearInputTileBlobs();
71 KyArray<InputTileInfo> m_inputTileInfos;
72 KyArray<KyArray<GeneratorSectorBuilder*> > m_contributingSectorRowMajorMatrix;
76 class InputTileCacheEntry
81 InputTileCacheEntry() : m_sectorBuilder(
KY_NULL) {}
83 bool operator==(
const InputTileCacheEntry& other)
85 return m_sectorBuilder == other.m_sectorBuilder
86 && m_tilePos == other.m_tilePos;
90 GeneratorSectorBuilder* m_sectorBuilder;
92 Ptr<BlobHandler<InputTileBlob> > m_inputTileBlobHandler;
104 InputTileCache(GeneratorSystem* sys,
KyUInt32 memoryLimitInMegaBytes = 100)
106 , m_memoryLimitInMegaBytes(memoryLimitInMegaBytes)
107 , m_currentMemoryUsageInMegaBytes(0)
110 KyResult Load(InputTileContributionAtPos& inputTileContributionAtPos);
115 InputTileBlob* Load(GeneratorSectorBuilder* sectorBuilder,
const TilePos& tilePos);
121 GeneratorSystem* m_sys;
123 KyUInt32 m_currentMemoryUsageInMegaBytes;
125 KyArray<InputTileCacheEntry> m_entries;
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:34
Vec2i CellPos
A type that represents the position of a cell within a 2D grid.
Definition: navmeshtypes.h:33
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
#define KY_NULL
Null value.
Definition: types.h:247
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36