gwnavruntime/collision/collisiondatasectordescriptor.h Source File

collisiondatasectordescriptor.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 
13 
14 namespace Kaim
15 {
16 
20 {
21  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_CollisionData)
23  KY_ROOT_BLOB_CLASS(CollisionData, ColDataSectorDescriptorBlob, 0)
24 public:
26  BlobFieldArray m_fields;
27 };
28 inline void SwapEndianness(Endianness::Target e, ColDataSectorDescriptorBlob& self)
29 {
30  SwapEndianness(e, self.m_fields);
31 }
32 
36 // or in NavData::Save() when saving NavGraph-only Navdata at runtime or in user's post-process of the generation.
37 // Read along with NavData Load.
43 {
44  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_CollisionData)
45 
46 public:
48 
49  KyResult ReadFromAggregate(const BlobAggregate& aggregate)
50  {
51  BlobAggregate::Collection<ColDataSectorDescriptorBlob> sectorDescs = aggregate.GetCollection<ColDataSectorDescriptorBlob>();
52  if (sectorDescs.GetCount() != 1)
53  return KY_ERROR; // 1 and only 1 SectorDescriptorBlob
54  return ReadFromBlob(*sectorDescs.GetHandler(0)->Blob());
55  }
56 
57  void AddMapping(BlobFieldsMapping& mapping)
58  {
59  mapping.AddString("SectorName", m_sectorName);
60  mapping.AddString("GeneratorRelativeOutputDirectory", m_generatorRelativeOutputDirectory);
61  mapping.AddGuid("SectorGUID", m_guid);
62  }
63 
64  KyResult ReadFromBlob(const ColDataSectorDescriptorBlob& blob)
65  {
66  BlobFieldsMapping mapping;
67  AddMapping(mapping);
68  return mapping.ReadFromBlobFieldArray(blob.m_fields);
69  }
70 
71 public:
74  String m_sectorName;
75 
79 
83 };
84 
85 } // namespace Kaim
86 
The CollisionData class represents Collision Data that will be added to a CollisionWorld.
Definition: collisiondata.h:30
Set of Key-Values embedded within in ColData BlobAggregate (serialized form).
Definition: collisiondatasectordescriptor.h:19
String m_generatorRelativeOutputDirectory
Generator relative directory to used by the generator to output NavData, ClientInput, GenIO, related to this sector m_generatorRelativeOutputDirectory is relativeOutputDir in the call to void SetOutputDirectory(const char* absoluteOutputBaseDir, const char* relativeOutputDir);.
Definition: collisiondatasectordescriptor.h:78
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
#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
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
The KyGuid class represents a globally unique ID.
Definition: kyguid.h:20
String m_sectorName
Contains the name of the sector which is also the name of the file This is used to identify Graph-onl...
Definition: collisiondatasectordescriptor.h:74
#define KY_ERROR
use result == KY_ERROR to test for error
Definition: types.h:132
KyGuid m_guid
Index of the Lab's database in which the NavData will be added to.
Definition: collisiondatasectordescriptor.h:82
Easy to write/read version of SectorDescriptorBlob.
Definition: collisiondatasectordescriptor.h:42