8 #ifndef Navigation_NavData_H
9 #define Navigation_NavData_H
20 class NavMeshElementBlob;
23 class NavGraphBlobBuilder;
25 class AbstractGraphBlob;
27 class VisualDebugServer;
41 class NavData :
public WorldElement
49 virtual const char* GetTypeName()
const {
return "NavData"; }
50 virtual void DoSendVisualDebug(VisualDebugServer& server, VisualDebugSendChangeEvent changeEvent);
59 NotReferencedInAnyDatabase = 0,
60 ToBeAdded_NotAlive = 1,
61 BeingAdded_NotAlive = 2,
62 AddedToDabase_Alive = 3,
63 ToBeRemoved_Alive = 4,
64 BeingRemoved_Alive = 5
92 KyResult LoadFromMemory(
void* memory);
162 void ComputeCellBoxOfNavMeshes();
163 void ComputeCellBoxOfNavGraphs();
164 void ComputeCellBoxOfAbstractGraphs();
166 void OnNavDataBeeingAdded();
167 void OnNavDataAdditionFinished();
168 void OnNavDataBeeingRemoved();
169 void OnNavDataRemoveFinished();
171 BlobAggregate::Collection<NavMeshElementBlob> GetNavMeshElementBlobCollection()
const;
172 BlobAggregate::Collection<NavGraphBlob> GetNavGraphBlobCollection()
const;
173 BlobAggregate::Collection<AbstractGraphBlob> GetAbstractGraphBlobCollection()
const;
175 void OnLinkInfoChange();
177 void AddSectorDescriptorToBlobAggregate();
178 KyUInt32 GetMainNavMeshElementIndexInCollection()
const;
183 Ptr<BlobAggregate> m_blobAggregate;
190 enum VisualDebugStatus { VisualDebugStatus_NothingToSend, VisualDebugStatus_SendALL, VisualDebugStatus_SendGraphLinkInfo };
191 VisualDebugStatus m_visualDebugStatus;
194 KY_INLINE NavData::NavData(Database* database)
196 , m_databaseStatus(NotReferencedInAnyDatabase)
197 , m_visualDebugStatus(VisualDebugStatus_NothingToSend)
202 KY_INLINE NavData::~NavData() {}
205 {
return m_databaseStatus == AddedToDabase_Alive || m_databaseStatus == ToBeRemoved_Alive || m_databaseStatus == BeingRemoved_Alive; }
208 KY_INLINE Database* NavData::GetDatabase()
const {
return m_database; }
210 KY_INLINE
void NavData::OnNavDataBeeingAdded() { m_databaseStatus = NavData::BeingAdded_NotAlive; }
211 KY_INLINE
void NavData::OnNavDataBeeingRemoved() { m_databaseStatus = NavData::BeingRemoved_Alive; }
213 KY_INLINE
void NavData::OnNavDataAdditionFinished()
215 m_databaseStatus = NavData::AddedToDabase_Alive;
216 m_visualDebugStatus = VisualDebugStatus_SendALL;
217 RegisterToVisualDebug();
220 KY_INLINE
void NavData::OnNavDataRemoveFinished()
222 m_databaseStatus = NavData::NotReferencedInAnyDatabase;
223 UnRegisterFromVisualDebug();
226 KY_INLINE
void NavData::OnLinkInfoChange()
228 if (m_visualDebugStatus == VisualDebugStatus_NothingToSend)
229 m_visualDebugStatus = VisualDebugStatus_SendGraphLinkInfo;
General purpose array for movable objects that DOES NOT require construction/destruction.
Definition: kyarray.h:156
Base interface for a class that opens a file on disk.
Definition: fileopener.h:35
KyResult Save(const char *fileName, FileOpenerBase *fileOpener=0, Endianness::Type endianness=Endianness::BigEndian)
This function is here to save a graph-only NavData, at runtime or in Generation Post Process...
Easy to write/read version of SectorDescriptorBlob.
Definition: sectordescriptor.h:49
KyResult AddToDatabaseAsync()
This function does not modify the alive NavData in the Database immediately, the NavData won't be imm...
This class represents a two-dimensional axis-aligned bounding box whose dimensions are stored using 3...
Definition: box2i.h:119
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
KyResult AddNavGraph(NavGraphBlobBuilder *navGraphBlobBuilder)
This function creates and add a NavGraphBlob to the BlobAggregate of this NavData.
KyResult Load(const char *fileName, FileOpenerBase *fileOpener=0)
To use in single World scenario, or multi world scenario without NavData memory sharing.
const String & GetSectorName() const
Returns the Name passed to Kaim::GeneratorSector.
const KyGuid * GetMainGuid() const
Gives the Guid used to identify the NavMesh contained in this NavData.
void SetBlobAggregate(BlobAggregate *BlobAggregate)
To use in multi World scenario with NavData memory sharing.
KyResult Init(Database *database)
Associates current instance to a Database.
#define KY_NULL
Null value.
Definition: types.h:247
KyResult RemoveFromDatabaseAsync()
This function does not modify the alive NavData in the Database immediately.
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Big-endian format (used, for example, for PlayStation 3, Xbox 360).
Definition: endianness.h:31
KyResult RemoveFromDatabaseImmediate()
Remove the NavData from the Database outside the World::Update().
The NavData class is the object containing navigation data that will be added to one Database...
Definition: navdata.h:44
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:64
bool IsCompatibleWith(const NavData &navData) const
Indicates whether the specified NavData was created with the same generation parameters as this objec...
WorldElementType
Enumerates the WorldElement types.
Definition: worldelementtype.h:15
Definition: gamekitcrowddispersion.h:20
The KyGuid class represents a globally unique ID.
Definition: kyguid.h:22
bool IsAliveInDatabase() const
Indicates whether the specified NavData has been effectively added to the Database and not effectivel...
Definition: navdata.h:247
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
KyResult AddToDatabaseImmediate()
Add the NavData to the Database outside the World::Update().
Type
Enumerates possible endianness types.
Definition: endianness.h:28
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
const String & GetGeneratorRelativeOutputDirectory() const
Returns the relative output directory used to load the file when visual debugging.
This class allows you to build a NavGraph, which you can then add to the NavData for a sector...
Definition: navgraphblobbuilder.h:25
DatabaseStatus
Enumerates the different status a NavData can have in one Database.
Definition: navdata.h:66