gwnavruntime/navmesh/blobs/navfloorblob.h Source File

navfloorblob.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 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 // Primary contact: JUBA - secondary contact: LASI
9 #ifndef Navigation_NavFloorBlob_H
10 #define Navigation_NavFloorBlob_H
11 
18 
19 namespace Kaim
20 {
21 
24 {
25 public:
26  NavFloorAABB() {}
27 
29  bool DoesIntersect(const NavFloorAABB& other) const;
30 
33 };
34 
35 
40 class NavFloorBlob
41 {
42  KY_ROOT_BLOB_CLASS(NavData, NavFloorBlob, 0)
44 public:
45  NavFloorBlob();
46 
47  // ---------------------------------- static member functions ----------------------------------
48 
50 
55 
60 
64 
65  // ---------- accessors ----------
66 
67  KyUInt32 GetNavVertexCount() const;
68  KyUInt32 GetNavHalfEdgeCount() const;
69  KyUInt32 GetNavTriangleCount() const;
70 
71  const FloorAltitudeRange& GetFloorAltitudeRange() const;
72  const NavTag& GetNavTag(NavTriangleIdx navTriangleIdx) const;
73  const NavVertex& GetNavVertex(const NavVertexIdx idx) const;
74  const NavHalfEdge& GetNavHalfEdge(NavHalfEdgeIdx idx) const;
78 
79  // ---------- function to browse the NavFloorBlob data structure ----------
80 
83 
86 
89 
92 
95 
99  const NavHalfEdge& NavTriangleIdxToNavHalfEdge(NavTriangleIdx idx, const KyInt32 halfEdgeNumber) const;
100 
106  void NavTriangleIdxToNavVertexIndices(NavTriangleIdx triangleIdx, NavVertexIdx& v0Idx, NavVertexIdx& v1Idx, NavVertexIdx& v2Idx) const;
107 
111  const NavVertex& NavTriangleIdxToNavVertex(NavTriangleIdx idx, const KyInt32 vertexNumber) const;
112 
116  NavVertexIdx NavTriangleIdxToVertexIdx(NavTriangleIdx idx, const KyInt32 vertexNumber) const;
117 
118  // ---------- geometrical test ----------
119 
121  bool IsPointInsideFloor(const CoordPos64& coordPos64, const CoordPos64& cellOrigin) const;
122 
124  bool IsPointInsideFloor(const CoordPos& coordPosInCell) const;
125 
126 public: // Internal
127  KyUInt32 GetNavConnexCount() const;
129 
130  bool IsValid() const;
131  bool IsTriangleValid(NavTriangleIdx idx) const;
132 
133  bool IsHalfEdgeValid(NavHalfEdgeIdx currentEdgeIdx, const Vec2i &v1, const Vec2i &v2) const;
134 
135  KyUInt32 GetNavFloorLinkCount() const;
136  KyUInt32 GetStitch1To1EdgeCount() const;
137 
138 public:
139  BlobArray<CompactNavConnexIdx> m_triangleConnexIndices;
140  BlobArray<NavTag> m_connexNavTag;
146 
147  Stitch1To1ToHalfEdgeInFloor m_stitch1To1ToHalfEdgeInFloor;
148 };
149 
150 
153 KY_INLINE void SwapEndianness(Endianness::Target e, NavFloorAABB& self)
154 {
155  SwapEndianness(e, self.m_min);
156  SwapEndianness(e, self.m_max);
157 }
158 KY_INLINE void SwapEndianness(Endianness::Target e, NavFloorBlob& self)
159 {
160  SwapEndianness(e, self.m_triangleConnexIndices);
161  SwapEndianness(e, self.m_connexNavTag);
162  SwapEndianness(e, self.m_navHalfEdges);
163  SwapEndianness(e, self.m_navVertices);
164  SwapEndianness(e, self.m_navVerticesAltitudes);
166  SwapEndianness(e, self.m_altitudeRange);
167  SwapEndianness(e, self.m_navFloorAABB);
168  SwapEndianness(e, self.m_stitch1To1ToHalfEdgeInFloor);
169 }
170 
171 }
172 
174 
175 #endif //Navigation_NavFloorBlob_H
176 
177 
bool IsTriangleValid(NavTriangleIdx idx) const
performs some basic tests on static data. For internal debug purpose.
Represents the range of altitudes covered by a single NavFloorBlob.
Definition: flooraltituderange.h:18
const NavVertex & NavTriangleIdxToNavVertex(NavTriangleIdx idx, const KyInt32 vertexNumber) const
Retrieves one vertex from the specified triangle.
Definition: navfloorblob.inl:103
KyUInt32 NavTriangleIdx
An index that uniquely identifies a single triangle within the set of triangles owned by a NavFloor...
Definition: navmeshtypes.h:100
KyUInt32 NavConnexIdx
An index that uniquely identifies a single triangle within the set of triangles owned by a NavFloor...
Definition: navmeshtypes.h:110
NavHalfEdgeType GetHalfEdgeType(NavHalfEdgeIdx idx) const
Retrieves the type of the specified triangle edge.
Definition: navfloorblob.inl:76
const NavVertex & NavHalfEdgeIdxToStartNavVertex(NavHalfEdgeIdx idx) const
Retrieves the vertex at the start of the specified triangle edge.
Definition: navfloorblob.inl:78
const NavHalfEdge & GetNavHalfEdge(NavHalfEdgeIdx idx) const
Retrieves the triangle edge with the specified index within this NavFloorBlob.
Definition: navfloorblob.inl:70
static NavHalfEdgeIdx NavHalfEdgeIdxToPrevNavHalfEdgeIdx(NavHalfEdgeIdx idx)
Retrieves the triangle NavHalfEdgeIdx that precedes the edge specified the input NavHalfEdgeIdx withi...
Definition: navfloorblob.inl:35
The NavFloorBlob contains a connected and not overlapping part of triangle mesh static data within a ...
Definition: navfloorblob.h:42
NavFloorAABB m_navFloorAABB
An axis-oriented bounding box that stores the extents of this NavFloorBlob.
Definition: navfloorblob.h:166
NavConnexIdx NavTriangleIdxToNavConnexIdx(NavTriangleIdx idx) const
Retrieves the index of the NavConnex associated to the triangle specified by the input NavTriangleIdx...
Definition: navfloorblob.inl:112
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:87
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
const NavHalfEdge & NavTriangleIdxToNavHalfEdge(NavTriangleIdx idx, const KyInt32 halfEdgeNumber) const
Retrieves one edge from the specified triangle.
Definition: navfloorblob.inl:90
static NavHalfEdgeIdx NavTriangleIdxToFirstNavHalfEdgeIdx(NavTriangleIdx idx)
Retrieves the first NavHalfEdgeIdx of NavTriangle specified by the input NavTriangleIdx.
Definition: navfloorblob.inl:26
KyFloat32 GetNavVertexAltitude(const NavVertexIdx idx) const
Retrieves the altitude of the vertex with the specified index within this NavFloorBlob.
Definition: navfloorblob.inl:64
BlobArray< NavTag > m_connexNavTag
The array of NavTag associated to each NavConnex. GetCount() == GetConnexCount(). Do not modify...
Definition: navfloorblob.h:161
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Collects endianness types and utilities used in the blob serialization framework. ...
Definition: endianness.h:23
NavVertexIdx NavTriangleIdxToVertexIdx(NavTriangleIdx idx, const KyInt32 vertexNumber) const
Retrieves the index of one vertex from the specified triangle.
Definition: navfloorblob.inl:104
This class defines a two-dimensional vector whose coordinates are stored using 64-bit integers...
Definition: vec2ll.h:27
static KyUInt32 NavHalfEdgeIdxToHalfEdgeNumberInTriangle(NavHalfEdgeIdx idx)
Retrieves the index of the specified edge within its triangle.
Definition: navfloorblob.inl:41
static NavHalfEdgeIdx NavHalfEdgeIdxToNextNavHalfEdgeIdx(NavHalfEdgeIdx idx)
Retrieves the triangle NavHalfEdgeIdx that follows the edge specified the input NavHalfEdgeIdx within...
Definition: navfloorblob.inl:29
const NavHalfEdge & NavHalfEdgeIdxToPairNavHalfEdge(NavHalfEdgeIdx idx) const
Retrieves the triangle edge that is adjacent to the specified triangle edge, if any.
Definition: navfloorblob.inl:82
static NavHalfEdgeIdx NavHalfEdgeIdxToFirstNavHalfEdgeIdx(NavHalfEdgeIdx idx)
Retrieves the first NavHalfEdgeIdx of NavTriangle thet contains the edge specified by the input NavHa...
Definition: navfloorblob.inl:27
NavHalfEdgeObstacleType
Enumerates the possible types of obstacles that can be represented by a NavHalfEdge whose type is EDG...
Definition: navmeshtypes.h:45
bool DoesIntersect(const NavFloorAABB &other) const
Indicates whether or not the bounding box represented by this object intersects the specified NavFloo...
Definition: navfloorblob.inl:12
bool IsValid() const
performs some basic tests on static data. For internal debug purpose.
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
The NavData class is the object containing navigation data that will be added to one Database...
Definition: navdata.h:44
Represents the integer axis-aligned bounding box of a NavFloor.
Definition: navfloorblob.h:23
const NavVertex & NavHalfEdgeIdxToThirdNavVertex(NavHalfEdgeIdx idx) const
Retrieves the vertex in the triangle that is not connected to the specified triangle edge...
Definition: navfloorblob.inl:81
const NavVertex & NavHalfEdgeIdxToEndNavVertex(NavHalfEdgeIdx idx) const
Retrieves the vertex at the end of the specified triangle edge.
Definition: navfloorblob.inl:80
NavHalfEdgeIdx NavHalfEdgeIdxToPairNavHalfEdgeIdx(NavHalfEdgeIdx idx) const
Retrieves the index of the triangle edge that is adjacent to the specified triangle edge...
Definition: navfloorblob.inl:83
A BlobArray an array that is compatible with the blob serialization framework.
Definition: blobarray.h:28
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:86
This class defines a two-dimensional vector whose coordinates are stored using 32-bit integers...
Definition: vec2i.h:26
Definition: gamekitcrowddispersion.h:20
static NavTriangleIdx NavHalfEdgeIdxToTriangleIdx(NavHalfEdgeIdx idx)
Retrieves the index of the triangle that contains the edge specified the input NavHalfEdgeIdx.
Definition: navfloorblob.inl:25
NavVertex m_max
The maxima of the axis-aligned bounding box computed during NavData generation. Do not modify...
Definition: navfloorblob.h:33
BlobArray< KyFloat32 > m_navVerticesAltitudes
The array of triangle vertices altitude maintained by the NavFloorBlob. GetCount() == GetVertexCount(...
Definition: navfloorblob.h:164
KyUInt32 NavVertexIdx
An index that uniquely identifies a single vertex of a triangle within the set of vertices owned by a...
Definition: navmeshtypes.h:75
const NavTag & GetNavTag(NavTriangleIdx navTriangleIdx) const
Retrieves the NavTag associated to this triangle.
Definition: navfloorblob.inl:52
Each instance of NavHalfEdge represents a single edge of a single triangle within the NavMesh...
Definition: navhalfedge.h:21
static NavHalfEdgeIdx NavTriangleIdxToNavHalfEdgeIdx(NavTriangleIdx idx, KyInt32 halfEdgeNumber)
Retrieves one edge from the specified triangle.
Definition: navfloorblob.inl:28
BlobArray< NavHalfEdge > m_navHalfEdges
The array of triangle edges maintained by the NavFloorBlob. GetCount() == GetHalfEdgeCount(). Do not modify.
Definition: navfloorblob.h:162
const NavHalfEdge & NavHalfEdgeIdxToPrevNavHalfEdge(NavHalfEdgeIdx idx) const
Retrieves the edge that precedes the specified triangle edge within its triangle. ...
Definition: navfloorblob.inl:88
NavHalfEdgeType
Enumerates the possible types of boundary that can be represented by a NavHalfEdge.
Definition: navmeshtypes.h:52
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:92
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
FloorAltitudeRange m_altitudeRange
The range of altitude the vertices of this NavFloor are within.
Definition: navfloorblob.h:165
NavHalfEdgeObstacleType GetHalfEdgeObstacleType(NavHalfEdgeIdx idx) const
Retrieves the obstacle type of the specified triangle edge.
Definition: navfloorblob.inl:77
BlobArray< CompactNavConnexIdx > m_triangleConnexIndices
The array of CompactNavConnexIdx associated to each triangle. GetCount() == GetTriangleCount(). Do not modify.
Definition: navfloorblob.h:160
const NavHalfEdge & NavHalfEdgeIdxToNextNavHalfEdge(NavHalfEdgeIdx idx) const
Retrieves the edge that follows the specified triangle edge within its triangle.
Definition: navfloorblob.inl:87
NavVertexIdx NavHalfEdgeIdxToStartNavVertexIdx(NavHalfEdgeIdx idx) const
Retrieves the index of the vertex at the start of the specified triangle edge.
Definition: navfloorblob.inl:79
const NavVertex & GetNavVertex(const NavVertexIdx idx) const
Retrieves the vertex with the specified index within this NavFloorBlob.
Definition: navfloorblob.inl:58
NavVertex m_min
The minima of the axis-aligned bounding box computed during NavData generation. Do not modify...
Definition: navfloorblob.h:32
Represents a single vertex that forms the corner of at least one NavMesh triangle.
Definition: navvertex.h:22
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:118
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
BlobArray< NavVertex > m_navVertices
The array of triangle vertices maintained by the NavFloorBlob. GetCount() == GetVertexCount(). Do not modify.
Definition: navfloorblob.h:163
NavVertexIdx NavHalfEdgeIdxToEndNavVertexIdx(NavHalfEdgeIdx idx) const
Retrieves the index of the vertex at the end of the specified triangle edge.
Definition: navfloorblob.inl:85