Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
MapBuilder.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef _MAP_BUILDER_H
7#define _MAP_BUILDER_H
8
9#include <set>
10#include <map>
11
12#include "TerrainBuilder.h"
13#include "IntermediateValues.h"
14
15#include "Recast.h"
16#include "DetourNavMesh.h"
17
18using namespace VMAP;
19
20// Keep G3D typedefs isolated from shared engine typedefs.
21
22namespace MMAP
23{
24 typedef std::map<uint32, std::set<uint32>*> TileList;
25 struct Tile
26 {
27 Tile() : chf(NULL), solid(NULL), cset(NULL), pmesh(NULL), dmesh(NULL) {}
29 {
30 rcFreeCompactHeightfield(chf);
31 rcFreeContourSet(cset);
32 rcFreeHeightField(solid);
33 rcFreePolyMesh(pmesh);
34 rcFreePolyMeshDetail(dmesh);
35 }
36 rcCompactHeightfield* chf;
37 rcHeightfield* solid;
38 rcContourSet* cset;
39 rcPolyMesh* pmesh;
40 rcPolyMeshDetail* dmesh;
41 };
42
44 {
45 public:
46 MapBuilder(float maxWalkableAngle = 55.0f,
47 bool skipLiquid = false,
48 bool skipContinents = false,
49 bool skipJunkMaps = true,
50 bool skipBattlegrounds = false,
51 bool debugOutput = false,
52 bool bigBaseUnit = false,
53 const char* offMeshFilePath = NULL);
54
56
57 // builds all mmap tiles for the specified map id (ignores skip settings)
58 void buildMap(uint32 mapID);
59 void buildMeshFromFile(char* name);
60
61 // builds an mmap tile for the specified map and its mesh
62 void buildSingleTile(uint32 mapID, uint32 tileX, uint32 tileY);
63
64 // builds list of maps, then builds all of mmap tiles (based on the skip settings)
65 void buildAllMaps(unsigned int threads);
66
67 private:
68 // detect maps and tiles
69 void discoverTiles();
70 std::set<uint32>* getTileList(uint32 mapID);
71
72 void buildNavMesh(uint32 mapID, dtNavMesh* &navMesh);
73
74 void buildTile(uint32 mapID, uint32 tileX, uint32 tileY, dtNavMesh* navMesh);
75
76 // move map building
77 void buildMoveMapTile(uint32 mapID,
78 uint32 tileX,
79 uint32 tileY,
80 MeshData &meshData,
81 float bmin[3],
82 float bmax[3],
83 dtNavMesh* navMesh);
84
85 void getTileBounds(uint32 tileX, uint32 tileY,
86 float* verts, int vertCount,
87 float* bmin, float* bmax);
88 void getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY);
89
90 bool shouldSkipMap(uint32 mapID);
91 bool isTransportMap(uint32 mapID);
92 bool shouldSkipTile(uint32 mapID, uint32 tileX, uint32 tileY);
93
96
98
99 const char* m_offMeshFilePath;
103
106
107 // build performance - not really used for now
108 rcContext* m_rcContext;
109 };
110
111}
112
113#endif
std::uint32_t uint32
Definition Define.h:77
const char * m_offMeshFilePath
Definition MapBuilder.h:99
void buildMeshFromFile(char *name)
std::set< uint32 > * getTileList(uint32 mapID)
bool isTransportMap(uint32 mapID)
void buildNavMesh(uint32 mapID, dtNavMesh *&navMesh)
rcContext * m_rcContext
Definition MapBuilder.h:108
MapBuilder(float maxWalkableAngle=55.0f, bool skipLiquid=false, bool skipContinents=false, bool skipJunkMaps=true, bool skipBattlegrounds=false, bool debugOutput=false, bool bigBaseUnit=false, const char *offMeshFilePath=NULL)
void buildTile(uint32 mapID, uint32 tileX, uint32 tileY, dtNavMesh *navMesh)
void buildMoveMapTile(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData, float bmin[3], float bmax[3], dtNavMesh *navMesh)
void getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY)
bool shouldSkipTile(uint32 mapID, uint32 tileX, uint32 tileY)
bool shouldSkipMap(uint32 mapID)
float m_maxWalkableAngle
Definition MapBuilder.h:104
void buildMap(uint32 mapID)
TileList m_tiles
Definition MapBuilder.h:95
void getTileBounds(uint32 tileX, uint32 tileY, float *verts, int vertCount, float *bmin, float *bmax)
void buildAllMaps(unsigned int threads)
void buildSingleTile(uint32 mapID, uint32 tileX, uint32 tileY)
TerrainBuilder * m_terrainBuilder
Definition MapBuilder.h:94
std::map< uint32, std::set< uint32 > * > TileList
Definition MapBuilder.h:24
rcPolyMesh * pmesh
Definition MapBuilder.h:39
rcPolyMeshDetail * dmesh
Definition MapBuilder.h:40
rcHeightfield * solid
Definition MapBuilder.h:37
rcContourSet * cset
Definition MapBuilder.h:38
rcCompactHeightfield * chf
Definition MapBuilder.h:36