14using namespace KOSMIndoorRouting;
17constexpr inline const uint32_t NAVMESHSET_MAGIC =
'M' << 24 |
'S' << 16 |
'E' << 8 |
'T';
18constexpr inline const uint32_t NAVMESHSET_VERSION = 1;
20struct NavMeshSetHeader
22 uint32_t magic = NAVMESHSET_MAGIC;
23 uint32_t
version = NAVMESHSET_VERSION;
24 uint32_t numTiles = 0;
25 dtNavMeshParams params;
28struct NavMeshTileHeader
36NavMesh::NavMesh() =
default;
37NavMesh::NavMesh(
NavMesh&&) noexcept = default;
45 return d && !d->m_dirty;
53NavMeshTransform NavMesh::transform()
const
55 return d ? d->m_transform : NavMeshTransform();
66 const auto *mesh = d->m_navMesh.get();
68 NavMeshSetHeader header;
69 for (
auto i = 0; i < mesh->getMaxTiles(); ++i) {
70 const auto tile = mesh->getTile(i);
71 if (!tile || !tile->header || !tile->dataSize) {
76 std::memcpy(&header.params, d->m_navMesh->getParams(),
sizeof(dtNavMeshParams));
77 f.
write(
reinterpret_cast<const char*
>(&header),
sizeof(NavMeshSetHeader));
79 for (
auto i = 0; i < mesh->getMaxTiles(); ++i) {
80 const auto tile = mesh->getTile(i);
81 if (!tile || !tile->header || !tile->dataSize) {
85 NavMeshTileHeader tileHeader;
86 tileHeader.tileRef = mesh->getTileRef(tile);
87 tileHeader.dataSize = tile->dataSize;
89 f.
write(
reinterpret_cast<const char*
>(&tileHeader),
sizeof(NavMeshTileHeader));
90 f.
write(
reinterpret_cast<const char*
>(tile->data), tile->dataSize);
Compiled nav mesh for routing.
void writeToFile(const QString &fileName) const
Write nav mesh data to the given file.
KDB_EXPORT KDbVersionInfo version()
bool open(FILE *fh, OpenMode mode, FileHandleFlags handleFlags)
QString errorString() const const
qint64 write(const QByteArray &data)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:55:43 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.