gwnavruntime/querysystem/workingmemcontainers/trianglestatusingrid.h Source File
Go to the documentation of this file.
17 class TriangleStatusInGrid
20 typedef BitFieldInBuffer FloorBits;
21 typedef ArrayInBuffer<FloorBits> CellBits;
24 TriangleStatusInGrid(WorkingMemory* workingMemory,
const CellBox& cellBox) : m_allocBuffer(workingMemory), m_cellBox(cellBox)
32 CellBits* AllocCellBitsArray(
KyUInt32 numberOfNavCell)
34 CellBits* ptr = m_allocBuffer.AllocInBuffer<CellBits>(numberOfNavCell, 0xFF);
35 m_cellBitsArrayOffset = m_allocBuffer.GetOffset(ptr);
38 CellBits* GetCellBitsArray()
const {
return m_allocBuffer.GetPtr<CellBits>(m_cellBitsArrayOffset); }
39 CellBits* GetCellBits(
const CellPos& cellPos)
const {
return GetCellBitsArray() + m_cellBox.GetRowMajorIndex(cellPos); }
42 FloorBits* AllocFloorBitsArray(
KyUInt32 numberOfFloors) {
return m_allocBuffer.AllocInBuffer<FloorBits>(numberOfFloors, 0xFF); }
44 TraversalResult OpenNodeIfNew(ActiveData& activeData,
const NavTriangleRawPtr& triangleRawPtr,
bool& nodeWasNew);
46 bool IsTriangleOpen(
const NavTriangleRawPtr& triangleRawPtr)
const;
47 bool IsTriangleOpen_Unsafe(
const NavTriangleRawPtr& triangleRawPtr)
const;
49 bool IsInitialized()
const {
return m_allocBuffer.IsInitialized(); }
51 void ReleaseWorkingMemoryBuffer() { m_allocBuffer.ReleaseWorkingMemoryBuffer(); }
54 AllocatorBuffer m_allocBuffer;
59 KY_INLINE
bool TriangleStatusInGrid::IsTriangleOpen_Unsafe(
const NavTriangleRawPtr& triangleRawPtr)
const
61 KY_DEBUG_ASSERTN(m_cellBox.DoesContain(triangleRawPtr.GetCellPos()), (
"Invalid CellBox"));
63 NavFloor* navFloor = triangleRawPtr.GetNavFloor();
64 const CellPos& cellPos = navFloor->GetCellPos();
66 CellBits* cellBits = GetCellBits(cellPos);
67 KY_DEBUG_ASSERTN(cellBits->IsValid(), (
"Unsafe mode, it should never happen"));
69 FloorBits* floorBits = cellBits->Get(navFloor->GetIndexInCollection());
70 KY_DEBUG_ASSERTN(floorBits->IsValid(), (
"Unsafe mode, it should never happen"));
72 return floorBits->IsBitSet(triangleRawPtr.GetTriangleIdx());
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:31
Vec2i CellPos
A type that represents the position of a cell within a 2D grid.
Definition: navmeshtypes.h:30
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17