17 Commits

Author SHA1 Message Date
Alexey Sokolov
a015950eaa
Use external Catch2 if available in cmake build (#600) 2023-03-25 13:29:08 -04:00
Graham Pentheny
67ba9a2a15
Fix macOS CMake SDL linking (#584)
* Ignore cmake intermediate build dir

* Fix C++ language version in cmake build scripts

* Set a default SDL2_ROOT_DIR value for macOS in cmake scripts

* Fixed macOS SDL framework linking in cmake scripts

* Added macos-cmake target for CI builds in github workflows

* Use C++17 for building Tests instead of 20, since we build them with VS2019 in some jobs
2022-11-25 20:29:11 -05:00
Graham Pentheny
4fef044660 Unit test to check for crashes in rasterizing long, skinny triangles
Specifically, when rasterizing a triangle into a heightfield with width or height of 0.  This can happen when the input geometry bounding box extents are less than half the cell size in either x or z.  This is a degenerate case, but can crop up in real life scenarios (see https://github.com/godotengine/godot/issues/65764) so we should at least ensure it doesn't crash here.
2022-11-25 19:55:38 -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
bab65d759d Updated cmake build with Catch2 library location 2022-11-07 23:34:36 -05:00
Graham Pentheny
7dfa9849ca Updated Catch2 testing library to v3.1.1
https://github.com/catchorg/Catch2

Updated tests with new API changes as well.
2022-11-07 23:34:36 -05: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
Jarrett
56dbf4c482 Allow 64 bit windows builds (#301) 2018-10-16 00:02:51 +02:00
Roman Siromakha
05b2b8da80 CMake for Windows (#339)
* Build with cmake in appveyor

* Install content files and tests binary to bin

* Install SDL2.dll on windows

* Build RecastDemo as GUI application on Windows and Mac OS

* Copy SDL2.dll to current binary dir
2018-06-18 23:11:36 +02:00
Jakob Botsch Nielsen
b39e967e4f Fix test that fails on Clang due to float compares
These results were failing because of trying to do exact floating point
equality on computed values.
2018-06-16 17:04:54 +02:00
Maciej Babinski
bec073c947 Switch expandRegions to using a rcTempVector of structs rather than a blob of ints.
Also updates rcVector::clear() to not require the contained type to be default-constructible.
2018-05-15 16:43:11 +02:00
mbabinski-at-google
fa7debb0c3 Add homebrewed rcVector class and tests, and use it to implement rcIntArray. (#318)
This implements most of the std::vector interface, with some minor elisions of
infrequently used methods such as "insert", and some STL bookkeeping.
Performance is favorable compared to std::vector, and, in some cases, somewhat
better than naive code to manually manage a malloc'd dynamic array.

BM_FlatArray_Push:                     100 iterations in   72889721 nanos:  728897.21 nanos/it
BM_FlatArray_Fill:                     100 iterations in    2700746 nanos:   27007.46 nanos/it
BM_FlatArray_Memset:                   100 iterations in    2687810 nanos:   26878.10 nanos/it
BM_rcVector_Push:                      100 iterations in   51114316 nanos:  511143.16 nanos/it
BM_rcVector_PushPreallocated:          100 iterations in    9532106 nanos:   95321.06 nanos/it
BM_rcVector_Assign:                    100 iterations in    2371534 nanos:   23715.34 nanos/it
BM_rcVector_AssignIndices:             100 iterations in    2573052 nanos:   25730.52 nanos/it
BM_rcVector_Resize:                    100 iterations in    2455761 nanos:   24557.61 nanos/it
BM_stdvector_Push:                     100 iterations in   71739167 nanos:  717391.67 nanos/it
BM_stdvector_PushPreallocated:         100 iterations in   15723737 nanos:  157237.37 nanos/it
BM_stdvector_Assign:                   100 iterations in    2564985 nanos:   25649.85 nanos/it
BM_stdvector_AssignIndices:            100 iterations in    5174923 nanos:   51749.23 nanos/it
BM_stdvector_Resize:                   100 iterations in    2520054 nanos:   25200.54 nanos/it
2018-05-13 16:22:56 +02:00
Roman Siromakha
4566d01c8f Support build by CMake (#310) 2018-04-21 00:16:52 +02:00
Geoyeob Kim
46654531e4 Fix 'dtRandomPointInConvexPoly()' returning a garbage value if s == 1.0f. (#271) 2017-05-15 16:26:35 +02:00
Ben Hymers
b40b5ab7d9 Upgrade Catch to 1.6.0 (#247) 2017-01-12 12:45:45 +01:00
grahamboree
c9bacf3c9c Unit tests for a good number of Recast functions.
These are by no means complete coverage of the functions they test, but are at least a start.  For consistency, all floating point comparisons use Approx(), regardless of whether they need to or not.

Removed unnecessary C++11 unique_ptr stuff, now that rcHeightfield has a constructor and destructor.
2016-03-29 01:04:51 -04:00
Graham Pentheny
512ec1fdfd Unit testing framework.
* Tests live in a "Tests" folder alongside the other components.  Inside the "Tests" folder, tests are split into folders by the component they test.  For example, the example unit test of "rcVdot" (which is implmemented in Recast/Recast.h) lives in "Tests/Recast/Tests_Recast.h".
* Uses the Catch testing framework
* One example test of "rcVdot"
* Tests are run on Travis and Appveyor after every build.  Failing unit tests will fail the build in both case.
* Added instructions on running unit tests to the readme
2016-01-06 18:22:39 -05:00