gwnavruntime/navmesh/blobs/navhalfedge.h Source File

navhalfedge.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 #pragma once
8 
10 
11 namespace Kaim
12 {
13 
18 {
19 public:
20  NavHalfEdge() {}
21 
23  NavHalfEdgeType GetHalfEdgeType() const { return (NavHalfEdgeType)(m_edgeData >> 29); }
24 
26  NavVertexIdx GetStartVertexIdx() const { return (NavVertexIdx)((m_edgeData & 0x03FFC000) >> 14); }
27 
31  {
33  ("You must not call this function if the halfEdge is not of type NavHalfEdgeType::PAIRED."));
34  return (NavHalfEdgeIdx)(m_edgeData & 0x00003FFF);
35  }
36 
40  {
41  KY_DEBUG_ASSERTN(IsHalfEdgeAFloorOrCellBoundary(GetHalfEdgeType()) == true, ("You must not call this function if the halfEdge is not a boundary edge."));
42  return (KyUInt32)(m_edgeData & 0x00003FFF);
43  }
44 
48  {
49  KY_DEBUG_ASSERTN(IsHalfEdgeACellBoundary(GetHalfEdgeType()) == true, ("You must not call this function if the halfEdge is not of type NavHalfEdgeType::CELL_BOUNDARY"));
50  return (CardinalDir)(GetHalfEdgeType());
51  }
52 
56  {
57  KY_DEBUG_ASSERTN(GetHalfEdgeType() == EDGETYPE_OBSTACLE, ("You must not call this function if the halfEdge is not of type NavHalfEdgeType::OBSTACLE."));
58  return (NavHalfEdgeIdx)(m_edgeData & 0x00003FFF);
59  }
60 
63  NavHalfEdgeObstacleType GetHalfEdgeObstacleType() const { return (NavHalfEdgeObstacleType)((m_edgeData & 0x10000000) >> 28); }
64 
65 public:
66  // BitField
67  // bit 0 - 13 -> 14 bits : The index of the adjoining half-edge. Access through GetPairHalfEdgeIdx() or GetBoundaryEdgeIdx()
68  // bit 14 - 25 -> 12 bits : StartVertexIdx
69  // bit 26 - 27 -> 2 bits : unused
70  // bit 28 -> 1 bit : NavHalfEdgeObstacleType
71  // bit 29 - 31 -> 3 bits : NavHalfEdgeType
72  KyUInt32 m_edgeData;
73 };
74 
75 inline void SwapEndianness(Endianness::Target e, NavHalfEdge& self) { SwapEndianness(e, self.m_edgeData); }
76 
77 }
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
NavVertexIdx GetStartVertexIdx() const
Returns the index of the starting vertex of the edge.
Definition: navhalfedge.h:26
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:55
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
Indicates that another NavHalfEdge in the same NavFloor but in different Connex lies adjacent to the ...
Definition: navmeshtypes.h:57
KyUInt32 CardinalDir
Defines a type that refers to one of the cardinal points on the compass:
Definition: cardinaldir.h:15
NavHalfEdgeObstacleType
Enumerates the possible types of obstacles that can be represented by a NavHalfEdge whose type is EDG...
Definition: navmeshtypes.h:42
NavHalfEdgeObstacleType GetHalfEdgeObstacleType() const
Returns an element from the NavHalfEdgeObstacleType enumeration that indicates the type of obstacle t...
Definition: navhalfedge.h:63
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
NavHalfEdgeType GetHalfEdgeType() const
Returns an element from the NavHalfEdgeType enumeration that indicates the type of border this edge r...
Definition: navhalfedge.h:23
NavHalfEdgeIdx GetPairHalfEdgeIdx() const
If this edge borders an edge in an adjoining triangle, this method returns the index of that adjacent...
Definition: navhalfedge.h:30
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
Indicates that this NavHalfEdge lies on an external border of the NavMesh.
Definition: navmeshtypes.h:56
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
Each instance of NavHalfEdge represents a single edge of a single triangle within the NavMesh...
Definition: navhalfedge.h:17
Indicates that another NavHalfEdge in the same Connex lies adjacent to the NavHalfEdge.
Definition: navmeshtypes.h:58
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:39
NavHalfEdgeType
Enumerates the possible types of boundary that can be represented by a NavHalfEdge.
Definition: navmeshtypes.h:49
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:47