Compare commits

...

10 Commits

Author SHA1 Message Date
Graham Pentheny
6dc1667f58 Bumped CMake version to 1.6.0
Some checks failed
Build / macOS-premake (Debug) (push) Has been cancelled
Build / macOS-premake (Release) (push) Has been cancelled
Build / macos-cmake (Debug) (push) Has been cancelled
Build / macos-cmake (Release) (push) Has been cancelled
Build / linux-premake (clang, debug) (push) Has been cancelled
Build / linux-premake (clang, release) (push) Has been cancelled
Build / linux-premake (gcc, debug) (push) Has been cancelled
Build / linux-premake (gcc, release) (push) Has been cancelled
Build / linux-cmake (Debug) (push) Has been cancelled
Build / linux-cmake (Release) (push) Has been cancelled
Build / windows-premake (Debug, windows-2019, 16.0, vs2019) (push) Has been cancelled
Build / windows-premake (Debug, windows-2022, 17.0, vs2022) (push) Has been cancelled
Build / windows-premake (Release, windows-2019, 16.0, vs2019) (push) Has been cancelled
Build / windows-premake (Release, windows-2022, 17.0, vs2022) (push) Has been cancelled
Build / windows-cmake (Visual Studio 16 2019, Debug, windows-2019, vs2019) (push) Has been cancelled
Build / windows-cmake (Visual Studio 16 2019, Release, windows-2019, vs2019) (push) Has been cancelled
Build / windows-cmake (Visual Studio 17 2022, Debug, windows-2022, vs2022) (push) Has been cancelled
Build / windows-cmake (Visual Studio 17 2022, Release, windows-2022, vs2022) (push) Has been cancelled
Tests / macos-tests (push) Has been cancelled
Tests / linux-tests (push) Has been cancelled
Tests / windows-tests (push) Has been cancelled
2023-05-21 13:43:18 -04:00
Graham Pentheny
e9aa38645a Added CHANGELOG.md
To track changelogs for releases
2023-05-21 13:37:22 -04:00
Graham Pentheny
a87a328b8b Replaced another dead link with an archived copy 2023-05-21 01:38:42 -04:00
Graham Pentheny
ee2d4ef6e6 Updated dead links in comments with archived versions
Fixes #623
2023-05-21 01:37:27 -04:00
andriyDev
9432fd6381
Fix spans being filtered if they have just enough clearance. (#626) 2023-05-20 17:10:59 -04:00
andriyDev
53f7818027
Add a CMake option to use dynamic dispatch for dtQueryFilter in Detour. (#628) 2023-05-04 21:56:41 -04:00
andriyDev
32e5f94b11
Add a CMake option to enable 64bit dtPolyRefs for Detour. (#627)
Previously, setting this option required either enabling this option by modifying the source, or doing some CMake hacking to inject the variables. Now this is a convenient option.
2023-04-29 20:11:38 -04:00
andriyDev
6d1f9711b3
Mark input data structures as const. (#625) 2023-04-20 19:16:35 -04:00
Graham Pentheny
f4a65fd317 Enable UBSan and ASan when building tests with clang 2023-04-14 17:38:30 -04:00
Thomas Debesse
5c494ad1ee
RecastLayers: set RC_MAX_LAYERS and RC_MAX_NEIS as optional defines (#624)
It makes possible for a project integrating Recast to set custom values
via CXXFLAGS while remaining build system agnostic.

Type checking is kept.
2023-04-14 17:02:00 -04:00
13 changed files with 109 additions and 17 deletions

59
CHANGELOG.md Normal file
View File

@ -0,0 +1,59 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [1.6.0] - 2023-05-21
### Added
- CMake build support
- Unit testing with Catch2 (#147)
- Support for AABB and OBB obstacles in `dtTileCache` (#215, #278)
- `dtTileCache` supports timesliced updates (#203)
- Support for custom assertion functions (#250)
- Variant of `findNearestPoly` that exposes distance and isOverPoly (#448)
- `dtNavMeshQuery::getPathFromDijkstraSearch` gets a path from the explored nodes in a navmesh search (#211)
- A version of `dtPolyQuery::queryPolygon` that operates on batches of polygons rather than just 128 (#175) (Fixes #107)
- `rcNew`/`rcDelete` to match `rcAlloc`/`rcFree` (#324)
- Better error reporting and input sanitization (#179, #303)
- Better debug draw (#253, #254, #255, #256)
- Improved docstrings, documentation
- (RecastDemo) Load/Save navmesh data (#258)
### Fixed
- Improved robustness, speed and accuracy of navmesh point queries (#205, #208, #228, #231, #364, #381, #560)
- Incorrect rasterization at tile borders (#476)
- Off-mesh links in tiles were sometimes added twice (#202)
- Potential heap corruption when collecting region layers (#214)
- `findPath` returns `DT_OUT_OF_NODES` appropriately (#222)
- Spans are filtered if there is just enough height (#626)
- Increased epsilon in detour common segment polygon intersection test (#612)
- Array overrun in `removeVertex` in `DetourTileCacheBuilder` (#601)
- Potential rounding error computing bounding box size in `dtNavMesh::connectExtLinks` (#428)
- An indexing error in updating agents in `DetourCrowd` (#450)
- Allocation perf issues in rcVectorBase (#467)
- Dead website links in comments
- RecastDemo bugs (#180, #184, #186, #187, #200)
- Uninitialized class member values, small memory leaks, rule-of-three violations, other minor issues
### Changed
- Updated stb_image (#184)
- Updated stb_truetype (#183)
### Removed
- Use of _USE_MATH_DEFINES directive (#596)
## [1.5.1] - 2016-02-22
[unreleased]: https://github.com/recastnavigation/recastnavigation/compare/1.6.0...HEAD
[1.6.0]: https://github.com/recastnavigation/recastnavigation/compare/1.5.1...1.6.0
[1.5.1]: https://github.com/recastnavigation/recastnavigation/compare/1.5.0...1.5.1

View File

@ -4,7 +4,7 @@ project(RecastNavigation)
# lib versions
SET(SOVERSION 1)
set(LIB_VERSION 1.5.1)
set(LIB_VERSION 1.6.0)
string(REPLACE "." "," LIB_VERSION_NUM "${LIB_VERSION}.0")
set_property(GLOBAL PROPERTY CXX_STANDARD 98)
@ -12,6 +12,8 @@ set_property(GLOBAL PROPERTY CXX_STANDARD 98)
option(RECASTNAVIGATION_DEMO "Build demo" ON)
option(RECASTNAVIGATION_TESTS "Build tests" ON)
option(RECASTNAVIGATION_EXAMPLES "Build examples" ON)
option(RECASTNAVIGATION_DT_POLYREF64 "Use 64bit polyrefs instead of 32bit for Detour" OFF)
option(RECASTNAVIGATION_DT_VIRTUAL_QUERYFILTER "Use dynamic dispatch for dtQueryFilter in Detour to allow for custom filters" OFF)
if(MSVC AND BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
@ -33,6 +35,12 @@ set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
set(PACKAGE_VERSION "${LIB_VERSION}")
if(RECASTNAVIGATION_DT_POLYREF64)
set(PKG_CONFIG_CFLAGS "${PKG_CONFIG_CFLAGS} -DDT_POLYREF64")
endif()
if(RECASTNAVIGATION_DT_VIRTUAL_QUERYFILTER)
set(PKG_CONFIG_CFLAGS "${PKG_CONFIG_CFLAGS} -DDT_VIRTUAL_QUERYFILTER")
endif()
configure_file(
"${RecastNavigation_SOURCE_DIR}/recastnavigation.pc.in"
"${RecastNavigation_BINARY_DIR}/recastnavigation.pc"

View File

@ -6,6 +6,13 @@ set_target_properties(Detour PROPERTIES DEBUG_POSTFIX -d)
set(Detour_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Include")
if(RECASTNAVIGATION_DT_POLYREF64)
target_compile_definitions(Detour PUBLIC DT_POLYREF64)
endif()
if(RECASTNAVIGATION_DT_VIRTUAL_QUERYFILTER)
target_compile_definitions(Detour PUBLIC DT_VIRTUAL_QUERYFILTER)
endif()
target_include_directories(Detour PUBLIC
"$<BUILD_INTERFACE:${Detour_INCLUDE_DIR}>"
)

View File

@ -24,7 +24,7 @@
#ifdef NDEBUG
// From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
// From https://web.archive.org/web/20210117002833/http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
# define dtAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false)
#else

View File

@ -890,7 +890,7 @@ static bool buildMeshAdjacency(dtTileCacheAlloc* alloc,
const dtTileCacheContourSet& lcset)
{
// Based on code by Eric Lengyel from:
// http://www.terathon.com/code/edges.php
// https://web.archive.org/web/20080704083314/http://www.terathon.com/code/edges.php
const int maxEdgeCount = npolys*MAX_VERTS_PER_POLY;
dtFixedArray<unsigned short> firstEdge(alloc, nverts + maxEdgeCount);

View File

@ -1083,7 +1083,7 @@ int rcGetHeightFieldSpanCount(rcContext* context, const rcHeightfield& heightfie
/// @param[out] compactHeightfield The resulting compact heightfield. (Must be pre-allocated.)
/// @returns True if the operation completed successfully.
bool rcBuildCompactHeightfield(rcContext* context, int walkableHeight, int walkableClimb,
rcHeightfield& heightfield, rcCompactHeightfield& compactHeightfield);
const rcHeightfield& heightfield, rcCompactHeightfield& compactHeightfield);
/// Erodes the walkable area within the heightfield by the specified radius.
/// @ingroup recast
@ -1256,7 +1256,7 @@ inline int rcGetDirForOffset(int offsetX, int offsetZ)
/// to be considered walkable. [Limit: >= 3] [Units: vx]
/// @param[out] lset The resulting layer set. (Must be pre-allocated.)
/// @returns True if the operation completed successfully.
bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
bool rcBuildHeightfieldLayers(rcContext* ctx, const rcCompactHeightfield& chf,
int borderSize, int walkableHeight,
rcHeightfieldLayerSet& lset);
@ -1271,7 +1271,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
/// @param[out] cset The resulting contour set. (Must be pre-allocated.)
/// @param[in] buildFlags The build flags. (See: #rcBuildContoursFlags)
/// @returns True if the operation completed successfully.
bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf,
bool rcBuildContours(rcContext* ctx, const rcCompactHeightfield& chf,
float maxError, int maxEdgeLen,
rcContourSet& cset, int buildFlags = RC_CONTOUR_TESS_WALL_EDGES);
@ -1283,7 +1283,7 @@ bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf,
/// contour to polygon conversion process. [Limit: >= 3]
/// @param[out] mesh The resulting polygon mesh. (Must be re-allocated.)
/// @returns True if the operation completed successfully.
bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMesh& mesh);
bool rcBuildPolyMesh(rcContext* ctx, const rcContourSet& cset, const int nvp, rcPolyMesh& mesh);
/// Merges multiple polygon meshes into a single mesh.
/// @ingroup recast

View File

@ -21,7 +21,7 @@
#ifdef NDEBUG
// From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
// From https://web.archive.org/web/20210117002833/http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
# define rcAssert(x) do { (void)sizeof(x); } while ((void)(__LINE__==-1), false)
#else

View File

@ -401,7 +401,7 @@ int rcGetHeightFieldSpanCount(rcContext* context, const rcHeightfield& heightfie
}
bool rcBuildCompactHeightfield(rcContext* context, const int walkableHeight, const int walkableClimb,
rcHeightfield& heightfield, rcCompactHeightfield& compactHeightfield)
const rcHeightfield& heightfield, rcCompactHeightfield& compactHeightfield)
{
rcAssert(context);

View File

@ -101,7 +101,7 @@ static int getCornerHeight(int x, int y, int i, int dir,
}
static void walkContour(int x, int y, int i,
rcCompactHeightfield& chf,
const rcCompactHeightfield& chf,
unsigned char* flags, rcIntArray& points)
{
// Choose the first non-connected edge
@ -820,7 +820,7 @@ static void mergeRegionHoles(rcContext* ctx, rcContourRegion& region)
/// See the #rcConfig documentation for more information on the configuration parameters.
///
/// @see rcAllocContourSet, rcCompactHeightfield, rcContourSet, rcConfig
bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf,
bool rcBuildContours(rcContext* ctx, const rcCompactHeightfield& chf,
const float maxError, const int maxEdgeLen,
rcContourSet& cset, const int buildFlags)
{

View File

@ -174,7 +174,7 @@ void rcFilterWalkableLowHeightSpans(rcContext* context, const int walkableHeight
{
const int bot = (int)(span->smax);
const int top = span->next ? (int)(span->next->smin) : MAX_HEIGHT;
if ((top - bot) <= walkableHeight)
if ((top - bot) < walkableHeight)
{
span->area = RC_NULL_AREA;
}

View File

@ -28,8 +28,21 @@
// Must be 255 or smaller (not 256) because layer IDs are stored as
// a byte where 255 is a special value.
static const int RC_MAX_LAYERS = 63;
static const int RC_MAX_NEIS = 16;
#ifndef RC_MAX_LAYERS_DEF
#define RC_MAX_LAYERS_DEF 63
#endif
#if RC_MAX_LAYERS_DEF > 255
#error RC_MAX_LAYERS_DEF must be 255 or smaller
#endif
#ifndef RC_MAX_NEIS_DEF
#define RC_MAX_NEIS_DEF 16
#endif
// Keep type checking.
static const int RC_MAX_LAYERS = RC_MAX_LAYERS_DEF;
static const int RC_MAX_NEIS = RC_MAX_NEIS_DEF;
struct rcLayerRegion
{
@ -88,7 +101,7 @@ struct rcLayerSweepSpan
/// See the #rcConfig documentation for more information on the configuration parameters.
///
/// @see rcAllocHeightfieldLayerSet, rcCompactHeightfield, rcHeightfieldLayerSet, rcConfig
bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
bool rcBuildHeightfieldLayers(rcContext* ctx, const rcCompactHeightfield& chf,
const int borderSize, const int walkableHeight,
rcHeightfieldLayerSet& lset)
{

View File

@ -34,7 +34,7 @@ static bool buildMeshAdjacency(unsigned short* polys, const int npolys,
const int nverts, const int vertsPerPoly)
{
// Based on code by Eric Lengyel from:
// http://www.terathon.com/code/edges.php
// https://web.archive.org/web/20080704083314/http://www.terathon.com/code/edges.php
int maxEdgeCount = npolys*vertsPerPoly;
unsigned short* firstEdge = (unsigned short*)rcAlloc(sizeof(unsigned short)*(nverts + maxEdgeCount), RC_ALLOC_TEMP);
@ -986,7 +986,7 @@ static bool removeVertex(rcContext* ctx, rcPolyMesh& mesh, const unsigned short
/// limit must be retricted to <= #DT_VERTS_PER_POLYGON.
///
/// @see rcAllocPolyMesh, rcContourSet, rcPolyMesh, rcConfig
bool rcBuildPolyMesh(rcContext* ctx, rcContourSet& cset, const int nvp, rcPolyMesh& mesh)
bool rcBuildPolyMesh(rcContext* ctx, const rcContourSet& cset, const int nvp, rcPolyMesh& mesh)
{
rcAssert(ctx);

View File

@ -238,6 +238,11 @@ project "Tests"
-- distribute executable in RecastDemo/Bin directory
targetdir "Bin"
-- enable ubsan and asan when compiling with clang
filter "toolset:clang"
buildoptions { "-fsanitize=undefined", "-fsanitize=address" } -- , "-fsanitize=memory" }
linkoptions { "-fsanitize=undefined", "-fsanitize=address" } --, "-fsanitize=memory" }
-- linux library cflags and libs
filter "system:linux"
buildoptions {