gwnavgeneration/generator/navcellgenerator.h Source File

navcellgenerator.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 #pragma once
8 
13 
14 namespace Kaim
15 {
16 
17 class GeneratorSystem;
18 class DynamicRasterCell;
19 class DynamicNavRasterCell;
20 class NavCellHeightField;
21 class BoundaryGraph;
22 class InputCellBlob;
23 class GeneratorSectorBuilder;
24 class GeneratorSector;
25 class NavCellBlob;
26 class CellGenerator;
27 class NavTag;
28 
29 // NavCellGenerator is where most of the effective generation algorithms are run.
30 class NavCellGenerator
31 {
32  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
33 public:
34  NavCellGenerator(CellGenerator* cellGenerator, const KyArrayPOD<const InputCellBlob*>& inputCells);
35  ~NavCellGenerator();
36 
37  // clears all the m_dynamic temporary data ...
38  void ClearGenerationData();
39 
40  KyResult GenerateRawNavCell(BlobHandler<NavCellBlob>& handler);
41 
42  bool IsEmpty() const { return m_isEmpty; }
43 
44 private:
45  void ComputeUniqueNavTagArray();
46  void AddUniqueNavTag(const NavTag& tag);
47  KyUInt32 GetUniqueNavTagIndex(const NavTag& tag) const;
48 
49  KyResult GenerateRaster();
50  KyResult GenerateNavRaster();
51  KyResult GenerateHeightField();
52  KyResult GenerateBoundaries();
53  KyResult GenerateNavCellFromBoundaries();
54 
55  void BuildEmptyNavCellBlobIfNone();
56 
57 private:
58  // Allocated and maintained by the cellGenerator
59  CellGenerator* m_cellGenerator;
60  const KyArrayPOD<const InputCellBlob*>* m_inputCells;
61  KyArrayTLS_POD<KyUInt32> m_connexIdxToNavTagIdxArray;
62  KyArrayTLS_POD<const NavTag*> m_navTagArray; // Array of pointer is a bit weird but we have lifetime guarantees: point ot inputCells m_taggedTriangle3is m_navTag
63 
64  // dynamic (navgen) data. Allocated and maintained by the navcellGenerator
65  DynamicRasterCell* m_dynamicRaster;
66  DynamicNavRasterCell* m_dynamicNavRaster;
67  NavCellHeightField* m_navcellHeightField;
68  BoundaryGraph* m_boundaryGraph;
69 
70  bool m_isEmpty;
71 
72  BlobHandler<NavCellBlob>* m_navCellHandler;
73 };
74 
75 
76 }
77 
78 
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
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17