gwnavruntime/navgraph/blobs/navgrapharray.h Source File

navgrapharray.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 
11 
12 namespace Kaim
13 {
14 
15 class NavGraphArray
16 {
17  KY_ROOT_BLOB_CLASS(NavData, NavGraphArray, 0)
18  KY_CLASS_WITHOUT_COPY(NavGraphArray)
19 
20 public:
21  NavGraphArray() {}
22 
23  KyUInt32 ComputeVertexCount() const
24  {
25  KyUInt32 count = 0;
26  const BlobRef<NavGraphBlob>* navGraphs = m_navGraphs.GetValues();
27  for (KyUInt32 graphIdx = 0; graphIdx < m_navGraphs.GetCount(); ++graphIdx)
28  {
29  count += navGraphs[graphIdx].Ptr()->GetVertexCount();
30  }
31  return count;
32  }
33 
34  KyUInt32 ComputeEdgeCount() const
35  {
36  KyUInt32 count = 0;
37  const BlobRef<NavGraphBlob>* navGraphs = m_navGraphs.GetValues();
38  for (KyUInt32 graphIdx = 0; graphIdx < m_navGraphs.GetCount(); ++graphIdx)
39  {
40  count += navGraphs[graphIdx].Ptr()->GetEdgeCount();
41  }
42  return count;
43  }
44 
45  KyUInt32 ComputeNavTagCount() const
46  {
47  KyUInt32 count = 0;
48  const BlobRef<NavGraphBlob>* navGraphs = m_navGraphs.GetValues();
49  for (KyUInt32 graphIdx = 0; graphIdx < m_navGraphs.GetCount(); ++graphIdx)
50  {
51  count += navGraphs[graphIdx].Ptr()->GetNavTagCount();
52  }
53  return count;
54  }
55 
56  KyUInt32 ComputeVertexToConnectCount() const
57  {
58  KyUInt32 count = 0;
59  const BlobRef<NavGraphBlob>* navGraphs = m_navGraphs.GetValues();
60  for (KyUInt32 graphIdx = 0; graphIdx < m_navGraphs.GetCount(); ++graphIdx)
61  {
62  count += navGraphs[graphIdx].Ptr()->GetVertexToConnectCount();
63  }
64  return count;
65  }
66 
67 public:
68  KyUInt32 m_visualDebugId;
69  KyUInt32 m_databaseIndex;
70  BlobArray<BlobRef<NavGraphBlob> > m_navGraphs;
71 };
72 inline void SwapEndianness(Endianness::Target e, NavGraphArray& self)
73 {
74  SwapEndianness(e, self.m_visualDebugId);
75  SwapEndianness(e, self.m_databaseIndex);
76  SwapEndianness(e, self.m_navGraphs);
77 }
78 
79 } // namespace Kaim
80 
81 
82 
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17