144 for (
uint x = 0; x < this->tiles; x++)
146 for (
uint y = 0; y < this->tiles; y++)
149 uint index = x + y * this->tiles;
155 node->
prev =
nullptr;
156 node->
next =
nullptr;
191 this->
lookup.Add(entry, node);
199 Node* node = this->
lookup.ValueAtIndex(index);
214 while (node !=
nullptr)
220 this->
head =
nullptr;
221 this->
tail =
nullptr;
226 for (
uint y = 0; y < this->tiles; y++)
229 uint index = x + y * this->tiles;
235 node->
prev =
nullptr;
236 node->
next =
nullptr;
254 this->
head =
nullptr;
255 this->
tail =
nullptr;
259 for (
uint y = 0; y < this->tiles; y++)
262 uint index = x + y * this->tiles;
268 node->
prev =
nullptr;
269 node->
next =
nullptr;
283 if (this->
head ==
nullptr)
287 node->
prev =
nullptr;
288 node->
next =
nullptr;
300 newNode->
next = node;
301 if (node->
prev ==
nullptr)
303 newNode->
prev =
nullptr;
304 this->
head = newNode;
311 node->
prev = newNode;
321 if (node->
prev ==
nullptr)
326 if (node->
next ==
nullptr)
331 node->
next =
nullptr;
332 node->
prev =
nullptr;
uint tileSize
Definition texturetilecache.h:107
~TextureTileCache()
destructor
Definition texturetilecache.h:126
TextureTileCache()
constructor
Definition texturetilecache.h:114
void InsertBeginning(Node *node)
insert at beginning of list
Definition texturetilecache.h:281
Node * head
Definition texturetilecache.h:102
void Reset()
Reset the cache without freeing memory.
Definition texturetilecache.h:251
Util::FixedArray< Node > nodes
Definition texturetilecache.h:100
uint tiles
Definition texturetilecache.h:106
Node * tail
Definition texturetilecache.h:103
void Clear()
clear cache
Definition texturetilecache.h:211
CacheResult Cache(TileCacheEntry entry)
get tile, if invalid coord, gets the last used, otherwise, bumps the use of it
Definition texturetilecache.h:168
void Remove(Node *node)
detach node and fix tail & head
Definition texturetilecache.h:318
void Setup(uint tileSize, uint textureSize)
setup cache
Definition texturetilecache.h:134
void InsertBefore(Node *node, Node *newNode)
insert before another node
Definition texturetilecache.h:298
Util::Dictionary< TileCacheEntry, Node * > lookup
Definition texturetilecache.h:104
A collection of key/value pairs with quick value retrieval by key at roughly O(log n).
Definition dictionary.h:34
Implements a fixed size one-dimensional array.
Definition fixedarray.h:20
#define n_assert(exp)
Definition debug.h:50
The occupancy quad tree implements a tree which allows for a quick search.
Definition occupancyquadtree.h:17
static const TileCacheEntry InvalidTileCacheEntry
Definition texturetilecache.h:59
Nebula's scalar datatype.
Definition texturetilecache.h:18
uint physicalOffsetY
Definition texturetilecache.h:21
uint physicalOffsetX
Definition texturetilecache.h:20
uint mip
Definition texturetilecache.h:19
Definition texturetilecache.h:66
Math::uint2 cached
Definition texturetilecache.h:67
TileCacheEntry evicted
Definition texturetilecache.h:69
bool didCache
Definition texturetilecache.h:68
Definition texturetilecache.h:86
Node * next
Definition texturetilecache.h:90
Math::uint2 offset
Definition texturetilecache.h:88
Node * prev
Definition texturetilecache.h:89
TileCacheEntry entry
Definition texturetilecache.h:87
Definition texturetilecache.h:29
uint64_t tileX
Definition texturetilecache.h:31
uint64_t tileY
Definition texturetilecache.h:32
uint64_t tiles
Definition texturetilecache.h:30
uint64_t subTextureIndex
Definition texturetilecache.h:33
Definition texturetilecache.h:27
bool operator>(const TileCacheEntry &rhs) const
Definition texturetilecache.h:41
bool operator!=(const TileCacheEntry &rhs) const
Definition texturetilecache.h:53
Entry entry
Definition texturetilecache.h:37
uint64_t hash
Definition texturetilecache.h:38
bool operator<(const TileCacheEntry &rhs) const
Definition texturetilecache.h:45
bool operator==(const TileCacheEntry &rhs) const
Definition texturetilecache.h:49
static const int InvalidIndex
Definition types.h:47
unsigned int uint
Definition types.h:33
int IndexT
Definition types.h:41