gwnavruntime/navmesh/blobs/navfloorblob.h Source File

navfloorblob.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 #pragma once
9 
16 
17 namespace Kaim
18 {
19 
22 {
23 public:
24  NavFloorAABB() {}
25 
27  bool DoesIntersect(const NavFloorAABB& other) const;
28 
29  NavVertex m_min;
30  NavVertex m_max;
31 };
32 
33 
39 {
40  KY_ROOT_BLOB_CLASS(NavData, NavFloorBlob, 0)
42 public:
43  NavFloorBlob();
44 
45  // ---------------------------------- static member functions ----------------------------------
46 
48 
53 
58 
62 
63  // ---------- accessors ----------
64 
65  KyUInt32 GetNavVertexCount() const;
66  KyUInt32 GetNavHalfEdgeCount() const;
67  KyUInt32 GetNavTriangleCount() const;
68 
69  const FloorAltitudeRange& GetFloorAltitudeRange() const;
70  const NavTag& GetNavTag(NavTriangleIdx navTriangleIdx) const;
71  const NavVertex& GetNavVertex(const NavVertexIdx idx) const;
72  const NavHalfEdge& GetNavHalfEdge(NavHalfEdgeIdx idx) const;
76 
77  // ---------- function to browse the NavFloorBlob data structure ----------
78 
79  const NavVertex& NavHalfEdgeIdxToStartNavVertex(NavHalfEdgeIdx idx) const;
81 
82  const NavVertex& NavHalfEdgeIdxToEndNavVertex(NavHalfEdgeIdx idx) const;
84 
85  const NavVertex& NavHalfEdgeIdxToThirdNavVertex(NavHalfEdgeIdx idx) const;
87 
90 
93 
97  const NavHalfEdge& NavTriangleIdxToNavHalfEdge(NavTriangleIdx idx, const KyInt32 halfEdgeNumber) const;
98 
104  void NavTriangleIdxToNavVertexIndices(NavTriangleIdx triangleIdx, NavVertexIdx& v0Idx, NavVertexIdx& v1Idx, NavVertexIdx& v2Idx) const;
105 
109  const NavVertex& NavTriangleIdxToNavVertex(NavTriangleIdx idx, const KyInt32 vertexNumber) const;
110 
114  NavVertexIdx NavTriangleIdxToVertexIdx(NavTriangleIdx idx, const KyInt32 vertexNumber) const;
115 
116  // ---------- geometrical test ----------
117 
119  bool IsPointInsideFloor(const CoordPos64& coordPos64, const CoordPos64& cellOrigin) const;
120 
122  bool IsPointInsideFloor(const CoordPos& coordPosInCell) const;
123 
124 public: // internal
125  KyUInt32 GetNavConnexCount() const;
127 
128  bool IsValid() const;
129  bool IsTriangleValid(NavTriangleIdx idx) const;
130 
131  bool IsHalfEdgeValid(NavHalfEdgeIdx currentEdgeIdx, const Vec2i &v1, const Vec2i &v2) const;
132 
133  KyUInt32 GetNavFloorLinkCount() const;
134  KyUInt32 GetStitch1To1EdgeCount() const;
135 
136 public:
144 
145  Stitch1To1ToHalfEdgeInFloor m_stitch1To1ToHalfEdgeInFloor;
146 };
147 
148 
149 KY_INLINE void SwapEndianness(Endianness::Target e, NavFloorAABB& self)
150 {
151  SwapEndianness(e, self.m_min);
152  SwapEndianness(e, self.m_max);
153 }
154 KY_INLINE void SwapEndianness(Endianness::Target e, NavFloorBlob& self)
155 {
156  SwapEndianness(e, self.m_triangleConnexIndices);
157  SwapEndianness(e, self.m_connexNavTag);
158  SwapEndianness(e, self.m_navHalfEdges);
159  SwapEndianness(e, self.m_navVertices);
160  SwapEndianness(e, self.m_navVerticesAltitudes);
161 
162  SwapEndianness(e, self.m_altitudeRange);
163  SwapEndianness(e, self.m_navFloorAABB);
164  SwapEndianness(e, self.m_stitch1To1ToHalfEdgeInFloor);
165 }
166 
167 }
168 
170 
171 
172 
bool IsTriangleValid(NavTriangleIdx idx) const
performs some basic tests on static data. For internal debug purpose.
Definition: navfloorblob.cpp:30
Represents the range of altitudes covered by a single NavFloorBlob.
Definition: flooraltituderange.h:15
const NavVertex & NavTriangleIdxToNavVertex(NavTriangleIdx idx, const KyInt32 vertexNumber) const
Retrieves one vertex from the specified triangle.
Definition: navfloorblob.inl:100
KyUInt32 NavTriangleIdx
An index that uniquely identifies a single triangle within the set of triangles owned by a NavFloor...
Definition: navmeshtypes.h:97
KyUInt32 NavConnexIdx
An index that uniquely identifies a single triangle within the set of triangles owned by a NavFloor...
Definition: navmeshtypes.h:107
NavHalfEdgeType GetHalfEdgeType(NavHalfEdgeIdx idx) const
Retrieves the type of the specified triangle edge.
Definition: navfloorblob.inl:73
const NavVertex & NavHalfEdgeIdxToStartNavVertex(NavHalfEdgeIdx idx) const
Retrieves the vertex at the start of the specified triangle edge.
Definition: navfloorblob.inl:75
const NavHalfEdge & GetNavHalfEdge(NavHalfEdgeIdx idx) const
Retrieves the triangle edge with the specified index within this NavFloorBlob.
Definition: navfloorblob.inl:67
static NavHalfEdgeIdx NavHalfEdgeIdxToPrevNavHalfEdgeIdx(NavHalfEdgeIdx idx)
Retrieves the triangle NavHalfEdgeIdx that precedes the edge specified the input NavHalfEdgeIdx withi...
Definition: navfloorblob.inl:32
The NavFloorBlob contains a connected and not overlapping part of triangle mesh static data within a ...
Definition: navfloorblob.h:38
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
NavFloorAABB m_navFloorAABB
An axis-oriented bounding box that stores the extents of this NavFloorBlob.
Definition: navfloorblob.h:143
NavConnexIdx NavTriangleIdxToNavConnexIdx(NavTriangleIdx idx) const
Retrieves the index of the NavConnex associated to the triangle specified by the input NavTriangleIdx...
Definition: navfloorblob.inl:109
KyUInt32 NavHalfEdgeIdx
An index that uniquely identifies a single edge of a triangle within the set of edges owned by a NavF...
Definition: navmeshtypes.h:84
const NavHalfEdge & NavTriangleIdxToNavHalfEdge(NavTriangleIdx idx, const KyInt32 halfEdgeNumber) const
Retrieves one edge from the specified triangle.
Definition: navfloorblob.inl:87
static NavHalfEdgeIdx NavTriangleIdxToFirstNavHalfEdgeIdx(NavTriangleIdx idx)
Retrieves the first NavHalfEdgeIdx of NavTriangle specified by the input NavTriangleIdx.
Definition: navfloorblob.inl:23
KyFloat32 GetNavVertexAltitude(const NavVertexIdx idx) const
Retrieves the altitude of the vertex with the specified index within this NavFloorBlob.
Definition: navfloorblob.inl:61
BlobArray< NavTag > m_connexNavTag
The array of NavTag associated to each NavConnex. GetCount() == GetConnexCount(). Do not modify...
Definition: navfloorblob.h:138
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
NavVertexIdx NavTriangleIdxToVertexIdx(NavTriangleIdx idx, const KyInt32 vertexNumber) const
Retrieves the index of one vertex from the specified triangle.
Definition: navfloorblob.inl:101
2d vector using KyInt64
Definition: vec2ll.h:18
static KyUInt32 NavHalfEdgeIdxToHalfEdgeNumberInTriangle(NavHalfEdgeIdx idx)
Retrieves the index of the specified edge within its triangle.
Definition: navfloorblob.inl:38
static NavHalfEdgeIdx NavHalfEdgeIdxToNextNavHalfEdgeIdx(NavHalfEdgeIdx idx)
Retrieves the triangle NavHalfEdgeIdx that follows the edge specified the input NavHalfEdgeIdx within...
Definition: navfloorblob.inl:26
const NavHalfEdge & NavHalfEdgeIdxToPairNavHalfEdge(NavHalfEdgeIdx idx) const
Retrieves the triangle edge that is adjacent to the specified triangle edge, if any.
Definition: navfloorblob.inl:79
static NavHalfEdgeIdx NavHalfEdgeIdxToFirstNavHalfEdgeIdx(NavHalfEdgeIdx idx)
Retrieves the first NavHalfEdgeIdx of NavTriangle thet contains the edge specified by the input NavHa...
Definition: navfloorblob.inl:24
NavHalfEdgeObstacleType
Enumerates the possible types of obstacles that can be represented by a NavHalfEdge whose type is EDG...
Definition: navmeshtypes.h:42
bool DoesIntersect(const NavFloorAABB &other) const
Indicates whether or not the bounding box represented by this object intersects the specified NavFloo...
Definition: navfloorblob.inl:9
bool IsValid() const
performs some basic tests on static data. For internal debug purpose.
Definition: navfloorblob.cpp:13
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
The NavData class is the object containing navigation data that will be added to one Database...
Definition: navdata.h:39
Represents the integer axis-aligned bounding box of a NavFloor.
Definition: navfloorblob.h:21
const NavVertex & NavHalfEdgeIdxToThirdNavVertex(NavHalfEdgeIdx idx) const
Retrieves the vertex in the triangle that is not connected to the specified triangle edge...
Definition: navfloorblob.inl:78
const NavVertex & NavHalfEdgeIdxToEndNavVertex(NavHalfEdgeIdx idx) const
Retrieves the vertex at the end of the specified triangle edge.
Definition: navfloorblob.inl:77
NavHalfEdgeIdx NavHalfEdgeIdxToPairNavHalfEdgeIdx(NavHalfEdgeIdx idx) const
Retrieves the index of the triangle edge that is adjacent to the specified triangle edge...
Definition: navfloorblob.inl:80
NavVertexIdx NavHalfEdgeIdxToThirdNavVertexIdx(NavHalfEdgeIdx idx) const
Retrieves the index of the vertex in the triangle that is not connected to the specified triangle edg...
Definition: navfloorblob.inl:83
2d vector using KyInt32
Definition: vec2i.h:18
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
static NavTriangleIdx NavHalfEdgeIdxToTriangleIdx(NavHalfEdgeIdx idx)
Retrieves the index of the triangle that contains the edge specified the input NavHalfEdgeIdx.
Definition: navfloorblob.inl:22
NavVertex m_max
The maxima of the axis-aligned bounding box computed during NavData generation. Do not modify...
Definition: navfloorblob.h:30
BlobArray< KyFloat32 > m_navVerticesAltitudes
The array of triangle vertices altitude maintained by the NavFloorBlob. GetCount() == GetVertexCount(...
Definition: navfloorblob.h:141
KyUInt32 NavVertexIdx
An index that uniquely identifies a single vertex of a triangle within the set of vertices owned by a...
Definition: navmeshtypes.h:72
const NavTag & GetNavTag(NavTriangleIdx navTriangleIdx) const
Retrieves the NavTag associated to this triangle.
Definition: navfloorblob.inl:49
Each instance of NavHalfEdge represents a single edge of a single triangle within the NavMesh...
Definition: navhalfedge.h:17
std::int32_t KyInt32
int32_t
Definition: types.h:24
static NavHalfEdgeIdx NavTriangleIdxToNavHalfEdgeIdx(NavTriangleIdx idx, KyInt32 halfEdgeNumber)
Retrieves one edge from the specified triangle.
Definition: navfloorblob.inl:25
BlobArray< NavHalfEdge > m_navHalfEdges
The array of triangle edges maintained by the NavFloorBlob. GetCount() == GetHalfEdgeCount(). Do not modify.
Definition: navfloorblob.h:139
const NavHalfEdge & NavHalfEdgeIdxToPrevNavHalfEdge(NavHalfEdgeIdx idx) const
Retrieves the edge that precedes the specified triangle edge within its triangle. ...
Definition: navfloorblob.inl:85
NavHalfEdgeType
Enumerates the possible types of boundary that can be represented by a NavHalfEdge.
Definition: navmeshtypes.h:49
void NavTriangleIdxToNavVertexIndices(NavTriangleIdx triangleIdx, NavVertexIdx &v0Idx, NavVertexIdx &v1Idx, NavVertexIdx &v2Idx) const
Retrieves the indices of the vertices that make up the specified triangle.
Definition: navfloorblob.inl:89
FloorAltitudeRange m_altitudeRange
The range of altitude the vertices of this NavFloor are within.
Definition: navfloorblob.h:142
NavHalfEdgeObstacleType GetHalfEdgeObstacleType(NavHalfEdgeIdx idx) const
Retrieves the obstacle type of the specified triangle edge.
Definition: navfloorblob.inl:74
BlobArray< CompactNavConnexIdx > m_triangleConnexIndices
The array of CompactNavConnexIdx associated to each triangle. GetCount() == GetTriangleCount(). Do not modify.
Definition: navfloorblob.h:137
const NavHalfEdge & NavHalfEdgeIdxToNextNavHalfEdge(NavHalfEdgeIdx idx) const
Retrieves the edge that follows the specified triangle edge within its triangle.
Definition: navfloorblob.inl:84
NavVertexIdx NavHalfEdgeIdxToStartNavVertexIdx(NavHalfEdgeIdx idx) const
Retrieves the index of the vertex at the start of the specified triangle edge.
Definition: navfloorblob.inl:76
const NavVertex & GetNavVertex(const NavVertexIdx idx) const
Retrieves the vertex with the specified index within this NavFloorBlob.
Definition: navfloorblob.inl:55
NavVertex m_min
The minima of the axis-aligned bounding box computed during NavData generation. Do not modify...
Definition: navfloorblob.h:29
bool IsPointInsideFloor(const CoordPos64 &coordPos64, const CoordPos64 &cellOrigin) const
Indicates whether or not the specified position lies inside the bounding box of the NavFloorBlob on t...
Definition: navfloorblob.inl:115
float KyFloat32
float
Definition: types.h:32
BlobArray< NavVertex > m_navVertices
The array of triangle vertices maintained by the NavFloorBlob. GetCount() == GetVertexCount(). Do not modify.
Definition: navfloorblob.h:140
NavVertexIdx NavHalfEdgeIdxToEndNavVertexIdx(NavHalfEdgeIdx idx) const
Retrieves the index of the vertex at the end of the specified triangle edge.
Definition: navfloorblob.inl:82