22 class NavHalfEdgeRawPtr;
23 class Stitch1To1EdgeLink;
37 class NavFloorStitcherData
40 NavFloorStitcherData();
42 void Init(NavCell& navCell,
NavFloorIdx floorIdx,
bool getFutureActiveFloorBlob =
false);
43 void Init(
const Stitch1To1EdgeLink& stitch1To1EdgeLink,
bool getFutureActiveFloorBlob =
false);
48 const NavFloorBlob* m_navFloorBlob;
49 const NavHalfEdge* m_halfEdges;
50 const NavVertex* m_navVertexBuffer;
52 NavHalfEdgeRawPtr* m_links;
53 const KyUInt16* m_stitch1To1EdgeIdxToFirstIdxBuffer;
54 const KyUInt16* m_stitch1To1EdgeIdxToCountBuffer;
55 const CompactNavHalfEdgeIdx* m_navHalfEdgeIdxBuffer;
56 const Stitch1To1EdgeLink* m_stitch1To1EdgeLinkBuffer;
59 class NavFloorStitcher
63 NavFloorStitcher(Database* database) : m_altitudeTolerance(0.5f), m_database(database) {}
67 void UnStitchAll1To1EdgeInNavCell(NavCell& navCell);
68 void StitchAllNew1To1EdgeAndTagPotentialRunTimeStitchNeed(
const CellPos& cellPos, NavCellPosInfo* navCellPosInfo);
71 void RetrieveNeighborCellCandidates(
const CellPos& cellPos);
72 void StitchAll1To1EdgeInNavCell(NavCell& navCell);
73 void TryToLinkCellBoundaryStitch1To1EdgeWithCandidates(NavCell* navCell,
KyUInt32 floorIdx,
KyUInt32 stitch1To1EdgeIdx,
74 const EdgeVertices& edgeVertices, KyArrayPOD<NavCell*, MemStat_NavData>& neihgborCellCandidates,
CardinalDir cardinalDirInNeighbor);
75 void TryToLinkFloorBoundaryStitch1To1EdgeWithCandidates(NavCell* navCell,
KyUInt32 floorIdx,
KyUInt32 stitch1To1EdgeIdx,
const EdgeVertices& edgeVertices);
76 bool DoesFloorCauseRuntimeStitchInNeighbor(NavCell* navCell,
KyUInt32 floorIdx);
78 void StitchAllNavFloorsOfNavCell(NavCell& navCell);
79 void StitchAllNavFloorLink(NavCell& navCell,
NavFloorIdx floorIdx);
80 bool CanEdgesStitch(EdgeVertices& currentEdgeVertices, EdgeVertices& candidateEdgeVertices,
NavHalfEdgeType edgeType);
82 void UnStitchAllNavFloorsOfNavCell(NavCell& navCell);
91 KyArrayPOD<NavCell*, MemStat_NavData> m_neihgborCellCandidates[4];
95 KY_INLINE
bool NavFloorStitcher::AreVerticesEqualInAltitude(
KyFloat32 edge1_startAlt,
KyFloat32 edge1_endAlt,
98 const KyFloat32 altitudeDiff1 = fabsf(edge1_startAlt - edge2_endAlt);
99 const KyFloat32 altitudeDiff2 = fabsf(edge1_endAlt - edge2_startAlt);
100 const KyFloat32 operand1 =
Fsel(altitudeDiff1 - altitudeTolerance, 0.f, 1.f);
101 const KyFloat32 operand2 =
Fsel(altitudeDiff2 - altitudeTolerance, 0.f, 1.f);
102 return operand1 * operand2 > 0;
105 template <
class VertexComparator>
109 static bool CanEdgesStitch(
const EdgeVertices& edge1,
const EdgeVertices& edge2,
KyFloat32 altitudeTolerance)
112 VertexComparator::AreVerticesEqual(edge1.m_startVertex, edge2.m_endVertex) &&
113 VertexComparator::AreVerticesEqual(edge1.m_endVertex, edge2.m_startVertex) &&
114 NavFloorStitcher::AreVerticesEqualInAltitude(edge1.m_startAltitude, edge1.m_endAltitude, edge2.m_startAltitude, edge2.m_endAltitude, altitudeTolerance);
118 class Comparator_InFloor
121 static bool AreVerticesEqual(
const Vec2i& vertex1,
const Vec2i& vertex2) {
return vertex1 == vertex2; }
124 class Comparator_OnCellBoundEASTorWEST
127 static bool AreVerticesEqual(
const Vec2i& vertex1,
const Vec2i& vertex2) {
return vertex1.y == vertex2.y; }
130 class Comparator_OnCellBoundNORTHorSOUTH
133 static bool AreVerticesEqual(
const Vec2i& vertex1,
const Vec2i& vertex2) {
return vertex1.x == vertex2.x; }
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
KyUInt32 CardinalDir
Defines a type that refers to one of the cardinal points on the compass:
Definition: cardinaldir.h:15
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
std::uint16_t KyUInt16
uint16_t
Definition: types.h:28
KyUInt32 NavFloorIdx
An index that uniquely identifies a single NavFloor within the set of NavFloors owned by a NavCell...
Definition: navmeshtypes.h:112
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
NavHalfEdgeType
Enumerates the possible types of boundary that can be represented by a NavHalfEdge.
Definition: navmeshtypes.h:49
KyFloat32 Fsel(KyFloat32 a, KyFloat32 x, KyFloat32 y)
x if a>=0.0f, y if a<0.0f>0.0f>
Definition: fastmath.h:19
float KyFloat32
float
Definition: types.h:32