gwnavruntime/queries/blobs/navfloorboxblob.h Source File

navfloorboxblob.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 NavFloorPtr;
19 
22 {
23 public:
24  enum ValidityStatus
25  {
26  VALID,
27  INVALID
28  };
29 
30  NavFloorBoxBlob() : m_status((KyUInt16)INVALID)
31  {}
32 
33  ValidityStatus GetValidityStatus() const { return (ValidityStatus)m_status; }
34 
35  Box3f m_floorAABB;
37  KyUInt16 m_status;
38 };
39 
40 inline void SwapEndianness(Kaim::Endianness::Target e, NavFloorBoxBlob& self)
41 {
42  SwapEndianness(e, self.m_floorAABB);
43  SwapEndianness(e, self.m_cellPos);
44  SwapEndianness(e, self.m_status);
45 }
46 
47 
48 class NavFloorBoxBlobBuilder : public BaseBlobBuilder<NavFloorBoxBlob>
49 {
50 public:
51  NavFloorBoxBlobBuilder(const NavFloorPtr& floorPtr) : m_floorPtr(floorPtr) {}
52 private:
53  void DoBuild()
54  {
55  if (IsWriteMode())
56  {
57  if (m_floorPtr.IsValid() == false)
58  {
59  m_blob->m_status = (KyUInt16)NavFloorBoxBlob::INVALID;
60  return;
61  }
62 
63  NavFloor* navFloor = m_floorPtr.GetNavFloor_Unsafe();
64  const NavFloorBlob* navFloorBlob = navFloor->GetNavFloorBlob();
65 
66  const DatabaseGenMetrics& databaseGenMetrics = navFloor->m_database->GetDatabaseGenMetrics();
67 
68 
69  const CoordPos64 cellOrigin64(databaseGenMetrics.ComputeCellOrigin(navFloor->GetCellPos()));
70  const Vec2f cellOrigin(databaseGenMetrics.GetFloatValueFromInteger64(cellOrigin64.x), databaseGenMetrics.GetFloatValueFromInteger64(cellOrigin64.y));
71 
72  m_blob->m_floorAABB.m_min.x = cellOrigin.x + databaseGenMetrics.GetFloatValueFromInteger32(navFloorBlob->m_navFloorAABB.m_min.GetX32());
73  m_blob->m_floorAABB.m_max.x = cellOrigin.x + databaseGenMetrics.GetFloatValueFromInteger32(navFloorBlob->m_navFloorAABB.m_max.GetX32());
74 
75  m_blob->m_floorAABB.m_min.y = cellOrigin.y + databaseGenMetrics.GetFloatValueFromInteger32(navFloorBlob->m_navFloorAABB.m_min.GetY32());
76  m_blob->m_floorAABB.m_max.y = cellOrigin.y + databaseGenMetrics.GetFloatValueFromInteger32(navFloorBlob->m_navFloorAABB.m_max.GetY32());
77 
78  m_blob->m_floorAABB.m_min.z = navFloor->m_floorAltitudeRange.m_minZ;
79  m_blob->m_floorAABB.m_max.z = navFloor->m_floorAltitudeRange.m_maxZ;
80 
81 
82  m_blob->m_cellPos = navFloor->GetCellPos();
83  m_blob->m_status = (KyUInt16)NavFloorBoxBlob::VALID;
84 
85  }
86  }
87 
88  NavFloorPtr m_floorPtr;
89 };
90 
91 }
92 
Blob to visual debug NavFloor information.
Definition: navfloorboxblob.h:21
std::uint16_t KyUInt16
uint16_t
Definition: types.h:28
CellPos m_cellPos
The position of the cell that contains this floor within the grid of PathData cells.
Definition: navfloorboxblob.h:36
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
3d axis aligned box of 32bits floating points
Definition: box3f.h:16
Vec2LL CoordPos64
A type that represents the position of a point within the 2D integer grid.
Definition: navmeshtypes.h:16
NavFloorBoxBlob * m_blob
The blob maintained by this builder. Only modify using the macros listed under DoBuild().
Definition: baseblobbuilder.h:113
2d vector using KyInt32
Definition: vec2i.h:18
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
bool IsWriteMode()
Indicates whether the builder is operating in COUNT mode or in WRITE mode.
Definition: baseblobbuilder.h:43