gwnavruntime/abstractgraph/blobs/abstractgraphgenerator.h Source File

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