gwnavruntime/navmesh/blobs/navhalfedge.h Source File

navhalfedge.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: NOBODY
9 #ifndef Navigation_NavHalfEdge_H
10 #define Navigation_NavHalfEdge_H
11 
13 
14 namespace Kaim
15 {
16 
20 class NavHalfEdge
21 {
22 public:
23  NavHalfEdge() {}
24 
25 
28 
32 
36 
40 
44 
48 
49 public:
50  /* BitField
51  bit 0 - 13 -> 14 bits : The index of the adjoining half-edge. Access through GetPairHalfEdgeIdx() or GetBoundaryEdgeIdx()
52  bit 14 - 25 -> 12 bits : StartVertexIdx
53  bit 26 - 27 -> 2 bits : unused
54  bit 28 -> 1 bit : NavHalfEdgeObstacleType
55  bit 29 - 31 -> 3 bits : NavHalfEdgeType
56  */
58 };
59 
62 KY_INLINE void SwapEndianness(Endianness::Target e, NavHalfEdge& self)
63 {
64  SwapEndianness(e, self.m_edgeData);
65 }
66 
67 
68 KY_INLINE NavVertexIdx NavHalfEdge::GetStartVertexIdx() const { return (NavVertexIdx)((m_edgeData & 0x03FFC000) >> 14); }
69 KY_INLINE NavHalfEdgeType NavHalfEdge::GetHalfEdgeType() const { return (NavHalfEdgeType)(m_edgeData >> 29); }
70 KY_INLINE NavHalfEdgeObstacleType NavHalfEdge::GetHalfEdgeObstacleType() const { return (NavHalfEdgeObstacleType)((m_edgeData & 0x10000000) >> 28); }
71 
73 {
74  KY_DEBUG_ASSERTN(IsHalfEdgeACellBoundary(GetHalfEdgeType()) == true,
75  ("You must not call this function if the halfEdge is not of type NavHalfEdgeType::CELL_BOUNDARY"));
76 
77  return (CardinalDir)(GetHalfEdgeType());
78 }
79 
80 
82 {
84  ("You must not call this function if the halfEdge is not of type NavHalfEdgeType::PAIRED."));
85 
86  return (NavHalfEdgeIdx)(m_edgeData & 0x00003FFF);
87 }
88 
90 {
91  KY_DEBUG_ASSERTN(IsHalfEdgeAFloorOrCellBoundary(GetHalfEdgeType()) == true,
92  ("You must not call this function if the halfEdge is not a boundary edge."));
93 
94  return (KyUInt32)(m_edgeData & 0x00003FFF);
95 }
96 
98 {
99  KY_DEBUG_ASSERTN(GetHalfEdgeType() == EDGETYPE_OBSTACLE,
100  ("You must not call this function if the halfEdge is not of type NavHalfEdgeType::OBSTACLE."));
101 
102  return (NavHalfEdgeIdx)(m_edgeData & 0x00003FFF);
103 }
104 
105 }
106 
107 #endif //Navigation_NavHalfEdge_H
108 
NavVertexIdx GetStartVertexIdx() const
Returns the index of the starting vertex of the edge.
Definition: navhalfedge.h:74
NavHalfEdgeIdx GetNextObstacleHalfEdgeIdx() const
If this edge borders an obstacle, this method returns the index of the next edge that borders that ob...
Definition: navhalfedge.h:103
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
KyUInt32 m_edgeData
For internal use. Do not modify.
Definition: navhalfedge.h:62
Indicates that another NavHalfEdge in the same NavFloor but in different Connex lies adjacent to the ...
Definition: navmeshtypes.h:60
KyUInt32 CardinalDir
Defines a type that refers to one of the cardinal points on the compass:
Definition: cardinaldir.h:23
NavHalfEdgeObstacleType
Enumerates the possible types of obstacles that can be represented by a NavHalfEdge whose type is EDG...
Definition: navmeshtypes.h:45
NavHalfEdgeObstacleType GetHalfEdgeObstacleType() const
Returns an element from the NavHalfEdgeObstacleType enumeration that indicates the type of obstacle t...
Definition: navhalfedge.h:76
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
NavHalfEdgeType GetHalfEdgeType() const
Returns an element from the NavHalfEdgeType enumeration that indicates the type of border this edge r...
Definition: navhalfedge.h:75
NavHalfEdgeIdx GetPairHalfEdgeIdx() const
If this edge borders an edge in an adjoining triangle, this method returns the index of that adjacent...
Definition: navhalfedge.h:87
Definition: gamekitcrowddispersion.h:20
KyUInt32 GetCellBoundaryDir() const
If this edge lies on the border of the NavCell, this method returns the cardinal direction of the bor...
Definition: navhalfedge.h:78
Indicates that this NavHalfEdge lies on an external border of the NavMesh.
Definition: navmeshtypes.h:59
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
Each instance of NavHalfEdge represents a single edge of a single triangle within the NavMesh...
Definition: navhalfedge.h:21
Indicates that another NavHalfEdge in the same Connex lies adjacent to the NavHalfEdge.
Definition: navmeshtypes.h:61
KyUInt32 GetBoundaryEdgeIdx() const
If this edge lies on the border of the NavFloor, this method returns the index of this edge among the...
Definition: navhalfedge.h:95
NavHalfEdgeType
Enumerates the possible types of boundary that can be represented by a NavHalfEdge.
Definition: navmeshtypes.h:52
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36