gwnavruntime/queries/blobs/dynamicnavmeshqueryblob.h Source File

dynamicnavmeshqueryblob.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 
16 
17 namespace Kaim
18 {
19 
20 class DynamicNavMeshQueryBlob
21 {
22  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
23  KY_ROOT_BLOB_CLASS(Query, DynamicNavMeshQueryBlob, 0)
24 public:
25  DynamicNavMeshQueryBlob() {}
26 
27 public:
28  KyUInt32 m_queryInfoId;
29  KyUInt32 m_databaseIdx;
30 
31  // BlobRef<NavFloorBlob> m_inputNavfloor;
32 
33  // SECONDARY INPUT: extracted in ExtractInputDataFromNavFloor()
34  PixelPos m_cellOriginPixel;
35  KyFloat32 m_integerPrecision;
36  // RESULT
37  KyUInt32 m_result;
38  BlobArray<BlobRef<NavFloorBlob> > m_resultNavFloors;
39 };
40 
41 inline void SwapEndianness(Endianness::Target e, DynamicNavMeshQueryBlob& self)
42 {
43  SwapEndianness(e, self.m_queryInfoId);
44  SwapEndianness(e, self.m_databaseIdx);
45  //SwapEndianness(e, self.m_inputNavfloor);
46  SwapEndianness(e, self.m_cellOriginPixel);
47  SwapEndianness(e, self.m_integerPrecision);
48  SwapEndianness(e, self.m_result);
49  SwapEndianness(e, self.m_resultNavFloors);
50 }
51 
52 class DynamicNavMeshQueryBlobBuilder : public BaseBlobBuilder<DynamicNavMeshQueryBlob>
53 {
54 public:
55  DynamicNavMeshQueryBlobBuilder(DynamicNavMeshQuery* query) { m_query = query; }
56  virtual void DoBuild()
57  {
58  BLOB_SET(m_blob->m_queryInfoId, m_query->m_queryInfoId);
59  if (m_query->m_database != nullptr)
60  {
61  BLOB_SET(m_blob->m_databaseIdx , m_query->m_database->GetDatabaseIndex());
62  BLOB_SET(m_blob->m_integerPrecision , m_query->m_database->GetDatabaseGenMetrics().m_integerPrecision);
63  }
64  BLOB_SET(m_blob->m_cellOriginPixel, m_query->GetCellOriginPixel());
65  BLOB_SET(m_blob->m_result, m_query->GetResult());
66  //BLOB_SET(m_blob->m_inputNavfloor, m_query->m_navfloorPtr.GetNavFloorBlob());
67 
68 
69  BlobRef<NavFloorBlob>* floors = BLOB_ARRAY(m_blob->m_resultNavFloors, m_query->m_resultNavfloorHandlers.GetCount());
70  for(KyUInt32 i = 0; i < m_query->m_resultNavfloorHandlers.GetCount(); ++i)
71  {
72  if (m_query->m_resultNavfloorHandlers[i] != nullptr)
73  COPY_REFERENCED_BLOB_FROM_HANDLER(floors[i], *m_query->m_resultNavfloorHandlers[i]);
74  }
75  }
76 
77 private:
78  DynamicNavMeshQuery* m_query;
79 };
80 }
81 
#define BLOB_SET(blob, value)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:130
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
DynamicNavMeshQueryBlob * m_blob
The blob maintained by this builder. Only modify using the macros listed under DoBuild().
Definition: baseblobbuilder.h:113
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
#define BLOB_ARRAY(blobArray, count)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:139
float KyFloat32
float
Definition: types.h:32