18 class NavMeshElementBlob;
21 class NavGraphBlobBuilder;
23 class AbstractGraphBlob;
25 class VisualDebugServer;
47 virtual const char* GetTypeName()
const {
return "NavData"; }
48 virtual void DoSendVisualDebug(VisualDebugServer& server, VisualDebugSendChangeEvent changeEvent);
57 NotReferencedInAnyDatabase = 0,
58 ToBeAdded_NotAlive = 1,
59 BeingAdded_NotAlive = 2,
60 AddedToDabase_Alive = 3,
61 ToBeRemoved_Alive = 4,
62 BeingRemoved_Alive = 5
69 Database* GetDatabase()
const;
88 KyResult Load(
const char* fileName, FileOpenerBase* fileOpener =
nullptr, FileHandler::ErrorReportMode errorReportMode = FileHandler::DO_ERROR_REPORT);
90 KyResult LoadFromMemory(
void* memory);
160 void ComputeCellBoxOfNavMeshes();
161 void ComputeCellBoxOfNavGraphs();
162 void ComputeCellBoxOfAbstractGraphs();
164 void OnNavDataBeeingAdded();
165 void OnNavDataAdditionFinished();
166 void OnNavDataBeeingRemoved();
167 void OnNavDataRemoveFinished();
169 BlobAggregate::Collection<NavMeshElementBlob> GetNavMeshElementBlobCollection()
const;
170 BlobAggregate::Collection<NavGraphBlob> GetNavGraphBlobCollection()
const;
171 BlobAggregate::Collection<AbstractGraphBlob> GetAbstractGraphBlobCollection()
const;
173 void OnLinkInfoChange();
175 void AddSectorDescriptorToBlobAggregate();
176 KyUInt32 GetMainNavMeshElementIndexInCollection()
const;
179 Database* m_database;
181 Ptr<BlobAggregate> m_blobAggregate;
182 KyArrayPOD<NavMeshElement* , MemStat_NavData> m_navMeshElements;
183 KyArrayPOD<NavGraph*, MemStat_NavData> m_navGraphs;
184 KyArrayPOD<AbstractGraph*, MemStat_NavData> m_abstractGraphs;
186 SectorDescriptor m_sectorDescriptor;
188 enum VisualDebugStatus { VisualDebugStatus_NothingToSend, VisualDebugStatus_SendALL, VisualDebugStatus_SendGraphLinkInfo };
189 VisualDebugStatus m_visualDebugStatus;
192 KY_INLINE NavData::NavData(Database* database)
193 : m_database(nullptr)
194 , m_databaseStatus(NotReferencedInAnyDatabase)
195 , m_visualDebugStatus(VisualDebugStatus_NothingToSend)
201 {
return m_databaseStatus == AddedToDabase_Alive || m_databaseStatus == ToBeRemoved_Alive || m_databaseStatus == BeingRemoved_Alive; }
204 KY_INLINE Database* NavData::GetDatabase()
const {
return m_database; }
206 KY_INLINE
void NavData::OnNavDataBeeingAdded() { m_databaseStatus = NavData::BeingAdded_NotAlive; }
207 KY_INLINE
void NavData::OnNavDataBeeingRemoved() { m_databaseStatus = NavData::BeingRemoved_Alive; }
209 KY_INLINE
void NavData::OnNavDataAdditionFinished()
211 m_databaseStatus = NavData::AddedToDabase_Alive;
212 m_visualDebugStatus = VisualDebugStatus_SendALL;
213 RegisterToVisualDebug();
216 KY_INLINE
void NavData::OnNavDataRemoveFinished()
218 m_databaseStatus = NavData::NotReferencedInAnyDatabase;
219 UnRegisterFromVisualDebug();
222 KY_INLINE
void NavData::OnLinkInfoChange()
224 if (m_visualDebugStatus == VisualDebugStatus_NothingToSend)
225 m_visualDebugStatus = VisualDebugStatus_SendGraphLinkInfo;
const String & GetGeneratorRelativeOutputDirectory() const
Returns the relative output directory used to load the file when visual debugging.
Definition: navdata.cpp:499
KyResult AddToDatabaseAsync()
This function does not modify the alive NavData in the Database immediately, the NavData won't be imm...
Definition: navdata.cpp:152
KyResult AddNavGraph(NavGraphBlobBuilder *navGraphBlobBuilder)
This function creates and add a NavGraphBlob to the BlobAggregate of this NavData.
Definition: navdata.cpp:367
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
void SetBlobAggregate(BlobAggregate *BlobAggregate)
To use in multi World scenario with NavData memory sharing.
Definition: navdata.cpp:64
KyResult Init(Database *database)
Associates current instance to a Database.
Definition: navdata.cpp:111
KyResult RemoveFromDatabaseAsync()
This function does not modify the alive NavData in the Database immediately.
Definition: navdata.cpp:217
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
KyResult Save(const char *fileName, FileOpenerBase *fileOpener=nullptr, Endianness::Type endianness=Endianness::LittleEndian)
This function is here to save a graph-only NavData, at runtime or in Generation Post Process...
Definition: navdata.cpp:81
const KyGuid * GetMainGuid() const
Gives the Guid used to identify the NavMesh contained in this NavData.
Definition: navdata.cpp:469
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
KyResult RemoveFromDatabaseImmediate()
Remove the NavData from the Database outside the World::Update().
Definition: navdata.cpp:291
The NavData class is the object containing navigation data that will be added to one Database...
Definition: navdata.h:39
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:57
Little-endian format (used, for example, for Windows, Linux).
Definition: endianness.h:22
Navigation return code class.
Definition: types.h:108
bool IsCompatibleWith(const NavData &navData) const
Indicates whether the specified NavData was created with the same generation parameters as this objec...
Definition: navdata.cpp:300
WorldElementType
Enumerates the WorldElement types.
Definition: worldelementtype.h:13
Base internal class used to represent elements that can be added to a World, such as instances of Dat...
Definition: worldelement.h:41
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
bool IsAliveInDatabase() const
Indicates whether the specified NavData has been effectively added to the Database and not effectivel...
Definition: navdata.h:200
KyResult Load(const char *fileName, FileOpenerBase *fileOpener=nullptr, FileHandler::ErrorReportMode errorReportMode=FileHandler::DO_ERROR_REPORT)
To use in single World scenario, or multi world scenario without NavData memory sharing.
Definition: navdata.cpp:28
const String & GetSectorName() const
Returns the Name passed to Kaim::GeneratorSector.
Definition: navdata.cpp:494
KyResult AddToDatabaseImmediate()
Add the NavData to the Database outside the World::Update().
Definition: navdata.cpp:279
Type
Enumerates possible endianness types.
Definition: endianness.h:20
DatabaseStatus
Enumerates the different status a NavData can have in one Database.
Definition: navdata.h:55