Nebula
Loading...
Searching...
No Matches
Terrain::OccupancyQuadTree Class Reference

#include <occupancyquadtree.h>

Classes

struct  Node
 

Public Member Functions

 OccupancyQuadTree ()
 constructor
 
 ~OccupancyQuadTree ()
 destructor
 
void Setup (uint worldSize, uint maxSize, uint minSize)
 setup with a world size and a biggest allocation size
 
Math::uint2 Allocate (uint size)
 allocate a region, return region
 
bool Deallocate (const Math::uint2 coord, uint size)
 deallocate region
 
bool IsOccupied (const Math::uint2 coord, uint size)
 check if region is alloced
 
void DebugRender (ImDrawList *drawList, ImVec2 offset, float scale)
 debug render
 

Private Member Functions

bool RecursiveAllocate (Node *node, uint size, Math::uint2 &outCoord)
 recursively traverse tree to allocate node from tree
 
bool RecursiveDeallocate (Node *node, Math::uint2 coord, uint size)
 recursively traverse tree and deallocate
 
bool RecursiveSearch (Node *node, Math::uint2 coord, uint size)
 recursively traverse tree and find if allocated
 
void RecursiveDebugRender (Node *node, ImDrawList *drawList, ImVec2 offset, float scale)
 recursively debug render
 

Private Attributes

Memory::ArenaAllocator< sizeof(Node) *64 > allocator
 
Util::FixedArray< Util::FixedArray< Node > > topLevelNodes
 
uint minSize
 

Constructor & Destructor Documentation

◆ OccupancyQuadTree()

Terrain::OccupancyQuadTree::OccupancyQuadTree ( )
inline

constructor

◆ ~OccupancyQuadTree()

Terrain::OccupancyQuadTree::~OccupancyQuadTree ( )
inline

destructor

Member Function Documentation

◆ Allocate()

Math::uint2 Terrain::OccupancyQuadTree::Allocate ( uint size)
inline

allocate a region, return region

◆ Deallocate()

bool Terrain::OccupancyQuadTree::Deallocate ( const Math::uint2 coord,
uint size )
inline

deallocate region

◆ DebugRender()

void Terrain::OccupancyQuadTree::DebugRender ( ImDrawList * drawList,
ImVec2 offset,
float scale )
inline

debug render

◆ IsOccupied()

bool Terrain::OccupancyQuadTree::IsOccupied ( const Math::uint2 coord,
uint size )
inline

check if region is alloced

◆ RecursiveAllocate()

bool Terrain::OccupancyQuadTree::RecursiveAllocate ( OccupancyQuadTree::Node * node,
uint size,
Math::uint2 & outCoord )
inlineprivate

recursively traverse tree to allocate node from tree

◆ RecursiveDeallocate()

bool Terrain::OccupancyQuadTree::RecursiveDeallocate ( Node * node,
Math::uint2 coord,
uint size )
inlineprivate

recursively traverse tree and deallocate

◆ RecursiveDebugRender()

void Terrain::OccupancyQuadTree::RecursiveDebugRender ( Node * node,
ImDrawList * drawList,
ImVec2 offset,
float scale )
inlineprivate

recursively debug render

◆ RecursiveSearch()

bool Terrain::OccupancyQuadTree::RecursiveSearch ( Node * node,
Math::uint2 coord,
uint size )
inlineprivate

recursively traverse tree and find if allocated

◆ Setup()

void Terrain::OccupancyQuadTree::Setup ( uint worldSize,
uint maxSize,
uint minSize )
inline

setup with a world size and a biggest allocation size

Member Data Documentation

◆ allocator

Memory::ArenaAllocator<sizeof(Node) * 64> Terrain::OccupancyQuadTree::allocator
private

◆ minSize

uint Terrain::OccupancyQuadTree::minSize
private

◆ topLevelNodes

Util::FixedArray<Util::FixedArray<Node> > Terrain::OccupancyQuadTree::topLevelNodes
private

The documentation for this class was generated from the following file: