gwnavruntime/queries/blobs/dynamicnavmeshqueryblob.h Source File

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