Commit Graph

249 Commits

Author SHA1 Message Date
Graham Pentheny
4a95dcd591 CMake: Set the C++ standard version per-target rather than globally
Also clean up the CMakeLists.txt files a bit
2025-03-30 15:30:14 -04:00
Graham Pentheny
bd98d84c27 Silence integer narrowing conversion warnings
These started after we switched from rcIntArray to rcTempVector<int>
2025-03-29 13:43:59 -04:00
Graham Pentheny
2253271091 Remove the deprecated rcIntArray (#769)
* Replaced references to rcIntArray with rcTempVector<int>

rcIntArray is deprecated and has been replaced with rcTempVector.  The current implementation is just a wrapper for rcTempVector.

* remove rcIntArray implementation

Since it's no longer referenced
2025-03-18 09:43:10 -07:00
Graham Pentheny
3527a8270d Replace xorb with xor operator (#770)
The xorb function just gets compiled to an xor instruction in -O3, so this is just unnecessary pessimistic code.

https://godbolt.org/z/o5TGjsx6T
2025-03-18 09:42:55 -07:00
Graham Pentheny
77f7e54bc8 Don't remove custom assert failure registering code when disabling assertions (#751)
Otherwise, when disabling assertions, client code that calls these custom assertion failure callback registration functions will break.
2024-12-31 12:59:59 -05:00
Graham Pentheny
6bc79535bb Cleanup docstrings and some formatting in RecastAlloc.h 2024-12-31 12:49:06 -05:00
Roman Siromakha
63dd4aa332 Support enabling and disabling asserts for CMake builds (#728) 2024-12-29 12:39:07 -05:00
Graham Pentheny
c36a40645a Cleanup filter code and improved documentation (#683)
This mostly just changes variable names and adds some comments to make the code more clear.

It also has a few small fixup changes to the unit tests.
2024-01-01 14:56:47 -05:00
Graham Pentheny
fc18ed8194 Some unit tests for heightfield filtering functions (#682)
This adds some unit tests for the functions in RecastFilter.cpp, and updates docs around these functions. This also splits up the Tests_Recast.cpp file into a few smaller, more focused files.
2023-12-31 14:55:41 -05:00
Cupcake
3e94c3b6fc Code cleanup and small optimizations in RecastFilter.cpp rcFilterLedgeSpans (#672)
* Code cleanup and minor refactor in RecastFilter.cpp rcFilterLedgeSpans

Because span.smax is always > 0, bot > 0 as well, and (-walkableClimb - bot) is always < -walkableClimb. Furthermore, as long as minNeighborHeight < -walkableClimb' at least once, there is no need to continue the traversal.

* Code cleanup and minor refactor in RecastFilter.cpp rcFilterLedgeSpans

Because span.smax is always > 0, bot > 0 as well, and (-walkableClimb - bot) is always < -walkableClimb. Furthermore, as long as minNeighborHeight < -walkableClimb' at least once, there is no need to continue the traversal.

* Update RecastFilter.cpp

Revise Comment
2023-12-31 14:27:07 -05:00
Jakob Botsch Nielsen
c393777d26 Make detail mesh edge detection more robust (#657)
Instead of using a distance check which can fail at large magnitudes due
to low precision we can check whether the edges are actually on the
hull.
2023-12-20 00:46:50 -05:00
shine
ddaa361b08 fix:rcBuildLayerRegions missing areaType (#470)
Co-authored-by: sunming <359944951@qq.com>
Co-authored-by: Graham Pentheny <grahamboree@users.noreply.github.com>
2023-11-12 16:30:28 -05:00
Gamemechanic
cd898904b7 Minor refactor in RecastMesh.cpp (#661) 2023-09-04 10:53:41 -04:00
alonfaraj
1adf911a09 Typo fixes (#660)
* multiple comments typo fixes

* typo

* typos

* typos

* typos

---------

Co-authored-by: Alon Faraj <alon.faraj@mapcore.com>
2023-08-16 15:37:41 -04:00
Graham Pentheny
6d9998e5b4 Some quick cleanup in RecastRasterization.cpp (#655)
* Rename hf -> heightfield to be consistent
* Removed unused include
2023-08-10 16:39:36 -04:00
Graham Pentheny
af6d4758ff Changed asserts to be explicitly disabled with RC_DISABLE_ASSERTS rather than using NDEBUG (#653)
* Changed asserts to be explicitly disabled with RC_DISABLE_ASSERTS rather than using NDEBUG

This gives explicit control to users over when recast asserts are enabled or disabled.  This is useful when users wish to disable asserts in debug mode or enable them in release mode.  e.g. it's common to compile game code in debug alongside third party code in release.

* Added Integration.md with documentation on the integration process for Recast
2023-08-09 19:15:04 -04:00
Graham Pentheny
8a42fb6348 Improved variable naming in RecastArea.cpp (#636)
* Cleanup compact heightfield functions in RecastArea.cpp
* More improved variable names for RecastArea.cpp
* Improved variable names and documentation in rcOffsetPoly
* Don't normalize the miter bisector in rcOffsetPoly since this needs to be proportional to both segment normals.
* Moved vector normalization out of rcOffsetPoly into a helper function rcVsafeNormalize
* Rename local variables in rcOffsetPoly
* Rename BMiterX/Z to cornerMIterX/Z
* Also fixed some comment descriptions
* Added docstring for rcVsafeNormalize
* Improved clarity of a few comments
2023-07-23 15:59:20 -04:00
Anton Matveev
603dc88e5d Bounds checks were unnecessary inclusive. (#418)
Co-authored-by: Graham Pentheny <grahamboree@users.noreply.github.com>
2023-07-02 20:42:37 -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
6d1f9711b3 Mark input data structures as const. (#625) 2023-04-20 19:16:35 -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
FcAYH
b0ed8b7a3c fixed a typo (countour -> contour) (#617) 2023-03-25 13:22:02 -04:00
andriyDev
b921dd16b1 Make installing PDBs optional. (#611)
PDBs are not necessarily generated, even in Debug configuration. For example, if the CXX_FLAGS are set to /Z7, debug symbols are embedded, and so the PDBs are not generated. This prevents installing from failing by marking these PDBs as optional.

Fix #610
2023-03-19 22:31:18 -04:00
Graham Pentheny
405cc095ab Add missing null check in rcFreePolyMeshDetail 2023-01-02 17:20:10 -05:00
Graham Pentheny
a4be369ac3 Removed rcPolyMeshDetail destructor to maintain backwards-compatibility
https://github.com/recastnavigation/recastnavigation/pull/598#discussion_r1059522812
2023-01-02 14:05:02 -05:00
Graham Pentheny
b43c82c808 Removed _USE_MATH_DEFINES directive (#596)
Since none of the `M_` prefixed constants are used anywhere in the code, this is unnecessary.  It's also Windows-specific, so these non-standard defines shouldn't be used anyway.

Ref: https://learn.microsoft.com/en-us/cpp/c-runtime-library/math-constants?view=msvc-170
2022-12-29 15:09:01 -05:00
Graham Pentheny
7501007439 More Recast code cleanup (#598)
* Code formatting, dosctring consolidation, spelling fixes
* Fixed rule-of-three for rcCompactHeightfield, rcHeightfieldLayerSet, rcContourSet, rcPolyMesh
* Better names for variables and parameters mostly in Recast.cpp
* Added constructor and destructor to rcPolyMeshDetail
* Remove redundant default-value specifiers in constructor initialization lists.
2022-12-29 14:57:46 -05:00
Graham Pentheny
b51925bb87 Cleanup Rasterization Code (#592)
Mostly just improving variable names for clarity.

Removed a redundant base-case check in AddSpan that resulted in a small but measurable perf improvement due to removing a branch. Also tightened up the bounding box overlap check so it early-outs faster, which also has a small perf improvement to rasterization times.

Updated docstrings for user-facing functions.

* Moved docstring comments to the header with the rest of the docstring
* Removed unused function
* Make a cpp-only function static
* Added docstring for rasterizeTri
* Use spaces to indent function parameter lists so they look good regardless of the editor's tab width
* Better parameter names for rcClamp
* Cleanup code formatting, a couple variable names, and some comments in rasterizeTri
* Clean up dividePoly, added rcAxis enum
* Cleanup rasterizeTri docstring
* Faster overlapBounds check in rasterization
* Renamed some vars in rasterizeTri
* cleanup addSpan and remove redundant branch
* addSpan docstring
* Cleanup the implementations of rcRasterizeTriangle and rcRasterizeTriangles overloads
* Added docstrings and renamed vars in rcAllocSpan and rcFreeSpan
* Clean up rcRasterizeTriangle and rcRasterizeTriangles in the header.  Removed redundant const qualifiers on value parameters
* Better parameter names for rasterizeTri, updated docstring, fixed some incorrect comments
* Improved parameter names of rcRasterizeTriangle, rcRasterizeTriangles, and rcAddSpan
* Fixed some old variable names referenced in the docstring for rcAddSpan
2022-12-22 12:16:04 -05:00
Piotr Piastucki
3901c5854c Fix incorrect rasterization at tile borders (#476)
* Fix incorrect rasterization at tile borders

Clip the polygon at the tile border and disregard coordinates outside of
the tile before clamping.

* Added unit test with minimal repro case for the rasterization issue fixed in PR #476

Co-authored-by: Graham Pentheny <graham.pentheny@gmail.com>
2022-11-23 02:42:03 -05:00
Graham Pentheny
2b0c244d12 Updated doxygen output (#581)
- Upgraded doxyfile to latest format
- Fixed a bunch of warnings and errors in docstrings that doxygen was complaining about
- Added the doxygen-awesome theme to modernize the output
- Removed a duplicate screenshot we'd had in the docs folder
- Moved the RecastDemo screenshot into the Docs/images folder
- Changed the doxygen main page to be the README.md since the dedicated main page file we had was nearly identical but out of date
- Added CONTRIBUTING.md so it's part of the generated doxygen output
- Removed duplicate license file to avoid confusion
- Combined the FAQ with the Recast_api.txt, since the FAQ was essentially just better docs for the members of `rcConfig`
2022-11-23 00:13:38 -05:00
SpaceIm
53f779fa8d install CMake config file with exported targets (#575) 2022-11-20 15:42:04 -05:00
Graham Pentheny
5111139558 Fixes for many low-severity compiler warnings (#576)
* Fixes for many low-severity compiler warnings

Mostly a lot of pedantic things like end-of-file newlines and commas on the last enum value.  However some fixes like the weak v-tables warnings fixes might help with code gen.  It's unclear if the linker is able to elide multiple copies of the same type's v-table in different translation units, (sometimes it can) but these fixes ensure we don't have to rely on it.
2022-11-11 21:03:03 -05:00
Andrei Kortunov
30edaf442c Fix -Wextra-semi GCC warnings by removing redundant semicolons 2022-10-11 23:45:27 -04:00
Brian Swenson
c02d6fa81e -Wunused-but-set-variable flagged variables removed 2022-06-03 02:24:29 -04:00
Prin_E
5a870d427e Fixed RecastDemo crash in macOS 10.11+
* Set hints to always use OpenGL render driver (instead of Metal driver)
* Compile error fix in Xcode 13
2022-03-20 15:33:19 -04:00
Bret Curtis
63a4ee4c1e Add version and pkgconfig (#474)
* Add version and pkgconfig

* simply versioning

Co-authored-by: Bret Curtis <bret.curtis@pegus.digital>
2021-03-05 17:24:04 +01:00
elsid
1f25f9cc29 Install .pdb files only with MSVC 2021-03-05 17:21:50 +01:00
Gleb Mazovetskiy
e75adf86f9 Avoid reallocs of temp vectors (#467)
* Use clear() instead of resize(0) for temp vectors

Nicer style

* rcVectorBase::resize: Avoid realloc on grow

When capacity is sufficient, do not realloc the whole buffer

* rcVector: Grow exponentially on resize
2021-02-15 12:27:21 +01:00
Yoann Potinet
65b314a44e Fix shared library build 2020-10-31 10:38:31 +01:00
Jan Haller
e679507845 Improve debug builds for MSVC (#443)
* Add -d suffix for debug libraries

* Export PDB files for each Debug library
2020-10-30 10:41:54 +01:00
Alexey Sokolov
9337e12418 Several fixes for make install (#437)
* Don't install test

* Install to the correct directory (e.g. lib64)

* Install includes to /usr/include/recastnavigation
2020-09-24 10:08:03 +02:00
Icecream95 (gitlab.com/icecream95)
57610fa6ef Explicitly define winding as being signed 2019-10-21 14:44:25 +02:00
Jakob Botsch Nielsen
33a9eb1cce Document detail triangle edge flags 2019-03-16 16:18:23 +01:00
Jakob Botsch Nielsen
3087e805b0 Add a matching placement delete for placement new
Even though it is a no-op this is good style and avoids a warning with
MSVC.

Fix #359
2018-11-05 14:26:08 +01:00
elsid
7bfd9a1d4c Add aliases with namespace for library build targets 2018-10-31 23:13:42 +01:00
elsid
2b31aa9d79 Bind include directories to library build target 2018-10-31 23:13:42 +01:00
Jarrett
56dbf4c482 Allow 64 bit windows builds (#301) 2018-10-16 00:02:51 +02:00
MoYummy
13dc549bbe Improve triangulateHull to start from an ear with shortest perimeter 2018-08-25 12:18:27 +02:00
Jakob Botsch Nielsen
5c24b5960f Fix warning due to signedness
Fixes #334
2018-06-16 17:04:54 +02:00