mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
Merge branch 'master' of https://github.com/ZhengPeiRu21/azerothcore-wotlk into Playerbot
This commit is contained in:
175
deps/recastnavigation/Recast/Include/Recast.h
vendored
175
deps/recastnavigation/Recast/Include/Recast.h
vendored
@@ -15,7 +15,7 @@
|
|||||||
// misrepresented as being the original software.
|
// misrepresented as being the original software.
|
||||||
// 3. This notice may not be removed or altered from any source distribution.
|
// 3. This notice may not be removed or altered from any source distribution.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef RECAST_H
|
#ifndef RECAST_H
|
||||||
#define RECAST_H
|
#define RECAST_H
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ enum rcTimerLabel
|
|||||||
/// The time to filter out small regions. (See: #rcBuildRegions, #rcBuildRegionsMonotone)
|
/// The time to filter out small regions. (See: #rcBuildRegions, #rcBuildRegionsMonotone)
|
||||||
RC_TIMER_BUILD_REGIONS_FILTER,
|
RC_TIMER_BUILD_REGIONS_FILTER,
|
||||||
/// The time to build heightfield layers. (See: #rcBuildHeightfieldLayers)
|
/// The time to build heightfield layers. (See: #rcBuildHeightfieldLayers)
|
||||||
RC_TIMER_BUILD_LAYERS,
|
RC_TIMER_BUILD_LAYERS,
|
||||||
/// The time to build the polygon mesh detail. (See: #rcBuildPolyMeshDetail)
|
/// The time to build the polygon mesh detail. (See: #rcBuildPolyMeshDetail)
|
||||||
RC_TIMER_BUILD_POLYMESHDETAIL,
|
RC_TIMER_BUILD_POLYMESHDETAIL,
|
||||||
/// The time to merge polygon mesh details. (See: #rcMergePolyMeshDetails)
|
/// The time to merge polygon mesh details. (See: #rcMergePolyMeshDetails)
|
||||||
@@ -95,7 +95,7 @@ enum rcTimerLabel
|
|||||||
RC_MAX_TIMERS
|
RC_MAX_TIMERS
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Provides an interface for optional logging and performance tracking of the Recast
|
/// Provides an interface for optional logging and performance tracking of the Recast
|
||||||
/// build process.
|
/// build process.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
class rcContext
|
class rcContext
|
||||||
@@ -165,7 +165,7 @@ protected:
|
|||||||
/// @param[in] label The category of the timer.
|
/// @param[in] label The category of the timer.
|
||||||
/// @return The accumulated time of the timer, or -1 if timers are disabled or the timer has never been started.
|
/// @return The accumulated time of the timer, or -1 if timers are disabled or the timer has never been started.
|
||||||
virtual int doGetAccumulatedTime(const rcTimerLabel /*label*/) const { return -1; }
|
virtual int doGetAccumulatedTime(const rcTimerLabel /*label*/) const { return -1; }
|
||||||
|
|
||||||
/// True if logging is enabled.
|
/// True if logging is enabled.
|
||||||
bool m_logEnabled;
|
bool m_logEnabled;
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ private:
|
|||||||
// Explicitly disabled copy constructor and copy assignment operator.
|
// Explicitly disabled copy constructor and copy assignment operator.
|
||||||
rcScopedTimer(const rcScopedTimer&);
|
rcScopedTimer(const rcScopedTimer&);
|
||||||
rcScopedTimer& operator=(const rcScopedTimer&);
|
rcScopedTimer& operator=(const rcScopedTimer&);
|
||||||
|
|
||||||
rcContext* const m_ctx;
|
rcContext* const m_ctx;
|
||||||
const rcTimerLabel m_label;
|
const rcTimerLabel m_label;
|
||||||
};
|
};
|
||||||
@@ -202,66 +202,63 @@ struct rcConfig
|
|||||||
|
|
||||||
/// The height of the field along the z-axis. [Limit: >= 0] [Units: vx]
|
/// The height of the field along the z-axis. [Limit: >= 0] [Units: vx]
|
||||||
int height;
|
int height;
|
||||||
|
|
||||||
/// The width/height size of tile's on the xz-plane. [Limit: >= 0] [Units: vx]
|
/// The width/height size of tile's on the xz-plane. [Limit: >= 0] [Units: vx]
|
||||||
int tileSize;
|
int tileSize;
|
||||||
|
|
||||||
/// The size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]
|
/// The size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]
|
||||||
int borderSize;
|
int borderSize;
|
||||||
|
|
||||||
/// The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu]
|
/// The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu]
|
||||||
float cs;
|
float cs;
|
||||||
|
|
||||||
/// The y-axis cell size to use for fields. [Limit: > 0] [Units: wu]
|
/// The y-axis cell size to use for fields. [Limit: > 0] [Units: wu]
|
||||||
float ch;
|
float ch;
|
||||||
|
|
||||||
/// The minimum bounds of the field's AABB. [(x, y, z)] [Units: wu]
|
/// The minimum bounds of the field's AABB. [(x, y, z)] [Units: wu]
|
||||||
float bmin[3];
|
float bmin[3];
|
||||||
|
|
||||||
/// The maximum bounds of the field's AABB. [(x, y, z)] [Units: wu]
|
/// The maximum bounds of the field's AABB. [(x, y, z)] [Units: wu]
|
||||||
float bmax[3];
|
float bmax[3];
|
||||||
|
|
||||||
/// The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]
|
/// The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]
|
||||||
float walkableSlopeAngle;
|
float walkableSlopeAngle;
|
||||||
|
|
||||||
/// The maximum slope that is considered walkable but not steep. It should be lower/equal than walkableSlopeAngle. [Limits: 0 <= value < 90] [Units: Degrees]
|
/// Minimum floor to 'ceiling' height that will still allow the floor area to
|
||||||
float walkableSlopeAngleNotSteep;
|
/// be considered walkable. [Limit: >= 3] [Units: vx]
|
||||||
|
|
||||||
/// Minimum floor to 'ceiling' height that will still allow the floor area to
|
|
||||||
/// be considered walkable. [Limit: >= 3] [Units: vx]
|
|
||||||
int walkableHeight;
|
int walkableHeight;
|
||||||
|
|
||||||
/// Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]
|
/// Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]
|
||||||
int walkableClimb;
|
int walkableClimb;
|
||||||
|
|
||||||
/// The distance to erode/shrink the walkable area of the heightfield away from
|
/// The distance to erode/shrink the walkable area of the heightfield away from
|
||||||
/// obstructions. [Limit: >=0] [Units: vx]
|
/// obstructions. [Limit: >=0] [Units: vx]
|
||||||
int walkableRadius;
|
int walkableRadius;
|
||||||
|
|
||||||
/// The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]
|
/// The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]
|
||||||
int maxEdgeLen;
|
int maxEdgeLen;
|
||||||
|
|
||||||
/// The maximum distance a simplfied contour's border edges should deviate
|
/// The maximum distance a simplfied contour's border edges should deviate
|
||||||
/// the original raw contour. [Limit: >=0] [Units: vx]
|
/// the original raw contour. [Limit: >=0] [Units: vx]
|
||||||
float maxSimplificationError;
|
float maxSimplificationError;
|
||||||
|
|
||||||
/// The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]
|
/// The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]
|
||||||
int minRegionArea;
|
int minRegionArea;
|
||||||
|
|
||||||
/// Any regions with a span count smaller than this value will, if possible,
|
/// Any regions with a span count smaller than this value will, if possible,
|
||||||
/// be merged with larger regions. [Limit: >=0] [Units: vx]
|
/// be merged with larger regions. [Limit: >=0] [Units: vx]
|
||||||
int mergeRegionArea;
|
int mergeRegionArea;
|
||||||
|
|
||||||
/// The maximum number of vertices allowed for polygons generated during the
|
/// The maximum number of vertices allowed for polygons generated during the
|
||||||
/// contour to polygon conversion process. [Limit: >= 3]
|
/// contour to polygon conversion process. [Limit: >= 3]
|
||||||
int maxVertsPerPoly;
|
int maxVertsPerPoly;
|
||||||
|
|
||||||
/// Sets the sampling distance to use when generating the detail mesh.
|
/// Sets the sampling distance to use when generating the detail mesh.
|
||||||
/// (For height detail only.) [Limits: 0 or >= 0.9] [Units: wu]
|
/// (For height detail only.) [Limits: 0 or >= 0.9] [Units: wu]
|
||||||
float detailSampleDist;
|
float detailSampleDist;
|
||||||
|
|
||||||
/// The maximum distance the detail mesh surface should deviate from heightfield
|
/// The maximum distance the detail mesh surface should deviate from heightfield
|
||||||
/// data. (For height detail only.) [Limit: >=0] [Units: wu]
|
/// data. (For height detail only.) [Limit: >=0] [Units: wu]
|
||||||
float detailSampleMaxError;
|
float detailSampleMaxError;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -315,7 +312,7 @@ private:
|
|||||||
rcHeightfield& operator=(const rcHeightfield&);
|
rcHeightfield& operator=(const rcHeightfield&);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Provides information on the content of a cell column in a compact heightfield.
|
/// Provides information on the content of a cell column in a compact heightfield.
|
||||||
struct rcCompactCell
|
struct rcCompactCell
|
||||||
{
|
{
|
||||||
unsigned int index : 24; ///< Index to the first span in the column.
|
unsigned int index : 24; ///< Index to the first span in the column.
|
||||||
@@ -343,8 +340,8 @@ struct rcCompactHeightfield
|
|||||||
int walkableHeight; ///< The walkable height used during the build of the field. (See: rcConfig::walkableHeight)
|
int walkableHeight; ///< The walkable height used during the build of the field. (See: rcConfig::walkableHeight)
|
||||||
int walkableClimb; ///< The walkable climb used during the build of the field. (See: rcConfig::walkableClimb)
|
int walkableClimb; ///< The walkable climb used during the build of the field. (See: rcConfig::walkableClimb)
|
||||||
int borderSize; ///< The AABB border size used during the build of the field. (See: rcConfig::borderSize)
|
int borderSize; ///< The AABB border size used during the build of the field. (See: rcConfig::borderSize)
|
||||||
unsigned short maxDistance; ///< The maximum distance value of any span within the field.
|
unsigned short maxDistance; ///< The maximum distance value of any span within the field.
|
||||||
unsigned short maxRegions; ///< The maximum region id of any span within the field.
|
unsigned short maxRegions; ///< The maximum region id of any span within the field.
|
||||||
float bmin[3]; ///< The minimum bounds in world space. [(x, y, z)]
|
float bmin[3]; ///< The minimum bounds in world space. [(x, y, z)]
|
||||||
float bmax[3]; ///< The maximum bounds in world space. [(x, y, z)]
|
float bmax[3]; ///< The maximum bounds in world space. [(x, y, z)]
|
||||||
float cs; ///< The size of each cell. (On the xz-plane.)
|
float cs; ///< The size of each cell. (On the xz-plane.)
|
||||||
@@ -378,7 +375,7 @@ struct rcHeightfieldLayer
|
|||||||
|
|
||||||
/// Represents a set of heightfield layers.
|
/// Represents a set of heightfield layers.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @see rcAllocHeightfieldLayerSet, rcFreeHeightfieldLayerSet
|
/// @see rcAllocHeightfieldLayerSet, rcFreeHeightfieldLayerSet
|
||||||
struct rcHeightfieldLayerSet
|
struct rcHeightfieldLayerSet
|
||||||
{
|
{
|
||||||
rcHeightfieldLayerSet();
|
rcHeightfieldLayerSet();
|
||||||
@@ -391,9 +388,9 @@ struct rcHeightfieldLayerSet
|
|||||||
struct rcContour
|
struct rcContour
|
||||||
{
|
{
|
||||||
int* verts; ///< Simplified contour vertex and connection data. [Size: 4 * #nverts]
|
int* verts; ///< Simplified contour vertex and connection data. [Size: 4 * #nverts]
|
||||||
int nverts; ///< The number of vertices in the simplified contour.
|
int nverts; ///< The number of vertices in the simplified contour.
|
||||||
int* rverts; ///< Raw contour vertex and connection data. [Size: 4 * #nrverts]
|
int* rverts; ///< Raw contour vertex and connection data. [Size: 4 * #nrverts]
|
||||||
int nrverts; ///< The number of vertices in the raw contour.
|
int nrverts; ///< The number of vertices in the raw contour.
|
||||||
unsigned short reg; ///< The region id of the contour.
|
unsigned short reg; ///< The region id of the contour.
|
||||||
unsigned char area; ///< The area id of the contour.
|
unsigned char area; ///< The area id of the contour.
|
||||||
};
|
};
|
||||||
@@ -410,13 +407,13 @@ struct rcContourSet
|
|||||||
float bmax[3]; ///< The maximum bounds in world space. [(x, y, z)]
|
float bmax[3]; ///< The maximum bounds in world space. [(x, y, z)]
|
||||||
float cs; ///< The size of each cell. (On the xz-plane.)
|
float cs; ///< The size of each cell. (On the xz-plane.)
|
||||||
float ch; ///< The height of each cell. (The minimum increment along the y-axis.)
|
float ch; ///< The height of each cell. (The minimum increment along the y-axis.)
|
||||||
int width; ///< The width of the set. (Along the x-axis in cell units.)
|
int width; ///< The width of the set. (Along the x-axis in cell units.)
|
||||||
int height; ///< The height of the set. (Along the z-axis in cell units.)
|
int height; ///< The height of the set. (Along the z-axis in cell units.)
|
||||||
int borderSize; ///< The AABB border size used to generate the source data from which the contours were derived.
|
int borderSize; ///< The AABB border size used to generate the source data from which the contours were derived.
|
||||||
float maxError; ///< The max edge error that this contour set was simplified with.
|
float maxError; ///< The max edge error that this contour set was simplified with.
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Represents a polygon mesh suitable for use in building a navigation mesh.
|
/// Represents a polygon mesh suitable for use in building a navigation mesh.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
struct rcPolyMesh
|
struct rcPolyMesh
|
||||||
{
|
{
|
||||||
@@ -439,14 +436,14 @@ struct rcPolyMesh
|
|||||||
float maxEdgeError; ///< The max error of the polygon edges in the mesh.
|
float maxEdgeError; ///< The max error of the polygon edges in the mesh.
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Contains triangle meshes that represent detailed height data associated
|
/// Contains triangle meshes that represent detailed height data associated
|
||||||
/// with the polygons in its associated polygon mesh object.
|
/// with the polygons in its associated polygon mesh object.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
struct rcPolyMeshDetail
|
struct rcPolyMeshDetail
|
||||||
{
|
{
|
||||||
unsigned int* meshes; ///< The sub-mesh data. [Size: 4*#nmeshes]
|
unsigned int* meshes; ///< The sub-mesh data. [Size: 4*#nmeshes]
|
||||||
float* verts; ///< The mesh vertices. [Size: 3*#nverts]
|
float* verts; ///< The mesh vertices. [Size: 3*#nverts]
|
||||||
unsigned char* tris; ///< The mesh triangles. [Size: 4*#ntris]
|
unsigned char* tris; ///< The mesh triangles. [Size: 4*#ntris]
|
||||||
int nmeshes; ///< The number of sub-meshes defined by #meshes.
|
int nmeshes; ///< The number of sub-meshes defined by #meshes.
|
||||||
int nverts; ///< The number of vertices in #verts.
|
int nverts; ///< The number of vertices in #verts.
|
||||||
int ntris; ///< The number of triangles in #tris.
|
int ntris; ///< The number of triangles in #tris.
|
||||||
@@ -532,7 +529,7 @@ void rcFreePolyMeshDetail(rcPolyMeshDetail* dmesh);
|
|||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// Heighfield border flag.
|
/// Heighfield border flag.
|
||||||
/// If a heightfield region ID has this bit set, then the region is a border
|
/// If a heightfield region ID has this bit set, then the region is a border
|
||||||
/// region and its spans are considered unwalkable.
|
/// region and its spans are considered unwalkable.
|
||||||
/// (Used during the region and contour build process.)
|
/// (Used during the region and contour build process.)
|
||||||
/// @see rcCompactSpan::reg
|
/// @see rcCompactSpan::reg
|
||||||
@@ -541,15 +538,15 @@ static const unsigned short RC_BORDER_REG = 0x8000;
|
|||||||
/// Polygon touches multiple regions.
|
/// Polygon touches multiple regions.
|
||||||
/// If a polygon has this region ID it was merged with or created
|
/// If a polygon has this region ID it was merged with or created
|
||||||
/// from polygons of different regions during the polymesh
|
/// from polygons of different regions during the polymesh
|
||||||
/// build step that removes redundant border vertices.
|
/// build step that removes redundant border vertices.
|
||||||
/// (Used during the polymesh and detail polymesh build processes)
|
/// (Used during the polymesh and detail polymesh build processes)
|
||||||
/// @see rcPolyMesh::regs
|
/// @see rcPolyMesh::regs
|
||||||
static const unsigned short RC_MULTIPLE_REGS = 0;
|
static const unsigned short RC_MULTIPLE_REGS = 0;
|
||||||
|
|
||||||
/// Border vertex flag.
|
/// Border vertex flag.
|
||||||
/// If a region ID has this bit set, then the associated element lies on
|
/// If a region ID has this bit set, then the associated element lies on
|
||||||
/// a tile border. If a contour vertex's region ID has this bit set, the
|
/// a tile border. If a contour vertex's region ID has this bit set, the
|
||||||
/// vertex will later be removed in order to match the segments and vertices
|
/// vertex will later be removed in order to match the segments and vertices
|
||||||
/// at tile boundaries.
|
/// at tile boundaries.
|
||||||
/// (Used during the build process.)
|
/// (Used during the build process.)
|
||||||
/// @see rcCompactSpan::reg, #rcContour::verts, #rcContour::rverts
|
/// @see rcCompactSpan::reg, #rcContour::verts, #rcContour::rverts
|
||||||
@@ -582,13 +579,13 @@ static const int RC_CONTOUR_REG_MASK = 0xffff;
|
|||||||
static const unsigned short RC_MESH_NULL_IDX = 0xffff;
|
static const unsigned short RC_MESH_NULL_IDX = 0xffff;
|
||||||
|
|
||||||
/// Represents the null area.
|
/// Represents the null area.
|
||||||
/// When a data element is given this value it is considered to no longer be
|
/// When a data element is given this value it is considered to no longer be
|
||||||
/// assigned to a usable area. (E.g. It is unwalkable.)
|
/// assigned to a usable area. (E.g. It is unwalkable.)
|
||||||
static const unsigned char RC_NULL_AREA = 0;
|
static const unsigned char RC_NULL_AREA = 0;
|
||||||
|
|
||||||
/// The default area id used to indicate a walkable polygon.
|
/// The default area id used to indicate a walkable polygon.
|
||||||
/// This is also the maximum allowed area id, and the only non-null area id
|
/// This is also the maximum allowed area id, and the only non-null area id
|
||||||
/// recognized by some steps in the build process.
|
/// recognized by some steps in the build process.
|
||||||
static const unsigned char RC_WALKABLE_AREA = 63;
|
static const unsigned char RC_WALKABLE_AREA = 63;
|
||||||
|
|
||||||
/// The value returned by #rcGetCon if the specified direction is not connected
|
/// The value returned by #rcGetCon if the specified direction is not connected
|
||||||
@@ -813,7 +810,7 @@ bool rcCreateHeightfield(rcContext* ctx, rcHeightfield& hf, int width, int heigh
|
|||||||
/// @param[in] nt The number of triangles.
|
/// @param[in] nt The number of triangles.
|
||||||
/// @param[out] areas The triangle area ids. [Length: >= @p nt]
|
/// @param[out] areas The triangle area ids. [Length: >= @p nt]
|
||||||
void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, const float* verts, int nv,
|
void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, const float* verts, int nv,
|
||||||
const int* tris, int nt, unsigned char* areas, unsigned char areaType = RC_WALKABLE_AREA);
|
const int* tris, int nt, unsigned char* areas);
|
||||||
|
|
||||||
/// Sets the area id of all triangles with a slope greater than or equal to the specified value to #RC_NULL_AREA.
|
/// Sets the area id of all triangles with a slope greater than or equal to the specified value to #RC_NULL_AREA.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
@@ -826,7 +823,7 @@ void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, con
|
|||||||
/// @param[in] nt The number of triangles.
|
/// @param[in] nt The number of triangles.
|
||||||
/// @param[out] areas The triangle area ids. [Length: >= @p nt]
|
/// @param[out] areas The triangle area ids. [Length: >= @p nt]
|
||||||
void rcClearUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, const float* verts, int nv,
|
void rcClearUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, const float* verts, int nv,
|
||||||
const int* tris, int nt, unsigned char* areas);
|
const int* tris, int nt, unsigned char* areas);
|
||||||
|
|
||||||
/// Adds a span to the specified heightfield.
|
/// Adds a span to the specified heightfield.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
@@ -869,7 +866,7 @@ bool rcRasterizeTriangle(rcContext* ctx, const float* v0, const float* v1, const
|
|||||||
/// @param[in] areas The area id's of the triangles. [Limit: <= #RC_WALKABLE_AREA] [Size: @p nt]
|
/// @param[in] areas The area id's of the triangles. [Limit: <= #RC_WALKABLE_AREA] [Size: @p nt]
|
||||||
/// @param[in] nt The number of triangles.
|
/// @param[in] nt The number of triangles.
|
||||||
/// @param[in,out] solid An initialized heightfield.
|
/// @param[in,out] solid An initialized heightfield.
|
||||||
/// @param[in] flagMergeThr The distance where the walkable flag is favored over the non-walkable flag.
|
/// @param[in] flagMergeThr The distance where the walkable flag is favored over the non-walkable flag.
|
||||||
/// [Limit: >= 0] [Units: vx]
|
/// [Limit: >= 0] [Units: vx]
|
||||||
/// @returns True if the operation completed successfully.
|
/// @returns True if the operation completed successfully.
|
||||||
bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
|
bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
|
||||||
@@ -885,7 +882,7 @@ bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
|
|||||||
/// @param[in] areas The area id's of the triangles. [Limit: <= #RC_WALKABLE_AREA] [Size: @p nt]
|
/// @param[in] areas The area id's of the triangles. [Limit: <= #RC_WALKABLE_AREA] [Size: @p nt]
|
||||||
/// @param[in] nt The number of triangles.
|
/// @param[in] nt The number of triangles.
|
||||||
/// @param[in,out] solid An initialized heightfield.
|
/// @param[in,out] solid An initialized heightfield.
|
||||||
/// @param[in] flagMergeThr The distance where the walkable flag is favored over the non-walkable flag.
|
/// @param[in] flagMergeThr The distance where the walkable flag is favored over the non-walkable flag.
|
||||||
/// [Limit: >= 0] [Units: vx]
|
/// [Limit: >= 0] [Units: vx]
|
||||||
/// @returns True if the operation completed successfully.
|
/// @returns True if the operation completed successfully.
|
||||||
bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
|
bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
|
||||||
@@ -899,35 +896,35 @@ bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv,
|
|||||||
/// @param[in] areas The area id's of the triangles. [Limit: <= #RC_WALKABLE_AREA] [Size: @p nt]
|
/// @param[in] areas The area id's of the triangles. [Limit: <= #RC_WALKABLE_AREA] [Size: @p nt]
|
||||||
/// @param[in] nt The number of triangles.
|
/// @param[in] nt The number of triangles.
|
||||||
/// @param[in,out] solid An initialized heightfield.
|
/// @param[in,out] solid An initialized heightfield.
|
||||||
/// @param[in] flagMergeThr The distance where the walkable flag is favored over the non-walkable flag.
|
/// @param[in] flagMergeThr The distance where the walkable flag is favored over the non-walkable flag.
|
||||||
/// [Limit: >= 0] [Units: vx]
|
/// [Limit: >= 0] [Units: vx]
|
||||||
/// @returns True if the operation completed successfully.
|
/// @returns True if the operation completed successfully.
|
||||||
bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const unsigned char* areas, const int nt,
|
bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const unsigned char* areas, const int nt,
|
||||||
rcHeightfield& solid, const int flagMergeThr = 1);
|
rcHeightfield& solid, const int flagMergeThr = 1);
|
||||||
|
|
||||||
/// Marks non-walkable spans as walkable if their maximum is within @p walkableClimp of a walkable neighbor.
|
/// Marks non-walkable spans as walkable if their maximum is within @p walkableClimp of a walkable neighbor.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable.
|
/// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable.
|
||||||
/// [Limit: >=0] [Units: vx]
|
/// [Limit: >=0] [Units: vx]
|
||||||
/// @param[in,out] solid A fully built heightfield. (All spans have been added.)
|
/// @param[in,out] solid A fully built heightfield. (All spans have been added.)
|
||||||
void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb, rcHeightfield& solid);
|
void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb, rcHeightfield& solid);
|
||||||
|
|
||||||
/// Marks spans that are ledges as not-walkable.
|
/// Marks spans that are ledges as not-walkable.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area to
|
/// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area to
|
||||||
/// be considered walkable. [Limit: >= 3] [Units: vx]
|
/// be considered walkable. [Limit: >= 3] [Units: vx]
|
||||||
/// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable.
|
/// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable.
|
||||||
/// [Limit: >=0] [Units: vx]
|
/// [Limit: >=0] [Units: vx]
|
||||||
/// @param[in,out] solid A fully built heightfield. (All spans have been added.)
|
/// @param[in,out] solid A fully built heightfield. (All spans have been added.)
|
||||||
void rcFilterLedgeSpans(rcContext* ctx, const int walkableHeight,
|
void rcFilterLedgeSpans(rcContext* ctx, const int walkableHeight,
|
||||||
const int walkableClimb, rcHeightfield& solid);
|
const int walkableClimb, rcHeightfield& solid);
|
||||||
|
|
||||||
/// Marks walkable spans as not walkable if the clearence above the span is less than the specified height.
|
/// Marks walkable spans as not walkable if the clearence above the span is less than the specified height.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area to
|
/// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area to
|
||||||
/// be considered walkable. [Limit: >= 3] [Units: vx]
|
/// be considered walkable. [Limit: >= 3] [Units: vx]
|
||||||
/// @param[in,out] solid A fully built heightfield. (All spans have been added.)
|
/// @param[in,out] solid A fully built heightfield. (All spans have been added.)
|
||||||
void rcFilterWalkableLowHeightSpans(rcContext* ctx, int walkableHeight, rcHeightfield& solid);
|
void rcFilterWalkableLowHeightSpans(rcContext* ctx, int walkableHeight, rcHeightfield& solid);
|
||||||
@@ -947,9 +944,9 @@ int rcGetHeightFieldSpanCount(rcContext* ctx, rcHeightfield& hf);
|
|||||||
/// Builds a compact heightfield representing open space, from a heightfield representing solid space.
|
/// Builds a compact heightfield representing open space, from a heightfield representing solid space.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area
|
/// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area
|
||||||
/// to be considered walkable. [Limit: >= 3] [Units: vx]
|
/// to be considered walkable. [Limit: >= 3] [Units: vx]
|
||||||
/// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable.
|
/// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable.
|
||||||
/// [Limit: >=0] [Units: vx]
|
/// [Limit: >=0] [Units: vx]
|
||||||
/// @param[in] hf The heightfield to be compacted.
|
/// @param[in] hf The heightfield to be compacted.
|
||||||
/// @param[out] chf The resulting compact heightfield. (Must be pre-allocated.)
|
/// @param[out] chf The resulting compact heightfield. (Must be pre-allocated.)
|
||||||
@@ -957,7 +954,7 @@ int rcGetHeightFieldSpanCount(rcContext* ctx, rcHeightfield& hf);
|
|||||||
bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const int walkableClimb,
|
bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const int walkableClimb,
|
||||||
rcHeightfield& hf, rcCompactHeightfield& chf);
|
rcHeightfield& hf, rcCompactHeightfield& chf);
|
||||||
|
|
||||||
/// Erodes the walkable area within the heightfield by the specified radius.
|
/// Erodes the walkable area within the heightfield by the specified radius.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in] radius The radius of erosion. [Limits: 0 < value < 255] [Units: vx]
|
/// @param[in] radius The radius of erosion. [Limits: 0 < value < 255] [Units: vx]
|
||||||
@@ -972,7 +969,7 @@ bool rcErodeWalkableArea(rcContext* ctx, int radius, rcCompactHeightfield& chf);
|
|||||||
/// @returns True if the operation completed successfully.
|
/// @returns True if the operation completed successfully.
|
||||||
bool rcMedianFilterWalkableArea(rcContext* ctx, rcCompactHeightfield& chf);
|
bool rcMedianFilterWalkableArea(rcContext* ctx, rcCompactHeightfield& chf);
|
||||||
|
|
||||||
/// Applies an area id to all spans within the specified bounding box. (AABB)
|
/// Applies an area id to all spans within the specified bounding box. (AABB)
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in] bmin The minimum of the bounding box. [(x, y, z)]
|
/// @param[in] bmin The minimum of the bounding box. [(x, y, z)]
|
||||||
@@ -982,7 +979,7 @@ bool rcMedianFilterWalkableArea(rcContext* ctx, rcCompactHeightfield& chf);
|
|||||||
void rcMarkBoxArea(rcContext* ctx, const float* bmin, const float* bmax, unsigned char areaId,
|
void rcMarkBoxArea(rcContext* ctx, const float* bmin, const float* bmax, unsigned char areaId,
|
||||||
rcCompactHeightfield& chf);
|
rcCompactHeightfield& chf);
|
||||||
|
|
||||||
/// Applies the area id to the all spans within the specified convex polygon.
|
/// Applies the area id to the all spans within the specified convex polygon.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in] verts The vertices of the polygon [Fomr: (x, y, z) * @p nverts]
|
/// @param[in] verts The vertices of the polygon [Fomr: (x, y, z) * @p nverts]
|
||||||
@@ -1008,7 +1005,7 @@ int rcOffsetPoly(const float* verts, const int nverts, const float offset,
|
|||||||
/// Applies the area id to all spans within the specified cylinder.
|
/// Applies the area id to all spans within the specified cylinder.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in] pos The center of the base of the cylinder. [Form: (x, y, z)]
|
/// @param[in] pos The center of the base of the cylinder. [Form: (x, y, z)]
|
||||||
/// @param[in] r The radius of the cylinder.
|
/// @param[in] r The radius of the cylinder.
|
||||||
/// @param[in] h The height of the cylinder.
|
/// @param[in] h The height of the cylinder.
|
||||||
/// @param[in] areaId The area id to apply. [Limit: <= #RC_WALKABLE_AREA]
|
/// @param[in] areaId The area id to apply. [Limit: <= #RC_WALKABLE_AREA]
|
||||||
@@ -1017,7 +1014,7 @@ void rcMarkCylinderArea(rcContext* ctx, const float* pos,
|
|||||||
const float r, const float h, unsigned char areaId,
|
const float r, const float h, unsigned char areaId,
|
||||||
rcCompactHeightfield& chf);
|
rcCompactHeightfield& chf);
|
||||||
|
|
||||||
/// Builds the distance field for the specified compact heightfield.
|
/// Builds the distance field for the specified compact heightfield.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in,out] chf A populated compact heightfield.
|
/// @param[in,out] chf A populated compact heightfield.
|
||||||
@@ -1033,7 +1030,7 @@ bool rcBuildDistanceField(rcContext* ctx, rcCompactHeightfield& chf);
|
|||||||
/// @param[in] minRegionArea The minimum number of cells allowed to form isolated island areas.
|
/// @param[in] minRegionArea The minimum number of cells allowed to form isolated island areas.
|
||||||
/// [Limit: >=0] [Units: vx].
|
/// [Limit: >=0] [Units: vx].
|
||||||
/// @param[in] mergeRegionArea Any regions with a span count smaller than this value will, if possible,
|
/// @param[in] mergeRegionArea Any regions with a span count smaller than this value will, if possible,
|
||||||
/// be merged with larger regions. [Limit: >=0] [Units: vx]
|
/// be merged with larger regions. [Limit: >=0] [Units: vx]
|
||||||
/// @returns True if the operation completed successfully.
|
/// @returns True if the operation completed successfully.
|
||||||
bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf,
|
bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf,
|
||||||
const int borderSize, const int minRegionArea, const int mergeRegionArea);
|
const int borderSize, const int minRegionArea, const int mergeRegionArea);
|
||||||
@@ -1051,15 +1048,15 @@ bool rcBuildLayerRegions(rcContext* ctx, rcCompactHeightfield& chf,
|
|||||||
const int borderSize, const int minRegionArea);
|
const int borderSize, const int minRegionArea);
|
||||||
|
|
||||||
/// Builds region data for the heightfield using simple monotone partitioning.
|
/// Builds region data for the heightfield using simple monotone partitioning.
|
||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in,out] chf A populated compact heightfield.
|
/// @param[in,out] chf A populated compact heightfield.
|
||||||
/// @param[in] borderSize The size of the non-navigable border around the heightfield.
|
/// @param[in] borderSize The size of the non-navigable border around the heightfield.
|
||||||
/// [Limit: >=0] [Units: vx]
|
/// [Limit: >=0] [Units: vx]
|
||||||
/// @param[in] minRegionArea The minimum number of cells allowed to form isolated island areas.
|
/// @param[in] minRegionArea The minimum number of cells allowed to form isolated island areas.
|
||||||
/// [Limit: >=0] [Units: vx].
|
/// [Limit: >=0] [Units: vx].
|
||||||
/// @param[in] mergeRegionArea Any regions with a span count smaller than this value will, if possible,
|
/// @param[in] mergeRegionArea Any regions with a span count smaller than this value will, if possible,
|
||||||
/// be merged with larger regions. [Limit: >=0] [Units: vx]
|
/// be merged with larger regions. [Limit: >=0] [Units: vx]
|
||||||
/// @returns True if the operation completed successfully.
|
/// @returns True if the operation completed successfully.
|
||||||
bool rcBuildRegionsMonotone(rcContext* ctx, rcCompactHeightfield& chf,
|
bool rcBuildRegionsMonotone(rcContext* ctx, rcCompactHeightfield& chf,
|
||||||
const int borderSize, const int minRegionArea, const int mergeRegionArea);
|
const int borderSize, const int minRegionArea, const int mergeRegionArea);
|
||||||
@@ -1125,13 +1122,13 @@ inline int rcGetDirForOffset(int x, int y)
|
|||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in] chf A fully built compact heightfield.
|
/// @param[in] chf A fully built compact heightfield.
|
||||||
/// @param[in] borderSize The size of the non-navigable border around the heightfield. [Limit: >=0]
|
/// @param[in] borderSize The size of the non-navigable border around the heightfield. [Limit: >=0]
|
||||||
/// [Units: vx]
|
/// [Units: vx]
|
||||||
/// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area
|
/// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area
|
||||||
/// to be considered walkable. [Limit: >= 3] [Units: vx]
|
/// to be considered walkable. [Limit: >= 3] [Units: vx]
|
||||||
/// @param[out] lset The resulting layer set. (Must be pre-allocated.)
|
/// @param[out] lset The resulting layer set. (Must be pre-allocated.)
|
||||||
/// @returns True if the operation completed successfully.
|
/// @returns True if the operation completed successfully.
|
||||||
bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
||||||
const int borderSize, const int walkableHeight,
|
const int borderSize, const int walkableHeight,
|
||||||
rcHeightfieldLayerSet& lset);
|
rcHeightfieldLayerSet& lset);
|
||||||
|
|
||||||
@@ -1139,9 +1136,9 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
|
|||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in] chf A fully built compact heightfield.
|
/// @param[in] chf A fully built compact heightfield.
|
||||||
/// @param[in] maxError The maximum distance a simplfied contour's border edges should deviate
|
/// @param[in] maxError The maximum distance a simplfied contour's border edges should deviate
|
||||||
/// the original raw contour. [Limit: >=0] [Units: wu]
|
/// the original raw contour. [Limit: >=0] [Units: wu]
|
||||||
/// @param[in] maxEdgeLen The maximum allowed length for contour edges along the border of the mesh.
|
/// @param[in] maxEdgeLen The maximum allowed length for contour edges along the border of the mesh.
|
||||||
/// [Limit: >=0] [Units: vx]
|
/// [Limit: >=0] [Units: vx]
|
||||||
/// @param[out] cset The resulting contour set. (Must be pre-allocated.)
|
/// @param[out] cset The resulting contour set. (Must be pre-allocated.)
|
||||||
/// @param[in] buildFlags The build flags. (See: #rcBuildContoursFlags)
|
/// @param[in] buildFlags The build flags. (See: #rcBuildContoursFlags)
|
||||||
@@ -1154,8 +1151,8 @@ bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf,
|
|||||||
/// @ingroup recast
|
/// @ingroup recast
|
||||||
/// @param[in,out] ctx The build context to use during the operation.
|
/// @param[in,out] ctx The build context to use during the operation.
|
||||||
/// @param[in] cset A fully built contour set.
|
/// @param[in] cset A fully built contour set.
|
||||||
/// @param[in] nvp The maximum number of vertices allowed for polygons generated during the
|
/// @param[in] nvp The maximum number of vertices allowed for polygons generated during the
|
||||||
/// contour to polygon conversion process. [Limit: >= 3]
|
/// contour to polygon conversion process. [Limit: >= 3]
|
||||||
/// @param[out] mesh The resulting polygon mesh. (Must be re-allocated.)
|
/// @param[out] mesh The resulting polygon mesh. (Must be re-allocated.)
|
||||||
/// @returns True if the operation completed successfully.
|
/// @returns True if the operation completed successfully.
|
||||||
bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMesh& mesh);
|
bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMesh& mesh);
|
||||||
@@ -1175,7 +1172,7 @@ bool rcMergePolyMeshes(rcContext* ctx, rcPolyMesh** meshes, const int nmeshes, r
|
|||||||
/// @param[in] mesh A fully built polygon mesh.
|
/// @param[in] mesh A fully built polygon mesh.
|
||||||
/// @param[in] chf The compact heightfield used to build the polygon mesh.
|
/// @param[in] chf The compact heightfield used to build the polygon mesh.
|
||||||
/// @param[in] sampleDist Sets the distance to use when samping the heightfield. [Limit: >=0] [Units: wu]
|
/// @param[in] sampleDist Sets the distance to use when samping the heightfield. [Limit: >=0] [Units: wu]
|
||||||
/// @param[in] sampleMaxError The maximum distance the detail mesh surface should deviate from
|
/// @param[in] sampleMaxError The maximum distance the detail mesh surface should deviate from
|
||||||
/// heightfield data. [Limit: >=0] [Units: wu]
|
/// heightfield data. [Limit: >=0] [Units: wu]
|
||||||
/// @param[out] dmesh The resulting detail mesh. (Must be pre-allocated.)
|
/// @param[out] dmesh The resulting detail mesh. (Must be pre-allocated.)
|
||||||
/// @returns True if the operation completed successfully.
|
/// @returns True if the operation completed successfully.
|
||||||
@@ -1206,6 +1203,6 @@ bool rcMergePolyMeshDetails(rcContext* ctx, rcPolyMeshDetail** meshes, const int
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Due to the large amount of detail documentation for this file,
|
// Due to the large amount of detail documentation for this file,
|
||||||
// the content normally located at the end of the header file has been separated
|
// the content normally located at the end of the header file has been separated
|
||||||
// out to a file in /Docs/Extern.
|
// out to a file in /Docs/Extern.
|
||||||
|
|||||||
60
deps/recastnavigation/Recast/Source/Recast.cpp
vendored
60
deps/recastnavigation/Recast/Source/Recast.cpp
vendored
@@ -59,13 +59,13 @@ float rcSqrt(float x)
|
|||||||
/// @class rcContext
|
/// @class rcContext
|
||||||
/// @par
|
/// @par
|
||||||
///
|
///
|
||||||
/// This class does not provide logging or timer functionality on its
|
/// This class does not provide logging or timer functionality on its
|
||||||
/// own. Both must be provided by a concrete implementation
|
/// own. Both must be provided by a concrete implementation
|
||||||
/// by overriding the protected member functions. Also, this class does not
|
/// by overriding the protected member functions. Also, this class does not
|
||||||
/// provide an interface for extracting log messages. (Only adding them.)
|
/// provide an interface for extracting log messages. (Only adding them.)
|
||||||
/// So concrete implementations must provide one.
|
/// So concrete implementations must provide one.
|
||||||
///
|
///
|
||||||
/// If no logging or timers are required, just pass an instance of this
|
/// If no logging or timers are required, just pass an instance of this
|
||||||
/// class through the Recast build process.
|
/// class through the Recast build process.
|
||||||
///
|
///
|
||||||
|
|
||||||
@@ -293,14 +293,14 @@ void rcCalcGridSize(const float* bmin, const float* bmax, float cs, int* w, int*
|
|||||||
/// @par
|
/// @par
|
||||||
///
|
///
|
||||||
/// See the #rcConfig documentation for more information on the configuration parameters.
|
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||||
///
|
///
|
||||||
/// @see rcAllocHeightfield, rcHeightfield
|
/// @see rcAllocHeightfield, rcHeightfield
|
||||||
bool rcCreateHeightfield(rcContext* ctx, rcHeightfield& hf, int width, int height,
|
bool rcCreateHeightfield(rcContext* ctx, rcHeightfield& hf, int width, int height,
|
||||||
const float* bmin, const float* bmax,
|
const float* bmin, const float* bmax,
|
||||||
float cs, float ch)
|
float cs, float ch)
|
||||||
{
|
{
|
||||||
rcIgnoreUnused(ctx);
|
rcIgnoreUnused(ctx);
|
||||||
|
|
||||||
hf.width = width;
|
hf.width = width;
|
||||||
hf.height = height;
|
hf.height = height;
|
||||||
rcVcopy(hf.bmin, bmin);
|
rcVcopy(hf.bmin, bmin);
|
||||||
@@ -327,29 +327,29 @@ static void calcTriNormal(const float* v0, const float* v1, const float* v2, flo
|
|||||||
///
|
///
|
||||||
/// Only sets the area id's for the walkable triangles. Does not alter the
|
/// Only sets the area id's for the walkable triangles. Does not alter the
|
||||||
/// area id's for unwalkable triangles.
|
/// area id's for unwalkable triangles.
|
||||||
///
|
///
|
||||||
/// See the #rcConfig documentation for more information on the configuration parameters.
|
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||||
///
|
///
|
||||||
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
|
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
|
||||||
void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
|
void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
|
||||||
const float* verts, int nv,
|
const float* verts, int nv,
|
||||||
const int* tris, int nt,
|
const int* tris, int nt,
|
||||||
unsigned char* areas, unsigned char areaType)
|
unsigned char* areas)
|
||||||
{
|
{
|
||||||
rcIgnoreUnused(ctx);
|
rcIgnoreUnused(ctx);
|
||||||
rcIgnoreUnused(nv);
|
rcIgnoreUnused(nv);
|
||||||
|
|
||||||
const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
|
const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
|
||||||
|
|
||||||
float norm[3];
|
float norm[3];
|
||||||
|
|
||||||
for (int i = 0; i < nt; ++i)
|
for (int i = 0; i < nt; ++i)
|
||||||
{
|
{
|
||||||
const int* tri = &tris[i*3];
|
const int* tri = &tris[i*3];
|
||||||
calcTriNormal(&verts[tri[0]*3], &verts[tri[1]*3], &verts[tri[2]*3], norm);
|
calcTriNormal(&verts[tri[0]*3], &verts[tri[1]*3], &verts[tri[2]*3], norm);
|
||||||
// Check if the face is walkable.
|
// Check if the face is walkable.
|
||||||
if (norm[1] > walkableThr)
|
if (norm[1] > walkableThr)
|
||||||
areas[i] = areaType;
|
areas[i] = RC_WALKABLE_AREA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,9 +357,9 @@ void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
|
|||||||
///
|
///
|
||||||
/// Only sets the area id's for the unwalkable triangles. Does not alter the
|
/// Only sets the area id's for the unwalkable triangles. Does not alter the
|
||||||
/// area id's for walkable triangles.
|
/// area id's for walkable triangles.
|
||||||
///
|
///
|
||||||
/// See the #rcConfig documentation for more information on the configuration parameters.
|
/// See the #rcConfig documentation for more information on the configuration parameters.
|
||||||
///
|
///
|
||||||
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
|
/// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles
|
||||||
void rcClearUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
|
void rcClearUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
|
||||||
const float* verts, int /*nv*/,
|
const float* verts, int /*nv*/,
|
||||||
@@ -367,11 +367,11 @@ void rcClearUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
|
|||||||
unsigned char* areas)
|
unsigned char* areas)
|
||||||
{
|
{
|
||||||
rcIgnoreUnused(ctx);
|
rcIgnoreUnused(ctx);
|
||||||
|
|
||||||
const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
|
const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI);
|
||||||
|
|
||||||
float norm[3];
|
float norm[3];
|
||||||
|
|
||||||
for (int i = 0; i < nt; ++i)
|
for (int i = 0; i < nt; ++i)
|
||||||
{
|
{
|
||||||
const int* tri = &tris[i*3];
|
const int* tri = &tris[i*3];
|
||||||
@@ -385,7 +385,7 @@ void rcClearUnwalkableTriangles(rcContext* ctx, const float walkableSlopeAngle,
|
|||||||
int rcGetHeightFieldSpanCount(rcContext* ctx, rcHeightfield& hf)
|
int rcGetHeightFieldSpanCount(rcContext* ctx, rcHeightfield& hf)
|
||||||
{
|
{
|
||||||
rcIgnoreUnused(ctx);
|
rcIgnoreUnused(ctx);
|
||||||
|
|
||||||
const int w = hf.width;
|
const int w = hf.width;
|
||||||
const int h = hf.height;
|
const int h = hf.height;
|
||||||
int spanCount = 0;
|
int spanCount = 0;
|
||||||
@@ -416,9 +416,9 @@ bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const i
|
|||||||
rcHeightfield& hf, rcCompactHeightfield& chf)
|
rcHeightfield& hf, rcCompactHeightfield& chf)
|
||||||
{
|
{
|
||||||
rcAssert(ctx);
|
rcAssert(ctx);
|
||||||
|
|
||||||
rcScopedTimer timer(ctx, RC_TIMER_BUILD_COMPACTHEIGHTFIELD);
|
rcScopedTimer timer(ctx, RC_TIMER_BUILD_COMPACTHEIGHTFIELD);
|
||||||
|
|
||||||
const int w = hf.width;
|
const int w = hf.width;
|
||||||
const int h = hf.height;
|
const int h = hf.height;
|
||||||
const int spanCount = rcGetHeightFieldSpanCount(ctx, hf);
|
const int spanCount = rcGetHeightFieldSpanCount(ctx, hf);
|
||||||
@@ -456,9 +456,9 @@ bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const i
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memset(chf.areas, RC_NULL_AREA, sizeof(unsigned char)*spanCount);
|
memset(chf.areas, RC_NULL_AREA, sizeof(unsigned char)*spanCount);
|
||||||
|
|
||||||
const int MAX_HEIGHT = 0xffff;
|
const int MAX_HEIGHT = 0xffff;
|
||||||
|
|
||||||
// Fill in cells and spans.
|
// Fill in cells and spans.
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (int y = 0; y < h; ++y)
|
for (int y = 0; y < h; ++y)
|
||||||
@@ -499,7 +499,7 @@ bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const i
|
|||||||
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
|
||||||
{
|
{
|
||||||
rcCompactSpan& s = chf.spans[i];
|
rcCompactSpan& s = chf.spans[i];
|
||||||
|
|
||||||
for (int dir = 0; dir < 4; ++dir)
|
for (int dir = 0; dir < 4; ++dir)
|
||||||
{
|
{
|
||||||
rcSetCon(s, dir, RC_NOT_CONNECTED);
|
rcSetCon(s, dir, RC_NOT_CONNECTED);
|
||||||
@@ -508,7 +508,7 @@ bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const i
|
|||||||
// First check that the neighbour cell is in bounds.
|
// First check that the neighbour cell is in bounds.
|
||||||
if (nx < 0 || ny < 0 || nx >= w || ny >= h)
|
if (nx < 0 || ny < 0 || nx >= w || ny >= h)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Iterate over all neighbour spans and check if any of the is
|
// Iterate over all neighbour spans and check if any of the is
|
||||||
// accessible from current cell.
|
// accessible from current cell.
|
||||||
const rcCompactCell& nc = chf.cells[nx+ny*w];
|
const rcCompactCell& nc = chf.cells[nx+ny*w];
|
||||||
@@ -533,18 +533,18 @@ bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const i
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tooHighNeighbour > MAX_LAYERS)
|
if (tooHighNeighbour > MAX_LAYERS)
|
||||||
{
|
{
|
||||||
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Heightfield has too many layers %d (max: %d)",
|
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Heightfield has too many layers %d (max: %d)",
|
||||||
tooHighNeighbour, MAX_LAYERS);
|
tooHighNeighbour, MAX_LAYERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,7 +554,7 @@ static int getHeightfieldMemoryUsage(const rcHeightfield& hf)
|
|||||||
int size = 0;
|
int size = 0;
|
||||||
size += sizeof(hf);
|
size += sizeof(hf);
|
||||||
size += hf.width * hf.height * sizeof(rcSpan*);
|
size += hf.width * hf.height * sizeof(rcSpan*);
|
||||||
|
|
||||||
rcSpanPool* pool = hf.pools;
|
rcSpanPool* pool = hf.pools;
|
||||||
while (pool)
|
while (pool)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#define SIZE_OF_GRIDS 533.3333f
|
#define SIZE_OF_GRIDS 533.3333f
|
||||||
|
|
||||||
#define MMAP_MAGIC 0x4d4d4150 // 'MMAP'
|
#define MMAP_MAGIC 0x4d4d4150 // 'MMAP'
|
||||||
#define MMAP_VERSION 14
|
#define MMAP_VERSION 15
|
||||||
|
|
||||||
struct MmapTileHeader
|
struct MmapTileHeader
|
||||||
{
|
{
|
||||||
@@ -36,27 +36,18 @@ static_assert(sizeof(MmapTileHeader) == (sizeof(MmapTileHeader::mmapMagic) +
|
|||||||
sizeof(MmapTileHeader::usesLiquids) +
|
sizeof(MmapTileHeader::usesLiquids) +
|
||||||
sizeof(MmapTileHeader::padding)), "MmapTileHeader has uninitialized padding fields");
|
sizeof(MmapTileHeader::padding)), "MmapTileHeader has uninitialized padding fields");
|
||||||
|
|
||||||
enum NavArea
|
enum NavTerrain
|
||||||
{
|
{
|
||||||
NAV_AREA_EMPTY = 0,
|
NAV_EMPTY = 0x00,
|
||||||
// areas 1-60 will be used for destructible areas (currently skipped in vmaps, WMO with flag 1)
|
NAV_GROUND = 0x01,
|
||||||
// ground is the highest value to make recast choose ground over water when merging surfaces very close to each other (shallow water would be walkable)
|
NAV_MAGMA = 0x02,
|
||||||
NAV_AREA_GROUND = 11,
|
NAV_SLIME = 0x04,
|
||||||
NAV_AREA_GROUND_STEEP = 10,
|
NAV_WATER = 0x08,
|
||||||
NAV_AREA_WATER = 9,
|
NAV_UNUSED1 = 0x10,
|
||||||
NAV_AREA_MAGMA_SLIME = 8, // don't need to differentiate between them
|
NAV_UNUSED2 = 0x20,
|
||||||
NAV_AREA_MAX_VALUE = NAV_AREA_GROUND,
|
NAV_UNUSED3 = 0x40,
|
||||||
NAV_AREA_MIN_VALUE = NAV_AREA_MAGMA_SLIME,
|
NAV_UNUSED4 = 0x80
|
||||||
NAV_AREA_ALL_MASK = 0x3F // max allowed value
|
// we only have 8 bits
|
||||||
};
|
|
||||||
|
|
||||||
enum NavTerrainFlag
|
|
||||||
{
|
|
||||||
NAV_EMPTY = 0x00,
|
|
||||||
NAV_GROUND = 1 << (NAV_AREA_MAX_VALUE - NAV_AREA_GROUND),
|
|
||||||
NAV_GROUND_STEEP = 1 << (NAV_AREA_MAX_VALUE - NAV_AREA_GROUND_STEEP),
|
|
||||||
NAV_WATER = 1 << (NAV_AREA_MAX_VALUE - NAV_AREA_WATER),
|
|
||||||
NAV_MAGMA_SLIME = 1 << (NAV_AREA_MAX_VALUE - NAV_AREA_MAGMA_SLIME)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _MAPDEFINES_H */
|
#endif /* _MAPDEFINES_H */
|
||||||
|
|||||||
@@ -3595,6 +3595,16 @@ Calculate.Creature.Zone.Area.Data = 0
|
|||||||
|
|
||||||
Calculate.Gameoject.Zone.Area.Data = 0
|
Calculate.Gameoject.Zone.Area.Data = 0
|
||||||
|
|
||||||
|
#
|
||||||
|
# Group.Raid.LevelRestriction
|
||||||
|
#
|
||||||
|
# The Group members need to the same, or higher level than the specified value.
|
||||||
|
# Minimum level is 10.
|
||||||
|
# Default: 10
|
||||||
|
#
|
||||||
|
|
||||||
|
Group.Raid.LevelRestriction = 10
|
||||||
|
|
||||||
#
|
#
|
||||||
# LFG.Location.All
|
# LFG.Location.All
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "Battleground.h"
|
#include "Battleground.h"
|
||||||
#include "BattlegroundMgr.h"
|
#include "BattlegroundMgr.h"
|
||||||
|
#include "Config.h"
|
||||||
#include "DatabaseEnv.h"
|
#include "DatabaseEnv.h"
|
||||||
#include "GameTime.h"
|
#include "GameTime.h"
|
||||||
#include "GroupMgr.h"
|
#include "GroupMgr.h"
|
||||||
@@ -278,6 +279,16 @@ void Group::ConvertToLFG(bool restricted /*= true*/)
|
|||||||
SendUpdate();
|
SendUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Group::CheckLevelForRaid()
|
||||||
|
{
|
||||||
|
for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr)
|
||||||
|
if (Player* player = ObjectAccessor::FindPlayer(citr->guid))
|
||||||
|
if (player->getLevel() < sConfigMgr->GetOption<int32>("Group.Raid.LevelRestriction", 10))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Group::ConvertToRaid()
|
void Group::ConvertToRaid()
|
||||||
{
|
{
|
||||||
m_groupType = GroupType(m_groupType | GROUPTYPE_RAID);
|
m_groupType = GroupType(m_groupType | GROUPTYPE_RAID);
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ public:
|
|||||||
uint8 GetMemberGroup(ObjectGuid guid) const;
|
uint8 GetMemberGroup(ObjectGuid guid) const;
|
||||||
|
|
||||||
void ConvertToLFG(bool restricted = true);
|
void ConvertToLFG(bool restricted = true);
|
||||||
|
bool CheckLevelForRaid();
|
||||||
void ConvertToRaid();
|
void ConvertToRaid();
|
||||||
|
|
||||||
void SetBattlegroundGroup(Battleground* bg);
|
void SetBattlegroundGroup(Battleground* bg);
|
||||||
|
|||||||
@@ -621,6 +621,12 @@ void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket& /*recvData*/)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/** error handling **/
|
/** error handling **/
|
||||||
|
if (group->CheckLevelForRaid())
|
||||||
|
{
|
||||||
|
SendPartyResult(PARTY_OP_INVITE, "", ERR_RAID_DISALLOWED_BY_LEVEL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!group->IsLeader(GetPlayer()->GetGUID()) || group->GetMembersCount() < 2 || group->isLFGGroup()) // pussywizard: not allowed for lfg groups, it is either raid from the beginning or not!
|
if (!group->IsLeader(GetPlayer()->GetGUID()) || group->GetMembersCount() < 2 || group->isLFGGroup()) // pussywizard: not allowed for lfg groups, it is either raid from the beginning or not!
|
||||||
return;
|
return;
|
||||||
/********************/
|
/********************/
|
||||||
|
|||||||
@@ -641,12 +641,12 @@ void PathGenerator::CreateFilter()
|
|||||||
|
|
||||||
// creatures don't take environmental damage
|
// creatures don't take environmental damage
|
||||||
if (creature->CanEnterWater())
|
if (creature->CanEnterWater())
|
||||||
includeFlags |= (NAV_WATER | NAV_MAGMA_SLIME);
|
includeFlags |= (NAV_WATER | NAV_MAGMA);
|
||||||
}
|
}
|
||||||
else // assume Player
|
else // assume Player
|
||||||
{
|
{
|
||||||
// perfect support not possible, just stay 'safe'
|
// perfect support not possible, just stay 'safe'
|
||||||
includeFlags |= (NAV_GROUND | NAV_WATER | NAV_MAGMA_SLIME);
|
includeFlags |= (NAV_GROUND | NAV_WATER | NAV_MAGMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
_filter.setIncludeFlags(includeFlags);
|
_filter.setIncludeFlags(includeFlags);
|
||||||
@@ -671,17 +671,13 @@ void PathGenerator::UpdateFilter()
|
|||||||
_filter.setIncludeFlags(includedFlags);
|
_filter.setIncludeFlags(includedFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Creature const* _sourceCreature = _source->ToCreature())
|
/*if (Creature const* _sourceCreature = _source->ToCreature())
|
||||||
{
|
|
||||||
if (_sourceCreature->IsInCombat() || _sourceCreature->IsInEvadeMode())
|
if (_sourceCreature->IsInCombat() || _sourceCreature->IsInEvadeMode())
|
||||||
{
|
_filter.setIncludeFlags(_filter.getIncludeFlags() | NAV_GROUND_STEEP);*/
|
||||||
_filter.setIncludeFlags(_filter.getIncludeFlags() | NAV_GROUND_STEEP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NavTerrainFlag PathGenerator::GetNavTerrain(float x, float y, float z) const
|
NavTerrain PathGenerator::GetNavTerrain(float x, float y, float z) const
|
||||||
{
|
{
|
||||||
LiquidData data;
|
LiquidData data;
|
||||||
LiquidData const& liquidData = _source->GetMap()->GetLiquidData(_source->GetPhaseMask(), x, y, z, _source->GetCollisionHeight(), MAP_ALL_LIQUIDS);
|
LiquidData const& liquidData = _source->GetMap()->GetLiquidData(_source->GetPhaseMask(), x, y, z, _source->GetCollisionHeight(), MAP_ALL_LIQUIDS);
|
||||||
@@ -695,7 +691,7 @@ NavTerrainFlag PathGenerator::GetNavTerrain(float x, float y, float z) const
|
|||||||
return NAV_WATER;
|
return NAV_WATER;
|
||||||
case MAP_LIQUID_TYPE_MAGMA:
|
case MAP_LIQUID_TYPE_MAGMA:
|
||||||
case MAP_LIQUID_TYPE_SLIME:
|
case MAP_LIQUID_TYPE_SLIME:
|
||||||
return NAV_MAGMA_SLIME;
|
return NAV_MAGMA;
|
||||||
default:
|
default:
|
||||||
return NAV_GROUND;
|
return NAV_GROUND;
|
||||||
}
|
}
|
||||||
@@ -1143,9 +1139,9 @@ bool PathGenerator::IsWaterPath(Movement::PointsArray pathPoints) const
|
|||||||
// Check both start and end points, if they're both in water, then we can *safely* let the creature move
|
// Check both start and end points, if they're both in water, then we can *safely* let the creature move
|
||||||
for (uint32 i = 0; i < pathPoints.size(); ++i)
|
for (uint32 i = 0; i < pathPoints.size(); ++i)
|
||||||
{
|
{
|
||||||
NavTerrainFlag terrain = GetNavTerrain(pathPoints[i].x, pathPoints[i].y, pathPoints[i].z);
|
NavTerrain terrain = GetNavTerrain(pathPoints[i].x, pathPoints[i].y, pathPoints[i].z);
|
||||||
// One of the points is not in the water
|
// One of the points is not in the water
|
||||||
if (terrain != NAV_MAGMA_SLIME && terrain != NAV_WATER)
|
if (terrain != NAV_MAGMA && terrain != NAV_WATER)
|
||||||
{
|
{
|
||||||
waterPath = false;
|
waterPath = false;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class PathGenerator
|
|||||||
void BuildPointPath(float const* startPoint, float const* endPoint);
|
void BuildPointPath(float const* startPoint, float const* endPoint);
|
||||||
void BuildShortcut();
|
void BuildShortcut();
|
||||||
|
|
||||||
[[nodiscard]] NavTerrainFlag GetNavTerrain(float x, float y, float z) const;
|
[[nodiscard]] NavTerrain GetNavTerrain(float x, float y, float z) const;
|
||||||
void CreateFilter();
|
void CreateFilter();
|
||||||
void UpdateFilter();
|
void UpdateFilter();
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace MMAP
|
|||||||
m_workerThread.join();
|
m_workerThread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
MapBuilder::MapBuilder(Optional<float> maxWalkableAngle, Optional<float> maxWalkableAngleNotSteep, bool skipLiquid,
|
MapBuilder::MapBuilder(float maxWalkableAngle, bool skipLiquid,
|
||||||
bool skipContinents, bool skipJunkMaps, bool skipBattlegrounds,
|
bool skipContinents, bool skipJunkMaps, bool skipBattlegrounds,
|
||||||
bool debugOutput, bool bigBaseUnit, int mapid, const char* offMeshFilePath, unsigned int threads) :
|
bool debugOutput, bool bigBaseUnit, int mapid, const char* offMeshFilePath, unsigned int threads) :
|
||||||
|
|
||||||
@@ -64,7 +64,6 @@ namespace MMAP
|
|||||||
m_skipBattlegrounds (skipBattlegrounds),
|
m_skipBattlegrounds (skipBattlegrounds),
|
||||||
m_skipLiquid (skipLiquid),
|
m_skipLiquid (skipLiquid),
|
||||||
m_maxWalkableAngle (maxWalkableAngle),
|
m_maxWalkableAngle (maxWalkableAngle),
|
||||||
m_maxWalkableAngleNotSteep (maxWalkableAngleNotSteep),
|
|
||||||
m_bigBaseUnit (bigBaseUnit),
|
m_bigBaseUnit (bigBaseUnit),
|
||||||
m_mapid (mapid),
|
m_mapid (mapid),
|
||||||
m_totalTiles (0u),
|
m_totalTiles (0u),
|
||||||
@@ -654,16 +653,9 @@ namespace MMAP
|
|||||||
|
|
||||||
// mark all walkable tiles, both liquids and solids
|
// mark all walkable tiles, both liquids and solids
|
||||||
|
|
||||||
/* we want to have triangles with slope less than walkableSlopeAngleNotSteep (<= 55) to have NAV_AREA_GROUND
|
|
||||||
* and with slope between walkableSlopeAngleNotSteep and walkableSlopeAngle (55 < .. <= 70) to have NAV_AREA_GROUND_STEEP.
|
|
||||||
* we achieve this using recast API: memset everything to NAV_AREA_GROUND_STEEP, call rcClearUnwalkableTriangles with 70 so
|
|
||||||
* any area above that will get RC_NULL_AREA (unwalkable), then call rcMarkWalkableTriangles with 55 to set NAV_AREA_GROUND
|
|
||||||
* on anything below 55 . Players and idle Creatures can use NAV_AREA_GROUND, while Creatures in combat can use NAV_AREA_GROUND_STEEP.
|
|
||||||
*/
|
|
||||||
unsigned char* triFlags = new unsigned char[tTriCount];
|
unsigned char* triFlags = new unsigned char[tTriCount];
|
||||||
memset(triFlags, NAV_AREA_GROUND_STEEP, tTriCount * sizeof(unsigned char));
|
memset(triFlags, NAV_GROUND, tTriCount * sizeof(unsigned char));
|
||||||
rcClearUnwalkableTriangles(m_rcContext, tileCfg.walkableSlopeAngle, tVerts, tVertCount, tTris, tTriCount, triFlags);
|
rcClearUnwalkableTriangles(m_rcContext, tileCfg.walkableSlopeAngle, tVerts, tVertCount, tTris, tTriCount, triFlags);
|
||||||
rcMarkWalkableTriangles(m_rcContext, tileCfg.walkableSlopeAngleNotSteep, tVerts, tVertCount, tTris, tTriCount, triFlags, NAV_AREA_GROUND);
|
|
||||||
rcRasterizeTriangles(m_rcContext, tVerts, tVertCount, tTris, triFlags, tTriCount, *tile.solid, config.walkableClimb);
|
rcRasterizeTriangles(m_rcContext, tVerts, tVertCount, tTris, triFlags, tTriCount, *tile.solid, config.walkableClimb);
|
||||||
delete[] triFlags;
|
delete[] triFlags;
|
||||||
|
|
||||||
@@ -769,15 +761,8 @@ namespace MMAP
|
|||||||
// set polygons as walkable
|
// set polygons as walkable
|
||||||
// TODO: special flags for DYNAMIC polygons, ie surfaces that can be turned on and off
|
// TODO: special flags for DYNAMIC polygons, ie surfaces that can be turned on and off
|
||||||
for (int i = 0; i < iv.polyMesh->npolys; ++i)
|
for (int i = 0; i < iv.polyMesh->npolys; ++i)
|
||||||
{
|
if (iv.polyMesh->areas[i] & RC_WALKABLE_AREA)
|
||||||
if (uint8 area = iv.polyMesh->areas[i] & NAV_AREA_ALL_MASK)
|
iv.polyMesh->flags[i] = iv.polyMesh->areas[i];
|
||||||
{
|
|
||||||
if (area >= NAV_AREA_MIN_VALUE)
|
|
||||||
iv.polyMesh->flags[i] = 1 << (NAV_AREA_MAX_VALUE - area);
|
|
||||||
else
|
|
||||||
iv.polyMesh->flags[i] = NAV_GROUND; // TODO: these will be dynamic in future
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// setup mesh parameters
|
// setup mesh parameters
|
||||||
dtNavMeshCreateParams params;
|
dtNavMeshCreateParams params;
|
||||||
@@ -1072,10 +1057,7 @@ namespace MMAP
|
|||||||
config.maxVertsPerPoly = DT_VERTS_PER_POLYGON;
|
config.maxVertsPerPoly = DT_VERTS_PER_POLYGON;
|
||||||
config.cs = tileConfig.BASE_UNIT_DIM;
|
config.cs = tileConfig.BASE_UNIT_DIM;
|
||||||
config.ch = tileConfig.BASE_UNIT_DIM;
|
config.ch = tileConfig.BASE_UNIT_DIM;
|
||||||
// Keeping these 2 slope angles the same reduces a lot the number of polys.
|
config.walkableSlopeAngle = m_maxWalkableAngle;
|
||||||
// 55 should be the minimum, maybe 70 is ok (keep in mind blink uses mmaps), 85 is too much for players
|
|
||||||
config.walkableSlopeAngle = m_maxWalkableAngle ? *m_maxWalkableAngle : 55;
|
|
||||||
config.walkableSlopeAngleNotSteep = m_maxWalkableAngleNotSteep ? *m_maxWalkableAngleNotSteep : 55;
|
|
||||||
config.tileSize = tileConfig.VERTEX_PER_TILE;
|
config.tileSize = tileConfig.VERTEX_PER_TILE;
|
||||||
config.walkableRadius = m_bigBaseUnit ? 1 : 2;
|
config.walkableRadius = m_bigBaseUnit ? 1 : 2;
|
||||||
config.borderSize = config.walkableRadius + 3;
|
config.borderSize = config.walkableRadius + 3;
|
||||||
|
|||||||
@@ -147,8 +147,7 @@ namespace MMAP
|
|||||||
{
|
{
|
||||||
friend class TileBuilder;
|
friend class TileBuilder;
|
||||||
public:
|
public:
|
||||||
MapBuilder(Optional<float> maxWalkableAngle,
|
MapBuilder(float maxWalkableAngle,
|
||||||
Optional<float> maxWalkableAngleNotSteep,
|
|
||||||
bool skipLiquid,
|
bool skipLiquid,
|
||||||
bool skipContinents,
|
bool skipContinents,
|
||||||
bool skipJunkMaps,
|
bool skipJunkMaps,
|
||||||
@@ -204,8 +203,7 @@ namespace MMAP
|
|||||||
bool m_skipBattlegrounds;
|
bool m_skipBattlegrounds;
|
||||||
bool m_skipLiquid;
|
bool m_skipLiquid;
|
||||||
|
|
||||||
Optional<float> m_maxWalkableAngle;
|
float m_maxWalkableAngle;
|
||||||
Optional<float> m_maxWalkableAngleNotSteep;
|
|
||||||
bool m_bigBaseUnit;
|
bool m_bigBaseUnit;
|
||||||
int32 m_mapid;
|
int32 m_mapid;
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace MMAP
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
if ((dp = readdir(dirp)) != nullptr)
|
if ((dp = readdir(dirp)) != nullptr)
|
||||||
{
|
{
|
||||||
if (strcmp(dp->d_name, ".") != 0 && strcmp(dp->d_name, "..") != 0 && matchWildcardFilter(filter.c_str(), dp->d_name))
|
if (matchWildcardFilter(filter.c_str(), dp->d_name))
|
||||||
fileList.emplace_back(dp->d_name);
|
fileList.emplace_back(dp->d_name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -17,26 +17,12 @@
|
|||||||
|
|
||||||
#include "MapBuilder.h"
|
#include "MapBuilder.h"
|
||||||
#include "PathCommon.h"
|
#include "PathCommon.h"
|
||||||
#include "Timer.h"
|
|
||||||
#include "DBCFileLoader.h"
|
|
||||||
#include "PathCommon.h"
|
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
#include "Timer.h"
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
using namespace MMAP;
|
using namespace MMAP;
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
std::unordered_map<uint32, uint8> _liquidTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 GetLiquidFlags(uint32 liquidId)
|
|
||||||
{
|
|
||||||
auto itr = _liquidTypes.find(liquidId);
|
|
||||||
return itr != _liquidTypes.end() ? (1 << itr->second) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool checkDirectories(bool debugOutput)
|
bool checkDirectories(bool debugOutput)
|
||||||
{
|
{
|
||||||
std::vector<std::string> dirFiles;
|
std::vector<std::string> dirFiles;
|
||||||
@@ -77,8 +63,7 @@ bool handleArgs(int argc, char** argv,
|
|||||||
int& mapnum,
|
int& mapnum,
|
||||||
int& tileX,
|
int& tileX,
|
||||||
int& tileY,
|
int& tileY,
|
||||||
Optional<float>& maxAngle,
|
float& maxAngle,
|
||||||
Optional<float>& maxAngleNotSteep,
|
|
||||||
bool& skipLiquid,
|
bool& skipLiquid,
|
||||||
bool& skipContinents,
|
bool& skipContinents,
|
||||||
bool& skipJunkMaps,
|
bool& skipJunkMaps,
|
||||||
@@ -100,23 +85,11 @@ bool handleArgs(int argc, char** argv,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
float maxangle = atof(param);
|
float maxangle = atof(param);
|
||||||
if (maxangle <= 90.f && maxangle >= 0.f)
|
if (maxangle <= 90.f && maxangle >= 45.f)
|
||||||
maxAngle = maxangle;
|
maxAngle = maxangle;
|
||||||
else
|
else
|
||||||
printf("invalid option for '--maxAngle', using default\n");
|
printf("invalid option for '--maxAngle', using default\n");
|
||||||
}
|
}
|
||||||
else if (strcmp(argv[i], "--maxAngleNotSteep") == 0)
|
|
||||||
{
|
|
||||||
param = argv[++i];
|
|
||||||
if (!param)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
float maxangle = atof(param);
|
|
||||||
if (maxangle <= 90.f && maxangle >= 0.f)
|
|
||||||
maxAngleNotSteep = maxangle;
|
|
||||||
else
|
|
||||||
printf("invalid option for '--maxAngleNotSteep', using default\n");
|
|
||||||
}
|
|
||||||
else if (strcmp(argv[i], "--threads") == 0)
|
else if (strcmp(argv[i], "--threads") == 0)
|
||||||
{
|
{
|
||||||
param = argv[++i];
|
param = argv[++i];
|
||||||
@@ -266,29 +239,12 @@ int finish(const char* message, int returnValue)
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_map<uint32, uint8> LoadLiquid()
|
|
||||||
{
|
|
||||||
DBCFileLoader liquidDbc;
|
|
||||||
std::unordered_map<uint32, uint8> liquidData;
|
|
||||||
// format string doesnt matter as long as it has correct length (only used for mapping to structures in worldserver)
|
|
||||||
if (liquidDbc.Load((boost::filesystem::path("dbc") / "LiquidType.dbc").string().c_str(), "nxxixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"))
|
|
||||||
{
|
|
||||||
for (uint32 x = 0; x < liquidDbc.GetNumRows(); ++x)
|
|
||||||
{
|
|
||||||
DBCFileLoader::Record record = liquidDbc.getRecord(x);
|
|
||||||
liquidData[record.getUInt(0)] = record.getUInt(3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return liquidData;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
unsigned int threads = std::thread::hardware_concurrency();
|
unsigned int threads = std::thread::hardware_concurrency();
|
||||||
int mapnum = -1;
|
int mapnum = -1;
|
||||||
int tileX = -1, tileY = -1;
|
int tileX = -1, tileY = -1;
|
||||||
Optional<float> maxAngle, maxAngleNotSteep;
|
float maxAngle = 60.0f;
|
||||||
bool skipLiquid = false,
|
bool skipLiquid = false,
|
||||||
skipContinents = false,
|
skipContinents = false,
|
||||||
skipJunkMaps = true,
|
skipJunkMaps = true,
|
||||||
@@ -300,7 +256,7 @@ int main(int argc, char** argv)
|
|||||||
char* file = nullptr;
|
char* file = nullptr;
|
||||||
|
|
||||||
bool validParam = handleArgs(argc, argv, mapnum,
|
bool validParam = handleArgs(argc, argv, mapnum,
|
||||||
tileX, tileY, maxAngle, maxAngleNotSteep,
|
tileX, tileY, maxAngle,
|
||||||
skipLiquid, skipContinents, skipJunkMaps, skipBattlegrounds,
|
skipLiquid, skipContinents, skipJunkMaps, skipBattlegrounds,
|
||||||
debugOutput, silent, bigBaseUnit, offMeshInputPath, file, threads);
|
debugOutput, silent, bigBaseUnit, offMeshInputPath, file, threads);
|
||||||
|
|
||||||
@@ -322,13 +278,7 @@ int main(int argc, char** argv)
|
|||||||
if (!checkDirectories(debugOutput))
|
if (!checkDirectories(debugOutput))
|
||||||
return silent ? -3 : finish("Press ENTER to close...", -3);
|
return silent ? -3 : finish("Press ENTER to close...", -3);
|
||||||
|
|
||||||
_liquidTypes = LoadLiquid();
|
MapBuilder builder(maxAngle, skipLiquid, skipContinents, skipJunkMaps,
|
||||||
if (_liquidTypes.empty())
|
|
||||||
{
|
|
||||||
return silent ? -5 : finish("Failed to load LiquidType.dbc", -5);
|
|
||||||
}
|
|
||||||
|
|
||||||
MapBuilder builder(maxAngle, maxAngleNotSteep, skipLiquid, skipContinents, skipJunkMaps,
|
|
||||||
skipBattlegrounds, debugOutput, bigBaseUnit, mapnum, offMeshInputPath, threads);
|
skipBattlegrounds, debugOutput, bigBaseUnit, mapnum, offMeshInputPath, threads);
|
||||||
|
|
||||||
uint32 start = getMSTime();
|
uint32 start = getMSTime();
|
||||||
|
|||||||
@@ -77,8 +77,6 @@ struct map_liquidHeader
|
|||||||
#define MAP_LIQUID_TYPE_SLIME 0x08
|
#define MAP_LIQUID_TYPE_SLIME 0x08
|
||||||
#define MAP_LIQUID_TYPE_DARK_WATER 0x10
|
#define MAP_LIQUID_TYPE_DARK_WATER 0x10
|
||||||
|
|
||||||
uint32 GetLiquidFlags(uint32 liquidId);
|
|
||||||
|
|
||||||
namespace MMAP
|
namespace MMAP
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -414,23 +412,27 @@ namespace MMAP
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
liquidType = getLiquidType(i, liquid_flags);
|
liquidType = getLiquidType(i, liquid_flags);
|
||||||
if (liquidType & MAP_LIQUID_TYPE_DARK_WATER)
|
switch (liquidType)
|
||||||
{
|
{
|
||||||
// players should not be here, so logically neither should creatures
|
default:
|
||||||
useTerrain = false;
|
useLiquid = false;
|
||||||
useLiquid = false;
|
break;
|
||||||
}
|
case MAP_LIQUID_TYPE_WATER:
|
||||||
else if ((liquidType & (MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN)) != 0)
|
case MAP_LIQUID_TYPE_OCEAN:
|
||||||
{
|
// merge different types of water
|
||||||
liquidType = NAV_AREA_WATER;
|
liquidType = NAV_WATER;
|
||||||
}
|
break;
|
||||||
else if ((liquidType & (MAP_LIQUID_TYPE_MAGMA | MAP_LIQUID_TYPE_SLIME)) != 0)
|
case MAP_LIQUID_TYPE_MAGMA:
|
||||||
{
|
liquidType = NAV_MAGMA;
|
||||||
liquidType = NAV_AREA_MAGMA_SLIME;
|
break;
|
||||||
}
|
case MAP_LIQUID_TYPE_SLIME:
|
||||||
else
|
liquidType = NAV_SLIME;
|
||||||
{
|
break;
|
||||||
useLiquid = false;
|
case MAP_LIQUID_TYPE_DARK_WATER:
|
||||||
|
// players should not be here, so logically neither should creatures
|
||||||
|
useTerrain = false;
|
||||||
|
useLiquid = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -733,17 +735,20 @@ namespace MMAP
|
|||||||
vertsY = tilesY + 1;
|
vertsY = tilesY + 1;
|
||||||
uint8* flags = liquid->GetFlagsStorage();
|
uint8* flags = liquid->GetFlagsStorage();
|
||||||
float* data = liquid->GetHeightStorage();
|
float* data = liquid->GetHeightStorage();
|
||||||
uint8 type = NAV_AREA_EMPTY;
|
uint8 type = NAV_EMPTY;
|
||||||
|
|
||||||
// convert liquid type to NavTerrain
|
switch (liquid->GetType() & 3)
|
||||||
uint32 liquidFlags = GetLiquidFlags(liquid->GetType());
|
|
||||||
if ((liquidFlags & (MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN)) != 0)
|
|
||||||
{
|
{
|
||||||
type = NAV_AREA_WATER;
|
case 0:
|
||||||
}
|
case 1:
|
||||||
else if ((liquidFlags & (MAP_LIQUID_TYPE_MAGMA | MAP_LIQUID_TYPE_SLIME)) != 0)
|
type = NAV_WATER;
|
||||||
{
|
break;
|
||||||
type = NAV_AREA_MAGMA_SLIME;
|
case 2:
|
||||||
|
type = NAV_MAGMA;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
type = NAV_SLIME;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// indexing is weird...
|
// indexing is weird...
|
||||||
|
|||||||
Reference in New Issue
Block a user