gwnavruntime/navmesh/blobs/navmeshelementblob.h Source File

navmeshelementblob.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_NavMeshElementBlob_H
10 #define Navigation_NavMeshElementBlob_H
11 
16 
17 namespace Kaim
18 {
19 
20 class DatabaseGenMetrics;
21 
25 {
26 public:
28  bool operator==(const NavMeshGenParameters& other) const;
29  bool operator!=(const NavMeshGenParameters& other) const { return !operator==(other); }
30 
31  KyInt32 GetCellSizeInCoord() const;
32 
33  void ComputeDatabaseGenMetrics(DatabaseGenMetrics& genMetrics) const;
34  bool IsCompatibleWith(const DatabaseGenMetrics& genMetrics) const;
35 
36 public:
44 };
45 
49 {
51  KY_ROOT_BLOB_CLASS(NavData, NavMeshElementBlob, 1)
52 public:
53 
54  enum NavMeshFlags
55  {
56  NAVMESH_NO_FLAG = 0,
57  NAVMESH_FROM_PARTITIONER = 1,
58  // NAVMESH_ADDITIONAL_FLAG = 1<<1; etc
59  NavMeshFlags_FORCE32 = 0xFFFFFFFF
60  };
61 
62  typedef NavMeshGenParameters GenParameters;
63 
64 public:
66 
67  KyUInt32 GetNavCellBlobCount() const;
68  const NavCellBlob& GetNavCellBlob(KyUInt32 idx) const;
69  const CellBox& GetCellBox() const;
70 
72  bool IsCompatibleWith(const NavMeshGenParameters& genParameters) const;
73 
74 public: // Internal
75  bool IsValid() const;
76 public:
78  GuidCompound m_guidCompound;
79  NavMeshGenParameters m_genParameters;
81 
82  BlobArray<BlobRef<NavCellBlob> > m_cells;
83 };
84 
87 inline void SwapEndianness(Endianness::Target e, NavMeshGenParameters& self)
88 {
89  SwapEndianness(e, self.m_entityRadius);
90  SwapEndianness(e, self.m_entityHeight);
91  SwapEndianness(e, self.m_stepMax);
92  SwapEndianness(e, self.m_slopeMax);
93  SwapEndianness(e, self.m_altitudeTolerance);
94  SwapEndianness(e, self.m_integerPrecision);
95  SwapEndianness(e, self.m_cellSizeInPixel);
96 }
97 
100 inline void SwapEndianness(Endianness::Target e, NavMeshElementBlob& self)
101 {
102  SwapEndianness(e, self.m_cellBox);
103  SwapEndianness(e, self.m_guidCompound);
104  SwapEndianness(e, self.m_genParameters);
105  SwapEndianness(e, self.m_flags);
106  SwapEndianness(e, self.m_cells);
107 }
108 
109 KY_INLINE KyInt32 NavMeshGenParameters::GetCellSizeInCoord() const { return IntCoordSystem::PixelCoordToInt(m_cellSizeInPixel); }
110 
111 KY_INLINE KyUInt32 NavMeshElementBlob::GetNavCellBlobCount() const { return m_cells.GetCount(); }
112 KY_INLINE const NavCellBlob& NavMeshElementBlob::GetNavCellBlob(KyUInt32 idx) const { return *m_cells.GetValues()[idx].Ptr(); }
113 KY_INLINE const CellBox& NavMeshElementBlob::GetCellBox() const { return m_cellBox; }
114 
115 KY_INLINE bool NavMeshElementBlob::IsCompatibleWith(const NavMeshGenParameters& genParameters) const
116 {
117  return m_genParameters == genParameters;
118 }
119 
120 }
121 
122 
123 #endif //Navigation_NavMeshElementBlob_H
KyFloat32 m_stepMax
The maximum difference in altitude, in meters, that is considered navigable between neighboring pixel...
Definition: navmeshelementblob.h:41
BlobArray< BlobRef< NavCellBlob > > m_cells
The list of NavCellBlob maintained by the NavMeshElementBlob. For internal use. Do not modify...
Definition: navmeshelementblob.h:89
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:34
CellBox m_cellBox
The box of NavCells maintained by this NavMeshElementBlob. Do not modify.
Definition: navmeshelementblob.h:84
KyFloat32 m_altitudeTolerance
The maximum difference in altitude that may exist between the NavMesh and the original terrain mesh...
Definition: navmeshelementblob.h:43
KyFloat32 m_entityHeight
The height in meter of the characters that can use this NavMesh, in meters.
Definition: navmeshelementblob.h:40
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
GuidCompound m_guidCompound
The GuidCompound that uniquely identifies this NavMeshElementBlob. For internal use. Do not modify.
Definition: navmeshelementblob.h:85
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
NavMeshGenParameters m_genParameters
The physical characteristics and movemement model of the character for which the NavMeshElementBlob w...
Definition: navmeshelementblob.h:86
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
KyInt32 GetCellSizeInCoord() const
Retrieves the number of raster pixels that make up the length and width of each cell.
Definition: navmeshelementblob.h:118
The NavData class is the object containing navigation data that will be added to one Database...
Definition: navdata.h:44
KyFloat32 m_entityRadius
The radius in meters of the characters that can use this NavMesh, in meters.
Definition: navmeshelementblob.h:39
bool IsCompatibleWith(const NavMeshGenParameters &genParameters) const
Indicates whether or not this object was created with the same generation parameters.
Definition: navmeshelementblob.h:124
This object indicates the settings used to generate the NavMeshElementBlob, and thereby the physical ...
Definition: navmeshelementblob.h:24
Definition: gamekitcrowddispersion.h:20
KyFloat32 m_slopeMax
The maximum slope, in degrees, for a triangle in the terrain mesh to be considered navigable...
Definition: navmeshelementblob.h:42
The NavMeshElementBlob contains the NavMesh static data (a set of NavCellBlob) for an element (a Guid...
Definition: navmeshelementblob.h:51
KyInt32 m_cellSizeInPixel
For internal use. Do not modify.
Definition: navmeshelementblob.h:45
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
KyUInt32 m_flags
Maintains extra information about this NavMeshElementBlob, set at generation time. For internal use. Do not modify.
Definition: navmeshelementblob.h:87
This class gathers a set of generation parameters of one Database and manages the conversion between ...
Definition: databasegenmetrics.h:24
bool IsValid() const
Performs some basic tests on static data.
KyFloat32 m_integerPrecision
For internal use. Do not modify.
Definition: navmeshelementblob.h:44
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43