gwnavruntime/queries/blobs/navfloorboxblob.h Source File

navfloorboxblob.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 #ifndef Navigation_NavFloorBoxBlob_H
9 #define Navigation_NavFloorBoxBlob_H
10 
15 
16 namespace Kaim
17 {
18 
19 class NavFloorPtr;
20 
23 {
24 public:
25  enum ValidityStatus
26  {
27  VALID,
28  INVALID
29  };
30 
31  NavFloorBoxBlob() : m_status((KyUInt16)INVALID)
32  {}
33 
34  ValidityStatus GetValidityStatus() const { return (ValidityStatus)m_status; }
35 
36  Box3f m_floorAABB;
38  KyUInt16 m_status;
39 };
40 
41 inline void SwapEndianness(Kaim::Endianness::Target e, NavFloorBoxBlob& self)
42 {
43  SwapEndianness(e, self.m_floorAABB);
44  SwapEndianness(e, self.m_cellPos);
45  SwapEndianness(e, self.m_status);
46 }
47 
48 
49 class NavFloorBoxBlobBuilder : public BaseBlobBuilder<NavFloorBoxBlob>
50 {
51 public:
52  NavFloorBoxBlobBuilder(const NavFloorPtr& floorPtr) : m_floorPtr(floorPtr) {}
53 private:
54  void DoBuild()
55  {
56  if (IsWriteMode())
57  {
58  if (m_floorPtr.IsValid() == false)
59  {
60  m_blob->m_status = (KyUInt16)NavFloorBoxBlob::INVALID;
61  return;
62  }
63 
64  NavFloor* navFloor = m_floorPtr.GetNavFloor_Unsafe();
65  const NavFloorBlob* navFloorBlob = navFloor->GetNavFloorBlob();
66 
67  const DatabaseGenMetrics& databaseGenMetrics = navFloor->m_database->GetDatabaseGenMetrics();
68 
69 
70  const CoordPos64 cellOrigin64(databaseGenMetrics.ComputeCellOrigin(navFloor->GetCellPos()));
71  const Vec2f cellOrigin(databaseGenMetrics.GetFloatValueFromInteger64(cellOrigin64.x), databaseGenMetrics.GetFloatValueFromInteger64(cellOrigin64.y));
72 
73  m_blob->m_floorAABB.m_min.x = cellOrigin.x + databaseGenMetrics.GetFloatValueFromInteger32(navFloorBlob->m_navFloorAABB.m_min.GetX32());
74  m_blob->m_floorAABB.m_max.x = cellOrigin.x + databaseGenMetrics.GetFloatValueFromInteger32(navFloorBlob->m_navFloorAABB.m_max.GetX32());
75 
76  m_blob->m_floorAABB.m_min.y = cellOrigin.y + databaseGenMetrics.GetFloatValueFromInteger32(navFloorBlob->m_navFloorAABB.m_min.GetY32());
77  m_blob->m_floorAABB.m_max.y = cellOrigin.y + databaseGenMetrics.GetFloatValueFromInteger32(navFloorBlob->m_navFloorAABB.m_max.GetY32());
78 
79  m_blob->m_floorAABB.m_min.z = navFloor->m_floorAltitudeRange.m_minZ;
80  m_blob->m_floorAABB.m_max.z = navFloor->m_floorAltitudeRange.m_maxZ;
81 
82 
83  m_blob->m_cellPos = navFloor->GetCellPos();
84  m_blob->m_status = (KyUInt16)NavFloorBoxBlob::VALID;
85 
86  }
87  }
88 
89  NavFloorPtr m_floorPtr;
90 };
91 
92 }
93 
94 #endif // Navigation_NavFloorBoxBlob_H
KyFloat32 z
The size of the vector along the Z axis.
Definition: vec3f.h:229
Vec3f m_max
The maxima of the bounding box.
Definition: box3f.h:174
Blob to visual debug NavFloor information.
Definition: navfloorboxblob.h:22
KyFloat32 y
The size of the vector along the Y axis.
Definition: vec3f.h:228
CellPos m_cellPos
The position of the cell that contains this floor within the grid of PathData cells.
Definition: navfloorboxblob.h:38
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
This class represents a three-dimensional axis-aligned bounding box whose dimensions are stored using...
Definition: box3f.h:25
KyFloat32 x
The size of the vector along the X axis.
Definition: vec3f.h:227
Vec2LL CoordPos64
A type that represents the position of a point within the 2D integer grid.
Definition: navmeshtypes.h:19
NavFloorBoxBlob * m_blob
The blob maintained by this builder. Only modify using the macros listed under DoBuild().
Definition: baseblobbuilder.h:117
This class defines a two-dimensional vector whose coordinates are stored using 32-bit integers...
Definition: vec2i.h:26
Definition: gamekitcrowddispersion.h:20
bool IsWriteMode()
Indicates whether the builder is operating in COUNT mode or in WRITE mode.
Definition: baseblobbuilder.h:47
unsigned short KyUInt16
Type used internally to represent an unsigned 16-bit integer.
Definition: types.h:40
Vec3f m_min
The minima of the bounding box.
Definition: box3f.h:173