gwnavruntime/spatialization/tagvolumespatialization.h Source File

tagvolumespatialization.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 // primary contact: LAPA - secondary contact: NOBODY
9 #ifndef Navigation_TagVolumeSpatialization_H
10 #define Navigation_TagVolumeSpatialization_H
11 
12 
15 
16 namespace Kaim
17 {
18 
19 class World;
20 class DatabaseBinding;
21 class Database;
22 class Box3f;
23 class TagVolume;
24 
25 
26 // INTERNAL CLASS: TagVolume spatialization in one Database: maintain the Database
27 // CellBox over which the TagVolume AABB extends.
28 class TagVolumeDbData
29 {
30  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_Spatialization)
31 public:
32  TagVolumeDbData() {}
33 
34  bool IsComputed() const { return m_cellBox != CellBox(); }
35  void Compute(const Box3f& aabb, KyUInt32 obstacleTypeUInt, Database* database);
36  void Clear() { m_extendedAabb.Clear(); m_cellBox.Clear(); }
37 public:
38  Box3f m_extendedAabb;
39  CellBox m_cellBox;
40 };
41 
42 
45 class TagVolumeDatabaseData
46 {
47  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_Spatialization)
48 
49 public: // internal
50  TagVolumeDatabaseData() : m_databaseBinding(KY_NULL), m_tagVolumeDbData(KY_NULL) {}
51  ~TagVolumeDatabaseData() { MakeZero(); }
52 
53  void Init(Ptr<DatabaseBinding> databaseBinding);
54 
55  KyUInt32 GetTagVolumeDbDataCount() const;
56 
57  TagVolumeDbData& GetTagVolumeDbData(KyUInt32 boundDatabaseIdx);
58  const TagVolumeDbData& GetTagVolumeDbData(KyUInt32 boundDatabaseIdx) const;
59 
60  void ComputeTagVolumeDbData(const Box3f& aabb, KyUInt32 tagVolumeExtendOptions);
61 
62 private :
63  void MakeZero();
64 
65  void CreateTagVolumeDbData();
66  void DestroyTagVolumeDbData();
67 
68 public: // internal
69  Ptr<DatabaseBinding> m_databaseBinding;
70  TagVolumeDbData* m_tagVolumeDbData; // array indexed like m_databaseBinding
71 };
72 
73 
74 KY_INLINE KyUInt32 TagVolumeDatabaseData::GetTagVolumeDbDataCount() const { return (m_databaseBinding ? KyUInt32(m_databaseBinding->GetBoundDatabaseCount()) : 0); }
75 KY_INLINE TagVolumeDbData& TagVolumeDatabaseData::GetTagVolumeDbData(KyUInt32 i) { return m_tagVolumeDbData[i]; }
76 KY_INLINE const TagVolumeDbData& TagVolumeDatabaseData::GetTagVolumeDbData(KyUInt32 i) const { return m_tagVolumeDbData[i]; }
77 
78 } // namespace Kaim
79 
80 #endif // Navigation_TagVolumeSpatialization_H
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:34
#define KY_NULL
Null value.
Definition: types.h:247
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
Each TagVolume instance aggregates one instance of this class to maintain its spatialization informat...
Definition: tagvolumespatialization.h:47
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36