// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
#pragma once
#include "Engine/Core/Types/DataContainer.h"
#include "Engine/Core/Collections/Array.h"
class WriteStream;
struct NavMeshTileDataHeader
{
int32 PosX;
int32 PosY;
int32 Layer;
int32 DataSize;
};
struct NavMeshTileData
{
int32 PosX;
int32 PosY;
int32 Layer;
BytesContainer Data;
};
struct NavMeshDataHeader
{
int32 Version;
float TileSize;
int32 TilesCount;
};
class NavMeshData
{
public:
///
/// The size of the navmesh tile (in world units).
///
float TileSize = 0.0f;
///
/// The all loaded tiles.
///
Array Tiles;
public:
///
/// Saves the navmesh tiles to the specified stream.
///
/// The output stream.
void Save(WriteStream& stream);
///
/// Loads the navmesh tiles from the specified data source.
///
/// The data container.
/// True if copy data into this container, otherwise will link the navmesh tiles data to the input bytes to reduce memory allocations and copies Use with caution.
/// True if failed, otherwise false.
bool Load(BytesContainer& data, bool copyData);
};