gwnavruntime/navmesh/blobs/navmeshelementblob.h Source File

navmeshelementblob.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 
14 
15 namespace Kaim
16 {
17 
18 class DatabaseGenMetrics;
19 
23 {
24 public:
26  bool operator==(const NavMeshGenParameters& other) const;
27  bool operator!=(const NavMeshGenParameters& other) const { return !operator==(other); }
28 
29  KyInt32 GetCellSizeInCoord() const;
30 
31  void ComputeDatabaseGenMetrics(DatabaseGenMetrics& genMetrics) const;
32  bool IsCompatibleWith(const DatabaseGenMetrics& genMetrics) const;
33 
34 public:
42 };
43 
47 {
49  KY_ROOT_BLOB_CLASS(NavData, NavMeshElementBlob, 1)
50 public:
51 
52  enum NavMeshFlags
53  {
54  NAVMESH_NO_FLAG = 0,
55  NAVMESH_FROM_PARTITIONER = 1,
56  // NAVMESH_ADDITIONAL_FLAG = 1<<1; etc
57  NavMeshFlags_FORCE32 = 0xFFFFFFFF
58  };
59 
61 
62 public:
64 
65  KyUInt32 GetNavCellBlobCount() const;
66  const NavCellBlob& GetNavCellBlob(KyUInt32 idx) const;
67  const CellBox& GetCellBox() const;
68 
70  bool IsCompatibleWith(const NavMeshGenParameters& genParameters) const;
71 
72 public: // internal
73  bool IsValid() const;
74 public:
76  GuidCompound m_guidCompound;
79 
81 };
82 
83 inline void SwapEndianness(Endianness::Target e, NavMeshGenParameters& self)
84 {
85  SwapEndianness(e, self.m_entityRadius);
86  SwapEndianness(e, self.m_entityHeight);
87  SwapEndianness(e, self.m_stepMax);
88  SwapEndianness(e, self.m_slopeMax);
89  SwapEndianness(e, self.m_altitudeTolerance);
90  SwapEndianness(e, self.m_integerPrecision);
91  SwapEndianness(e, self.m_cellSizeInPixel);
92 }
93 
94 inline void SwapEndianness(Endianness::Target e, NavMeshElementBlob& self)
95 {
96  SwapEndianness(e, self.m_cellBox);
97  SwapEndianness(e, self.m_guidCompound);
98  SwapEndianness(e, self.m_genParameters);
99  SwapEndianness(e, self.m_flags);
100  SwapEndianness(e, self.m_cells);
101 }
102 
103 KY_INLINE KyInt32 NavMeshGenParameters::GetCellSizeInCoord() const { return IntCoordSystem::PixelCoordToInt(m_cellSizeInPixel); }
104 
105 KY_INLINE KyUInt32 NavMeshElementBlob::GetNavCellBlobCount() const { return m_cells.GetCount(); }
106 KY_INLINE const NavCellBlob& NavMeshElementBlob::GetNavCellBlob(KyUInt32 idx) const { return *m_cells.GetValues()[idx].Ptr(); }
107 KY_INLINE const CellBox& NavMeshElementBlob::GetCellBox() const { return m_cellBox; }
108 
109 KY_INLINE bool NavMeshElementBlob::IsCompatibleWith(const NavMeshGenParameters& genParameters) const
110 {
111  return m_genParameters == genParameters;
112 }
113 
114 }
115 
116 
117 
KyFloat32 m_stepMax
The maximum difference in altitude, in meters, that is considered navigable between neighboring pixel...
Definition: navmeshelementblob.h:37
BlobArray< BlobRef< NavCellBlob > > m_cells
The list of NavCellBlob maintained by the NavMeshElementBlob. For internal use. Do not modify...
Definition: navmeshelementblob.h:80
2d axis aligned box of 32bits integers. Very Important: CountX() returns m_max.x - m_min...
Definition: box2i.h:17
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:31
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
The NavCellBlob contains the NavMesh static data of a NavMeshElement at a CellPos.
Definition: navcellblob.h:19
CellBox m_cellBox
The box of NavCells maintained by this NavMeshElementBlob. Do not modify.
Definition: navmeshelementblob.h:75
KyFloat32 m_altitudeTolerance
The maximum difference in altitude that may exist between the NavMesh and the original terrain mesh...
Definition: navmeshelementblob.h:39
KyFloat32 m_entityHeight
The height in meter of the characters that can use this NavMesh, in meters.
Definition: navmeshelementblob.h:36
GuidCompound m_guidCompound
The GuidCompound that uniquely identifies this NavMeshElementBlob. For internal use. Do not modify.
Definition: navmeshelementblob.h:76
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
NavMeshGenParameters m_genParameters
The physical characteristics and movemement model of the character for which the NavMeshElementBlob w...
Definition: navmeshelementblob.h:77
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
KyInt32 GetCellSizeInCoord() const
Retrieves the number of raster pixels that make up the length and width of each cell.
Definition: navmeshelementblob.h:103
The NavData class is the object containing navigation data that will be added to one Database...
Definition: navdata.h:39
KyFloat32 m_entityRadius
The radius in meters of the characters that can use this NavMesh, in meters.
Definition: navmeshelementblob.h:35
bool IsCompatibleWith(const NavMeshGenParameters &genParameters) const
Indicates whether or not this object was created with the same generation parameters.
Definition: navmeshelementblob.h:109
This object indicates the settings used to generate the NavMeshElementBlob, and thereby the physical ...
Definition: navmeshelementblob.h:22
A BlobArray an array that is compatible with the blob serialization framework.
Definition: blobarray.h:23
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
KyFloat32 m_slopeMax
The maximum slope, in degrees, for a triangle in the terrain mesh to be considered navigable...
Definition: navmeshelementblob.h:38
The NavMeshElementBlob contains the NavMesh static data (a set of NavCellBlob) for an element (a Guid...
Definition: navmeshelementblob.h:46
std::int32_t KyInt32
int32_t
Definition: types.h:24
KyInt32 m_cellSizeInPixel
For internal use. Do not modify.
Definition: navmeshelementblob.h:41
KyUInt32 m_flags
Maintains extra information about this NavMeshElementBlob, set at generation time. For internal use. Do not modify.
Definition: navmeshelementblob.h:78
This class gathers a set of generation parameters of one Database and manages the conversion between ...
Definition: databasegenmetrics.h:22
bool IsValid() const
Performs some basic tests on static data. For internal debug purpose.
Definition: navmeshelementblob.cpp:69
KyFloat32 m_integerPrecision
For internal use. Do not modify.
Definition: navmeshelementblob.h:40
float KyFloat32
float
Definition: types.h:32