gwnavruntime/abstractgraph/blobs/abstractgraphgenerator.h Source File

abstractgraphgenerator.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 
15 
16 
17 
18 namespace Kaim
19 {
20 
21 class AbstractGraphGenerationReport;
22 class AbstractGraphDataGenerator;
23 class NavData;
24 class NavMeshElementBlob;
25 
26 // Used internally by AbstractGraphDataGenerator
27 class AbstractGraphGenerator
28 {
29  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavDataGen)
30 public:
31  AbstractGraphGenerator()
32  : m_report(nullptr)
33  , m_navData(nullptr)
34  , m_navMeshElementBlob(nullptr)
35  , m_neighborhoodDataCount(0)
36  , m_graphCellCount(0)
37  {}
38 
39  KyResult Init(AbstractGraphDataGenerator* abstractGraphGenerator);
40  KyResult Generate(Ptr< BlobHandler<AbstractGraphBlob> >& abstractGraphBlobHandler, Ptr<CellFilter> cellFilter, KyArrayPOD<CellPos>& cellPosBorder, KyArrayPOD<KyUInt8>& wantedBoundariesPerCells);
41 
42  void ClearAndRelease()
43  {
44  m_graphNodeTriangles.ClearAndRelease();
45  m_graphNodeIdxToGraphCellFloorIndices.ClearAndRelease();
46  m_graphNodeNeighborCosts.ClearAndRelease();
47  m_graphNodeNeighbors.ClearAndRelease();
48  m_tmpGraphFloorBlobHandlers.ClearAndRelease();
49  m_tmpGraphCellBlobHandlers.ClearAndRelease();
50  m_graphCellCount = 0;
51  m_neighborhoodDataCount = 0;
52  m_tmpGraphFloorGenerator.ClearAndRelease();
53  }
54 
55 private:
56  KyResult CreateNodes(KyArrayPOD<CellPos>& cellPosBorder, KyArrayPOD<KyUInt8>& wantedBoundariesPerCells);
57 
58  void ComputeAllCosts();
59  Vec3f GetNodePosition(AbstractGraphNodeIdx nodeIdx);
60 
61 public:
62  AbstractGraphGenerationReport* m_report;
63 
64  NavData* m_navData;
65  NavMeshElementBlob* m_navMeshElementBlob;
66 
67  KyArrayPOD<NavTriangleRawPtr> m_graphNodeTriangles; // used to store the triangles on which an abstract graph node lies on
68  KyArrayPOD<AbstractGraphCellFloorIndices> m_graphNodeIdxToGraphCellFloorIndices; // associates an abstract graph node to the indices of its abstract graph cell and floor
69  KyUInt32 m_neighborhoodDataCount;
70  KyArray< KyArrayPOD<KyFloat32, MemStat_NavDataGen>, MemStat_NavDataGen > m_graphNodeNeighborCosts;
71  KyArray< KyArrayPOD<CompactAbstractGraphNodeIdx, MemStat_NavDataGen>, MemStat_NavDataGen > m_graphNodeNeighbors;
72 
73  AbstractGraphFloorGenerator m_tmpGraphFloorGenerator;
74  KyArray< Ptr< BlobHandler<AbstractGraphFloorBlob> >, MemStat_NavDataGen > m_tmpGraphFloorBlobHandlers;
75  KyUInt32 m_graphCellCount;
76  KyArray< Ptr< BlobHandler<AbstractGraphCellBlob> >, MemStat_NavDataGen > m_tmpGraphCellBlobHandlers;
77  Ptr<CellFilter> m_cellFilter;
78 };
79 
80 
81 }
82 
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