TrinityCore
Loading...
Searching...
No Matches
TileBuilder.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_TILE_BUILDER_H
19#define TRINITYCORE_TILE_BUILDER_H
20
21#include "Common.h"
22#include "Memory.h"
23#include "StringFormat.h"
24#include "TerrainBuilder.h"
25#include <DetourNavMesh.h>
26#include <Recast.h>
27
28namespace MMAP
29{
30struct TileConfig;
31
32using detour_unique_ptr = std::unique_ptr<unsigned char, decltype(Trinity::unique_ptr_deleter<unsigned char*, &::dtFree>())>;
33
35{
36public:
37 TileBuilder(boost::filesystem::path const& inputDirectory,
38 boost::filesystem::path const& outputDirectory,
39 Optional<float> maxWalkableAngle,
40 Optional<float> maxWalkableAngleNotSteep,
41 bool skipLiquid,
42 bool bigBaseUnit,
43 bool debugOutput,
44 std::vector<OffMeshData> const* offMeshConnections);
45
46 TileBuilder(TileBuilder const&) = delete;
48
51
52 virtual ~TileBuilder();
53
54 void buildTile(uint32 mapID, uint32 tileX, uint32 tileY, dtNavMesh* navMesh);
55
56 // move map building
58 {
60 int size = 0;
61 };
62 TileResult buildMoveMapTile(uint32 mapID,
63 uint32 tileX,
64 uint32 tileY,
65 MeshData& meshData,
66 float (&bmin)[3],
67 float (&bmax)[3],
68 dtNavMeshParams const* navMeshParams,
69 std::string_view fileNameSuffix = ""sv);
70
71 void saveMoveMapTileToFile(uint32 mapID, uint32 tileX, uint32 tileY, dtNavMesh* navMesh,
72 TileResult const& tileResult, std::string_view fileNameSuffix = ""sv);
73
74 virtual bool shouldSkipTile(uint32 mapID, uint32 tileX, uint32 tileY) const;
75
76 static void getTileBounds(uint32 tileX, uint32 tileY,
77 float const* verts, std::size_t vertCount,
78 float* bmin, float* bmax);
79
80 rcConfig GetMapSpecificConfig(uint32 mapID, float const (&bmin)[3], float const (&bmax)[3], TileConfig const& tileConfig) const;
81
82 virtual std::string GetProgressText() const;
83
84 virtual void OnTileDone() { }
85
86protected:
87 boost::filesystem::path m_outputDirectory;
92
94 // build performance - not really used for now
95 rcContext m_rcContext;
96 std::vector<OffMeshData> const* m_offMeshConnections;
97};
98}
99
100#endif // TRINITYCORE_TILE_BUILDER_H
#define TC_MMAPS_COMMON_API
Definition Define.h:135
uint32_t uint32
Definition Define.h:154
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
std::vector< OffMeshData > const * m_offMeshConnections
Definition TileBuilder.h:96
TileBuilder & operator=(TileBuilder &&)=delete
TileBuilder(TileBuilder const &)=delete
Optional< float > m_maxWalkableAngleNotSteep
Definition TileBuilder.h:89
boost::filesystem::path m_outputDirectory
Definition TileBuilder.h:87
Optional< float > m_maxWalkableAngle
Definition TileBuilder.h:88
TerrainBuilder m_terrainBuilder
Definition TileBuilder.h:93
virtual ~TileBuilder()
virtual void OnTileDone()
Definition TileBuilder.h:84
TileBuilder(TileBuilder &&)=delete
rcContext m_rcContext
Definition TileBuilder.h:95
TileBuilder & operator=(TileBuilder const &)=delete
std::unique_ptr< unsigned char, decltype(Trinity::unique_ptr_deleter< unsigned char *, &::dtFree >())> detour_unique_ptr
Definition TileBuilder.h:32