gwnavruntime/spatialization/tagvolumespatialization.h Source File

tagvolumespatialization.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 
10 
13 
14 namespace Kaim
15 {
16 
17 class DatabaseBinding;
18 class Database;
19 class Box3f;
20 class TagVolume;
21 
22 
23 // INTERNAL CLASS: TagVolume spatialization in one Database: maintain the Database
24 // CellBox over which the TagVolume AABB extends.
25 class TagVolumeDbData
26 {
27  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_Spatialization)
28 public:
29  TagVolumeDbData() {}
30 
31  bool IsComputed() const { return m_cellBox != CellBox(); }
32  void Compute(const Box3f& aabb, KyUInt32 obstacleTypeUInt, Database* database);
33  void Clear() { m_extendedAabb.Clear(); m_cellBox.Clear(); }
34 public:
35  Box3f m_extendedAabb;
36  CellBox m_cellBox;
37 };
38 
39 
43 {
44  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_Spatialization)
45 
46 public: // internal
47  TagVolumeDatabaseData() : m_databaseBinding(nullptr), m_tagVolumeDbData(nullptr) {}
48  ~TagVolumeDatabaseData() { MakeZero(); }
49 
50  void Init(Ptr<DatabaseBinding> databaseBinding);
51 
52  KyUInt32 GetTagVolumeDbDataCount() const;
53 
54  TagVolumeDbData& GetTagVolumeDbData(KyUInt32 boundDatabaseIdx);
55  const TagVolumeDbData& GetTagVolumeDbData(KyUInt32 boundDatabaseIdx) const;
56 
57  void ComputeTagVolumeDbData(const Box3f& aabb, KyUInt32 tagVolumeExtendOptions);
58 
59 private:
60  void MakeZero();
61 
62  void CreateTagVolumeDbData();
63  void DestroyTagVolumeDbData();
64 
65 public: // internal
66  Ptr<DatabaseBinding> m_databaseBinding;
67  TagVolumeDbData* m_tagVolumeDbData; // array indexed like m_databaseBinding
68 };
69 
70 
71 KY_INLINE KyUInt32 TagVolumeDatabaseData::GetTagVolumeDbDataCount() const { return (m_databaseBinding ? KyUInt32(m_databaseBinding->GetBoundDatabaseCount()) : 0); }
72 KY_INLINE TagVolumeDbData& TagVolumeDatabaseData::GetTagVolumeDbData(KyUInt32 i) { return m_tagVolumeDbData[i]; }
73 KY_INLINE const TagVolumeDbData& TagVolumeDatabaseData::GetTagVolumeDbData(KyUInt32 i) const { return m_tagVolumeDbData[i]; }
74 
75 } // namespace Kaim
76 
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:31
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
3d axis aligned box of 32bits floating points
Definition: box3f.h:16
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
Each TagVolume instance aggregates one instance of this class to maintain its spatialization informat...
Definition: tagvolumespatialization.h:42