725 Commits

Author SHA1 Message Date
MoYummy
13dc549bbe Improve triangulateHull to start from an ear with shortest perimeter 2018-08-25 12:18:27 +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
Jakob Botsch Nielsen
6e36a351c2 Remove unused code causing warning 2018-06-16 17:04:54 +02:00
Jakob Botsch Nielsen
5c24b5960f Fix warning due to signedness
Fixes #334
2018-06-16 17:04:54 +02:00
Jakob Botsch Nielsen
c2d7463a38 Add Clang to Travis and treat warnings as errors
The GCC version used by Travis is old and appears not to support all the
warnings we would like to get, so reenable Clang. Additionally make lots
of cleanups to Travis config and make the build a lot faster too.

Also change both Travis and AppVeyor builds to treat warnings as errors,
and include VS2017 in the matrix for AppVeyor. I have also removed
VS2010 because it is ancient at this point.

Updated Premake to alpha12 and fixed the premake build file
appropriately.
2018-06-16 17:04:54 +02:00
Peter Boyer
c4ad0b2eb4 Fix for typo
We shouldn't leave such a shocking typo on such a nice description, now should we? ;)
2018-06-16 11:35:24 +02:00
Maciej Babinski
ba12abead9 Add more constructors. 2018-05-22 13:09:26 +02:00
mbabinski-at-google
9235b4a0c4 Add rcNew/rcDelete, template functions that allocate/deallocate objects using rcAlloc/rcFree. (#324)
Add rcNew/rcDelete, template functions that allocate/deallocate objects using rcAlloc/rcNew.
The intention is to use these to move construction logic out of rcAllocateFooObject/rcFreeFooObject and into constructors/destructors, giving users flexbility in how objects are allocated. In particular, this allows stack allocation.
2018-05-18 15:40:37 +02:00
mbabinski-at-google
1284a2b191 Remove placement-new in RecastRegion.cpp in favor of rcTempVector. (#326) 2018-05-18 13:50:42 +02:00
mbabinski-at-google
3ddb9ba074 Convert lvlStacks to be vectors of structs instead of a bag of ints. (#323) 2018-05-17 17:35:05 +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
Nikolay Zapolnov
689cf00bd9 Call proper memory deallocation function. 2018-05-14 14:50:48 +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
mbabinski-at-google
18562383f4 Remove redundant copying in rcBuildRegions. (#314)
Remove dstReg and dstDist from rcBuildRegions entirely -- just use temporary scratch space in expandRegions.
This saves a considerable amount of time when the number of spans is large. A sample map tried has 16M spans, and only writes at most 4000 of them.
2018-04-27 22:08:52 +02:00
Roman Siromakha
4566d01c8f Support build by CMake (#310) 2018-04-21 00:16:52 +02:00
cexikitin
05dd77db19 Provide better feedback when dtNavMesh::addTile fails due to a tile already being present at a given x,y 2018-03-20 00:05:29 +01:00
elsid
367065415c Unconditionally initialize rcCompactHeightfield borderSize
To avoid uninitialized value when borderSize <= 0.
2018-03-20 00:01:57 +01:00
but0n
494c2967a7 doc: fix typo SDl 2018-03-04 14:10:28 +01:00
Jakob Botsch Nielsen
5d4186046c Mark a fall-through with a comment
Fix #283
2018-01-05 13:06:06 +01:00
Aurelien Rainone
4988ecbaf0 RecastDemo: add Load & Save buttons for SoloMesh Sample, and fix warnings (#258)
* Implement saveAll loadAll for Sample_SoloMesh

 - Solo mesh sample is loaded and saved as a tiled mesh containing
   an unique tile, so as to remain compatible with tiled mesh
 - navmesh is saved to/loaded from `solo_navmesh.bin` binary file
 - add and connect the corresponding 'Save/Load' GUI elements

* Fix `implit-fallthrough` gcc warnings

On linux with gcc 7.2.0+ and all warnings treated as errors,
implicit fallthroughs in case statements are considered as errors.
If the comment just below the next `case` or `default` matches
various strings, one of which is `falls through` the fallthrough
is then considered explicit.
2018-01-05 12:38:53 +01:00
chenshungen
bda59b7c62 Fixed load .gset file error (#293) 2018-01-05 12:33:33 +01:00
Liam Mitchell
0004bf4a23 No cast in SampleInterfaces BuildContext::doStopTimer (#299)
Removed int cast because it led to loss of time data.

Fixes #289
2018-01-05 12:20:58 +01:00
Jonathan Adamczewski
2c85309280 Suppress warning 2017-10-14 20:24:18 +02:00
Jonathan Adamczewski
7b7c941181 Disable exception handling in MS std headers 2017-10-14 20:24:18 +02:00
Matthew Endsley
c70fc8a89a Return OOM error when navmeshtile allocations fail
This was previsously return a DT_SUCCESS mask, as the prior
call to dtAllocTileCache* had succeeded.
2017-08-24 10:35:04 +02:00
aymarfisherman
7cca61dc41 Renamed all instances of 'extents' to 'halfExtents' (#279) 2017-08-20 17:05:51 +02:00
aymarfisherman
840c100639 Added option to add rotated Box obstacle to TileCache. (#278)
Very useful when you have a obstacle with a big difference in x to z ratio and that could be rotated (not aligned), like a wall.
2017-07-25 13:35:23 +02:00
Geoyeob Kim
46654531e4 Fix 'dtRandomPointInConvexPoly()' returning a garbage value if s == 1.0f. (#271) 2017-05-15 16:26:35 +02:00
Domenico Albani
ef3ea40f7a Add more camera movement key bindings (#259)
Q/E and Page up/page down to move vertically.
Arrow keys in addition to WASD to move normally.
2017-02-06 02:09:49 +01:00
Jakob Botsch Nielsen
fb49ccf83a Change ground and road colors slightly (#256)
Ground color is changed back to the previous default color, and the road
color is changed to a dark shade of brown that is a bit easier to
differentiate with normal input geometry.
2017-02-04 15:19:06 +01:00
Domenico Albani
03eb2f92f3 Make RecastDemo colors more meaningful (#254)
Implement a SampleDebugDraw which will color area types meaningfully, for example
color water as blue, grass as green and so on.
2017-02-02 20:27:43 +01:00
Domenico Albani
16a7a30ada duDebugDraw::polyToCol changed to areaToCol (#255) 2017-02-01 17:44:39 +01:00
Domenico Albani
ad6e5de2e9 Debug draw duPolyToCol custom function (#253)
Add duDebugDraw::duPolyToCol to allow user to pick polygon color.
2017-01-30 11:11:32 +01:00
Domenico Albani
dfd40071c5 Assertion failure custom function (#250)
Implement custom functions to be called when an assertion fails.
2017-01-23 23:02:46 +01:00
Jonathan Adamczewski
2bc06ef314 Change initializer list to match declaration order 2017-01-12 16:58:26 +00:00
Jonathan Adamczewski
34ab687e21 Add support for heightfield filter toggles in Sample_TempObstacles 2017-01-12 16:58:26 +00:00
Jonathan Adamczewski
12e8950bac Add toggles for heightfield filtering 2017-01-12 16:58:26 +00:00
Ben Hymers
a2e16b8e6c Set warnings as errors on Linux 2017-01-12 12:07:49 +00:00
Ben Hymers
f8c8beb3cb Fix some warnings by adding error checking to Sample_TempObstacles::loadAll (#245) 2017-01-12 12:53:39 +01:00
Ben Hymers
b40b5ab7d9 Upgrade Catch to 1.6.0 (#247) 2017-01-12 12:45:45 +01:00
Ben Hymers
d11c1bdbac Fix multiline comment warning 2017-01-12 11:31:29 +00:00
Acai
787ce2c18d Fix log errors in rcBuildLayerRegions. (#242) 2016-11-27 12:12:54 +01:00
Jakob Botsch Nielsen
15ebb8bd25 Take detail mesh into account for creating BV-tree (#231)
In U and A shaped terrain it was possible that polygons extruded their
BV-tree nodes significantly. This happened because all points for the
polygon (when excluding the detail mesh) were either on the high-level
terrain, or on the low-level terrain. This fixes the long-standing todo
about this.

As a result of this change, findNearestPoly and queryPolygons should
return more accurate results.

Fix #230
2016-09-09 12:03:37 +02:00
Jakob Botsch Nielsen
88b8d409a7 Properly use detail mesh from closestPointOnPoly (#228)
When a point is outside the polygon being queried in
dtNavMesh::closestPointOnPoly and dtNavMeshQuery::closestPoinOnPoly,
Detour will interpolate along one of the edges to find the closest point
on the poly. However, Detour did not properly use the interpolated point
to find the correct height according to the detail mesh.

Fix #227
2016-09-07 10:55:35 +02:00
Jakob Botsch Nielsen
64385e9ed0 Fix findPath to return DT_OUT_OF_NODES correctly (#222)
findPath was unconditionally overriding the status it used to indicate
DT_OUT_OF_NODES for later. Restore this behavior so it properly can
return this failure flag.

Fix #221
2016-07-27 20:40:42 +02:00
cmf028
9052db45d8 Add support for AABB shaped obstacles to dtTileCache (#215) 2016-07-13 09:20:28 -04:00
Jakob Botsch Nielsen
76db7aa47b Add .editorconfig with tabs (#218) 2016-07-13 12:31:28 +02:00
Jakob Botsch Nielsen
7a88c13946 Add an assertion for alloc in rcIntArray::doResize (#219)
Fix #170
2016-07-13 11:30:13 +02:00
Jakob Botsch Nielsen
2c1db8c577 Merge pull request #217 from Janiels/prunetool-start-fix
Prune tool start fix
2016-07-13 11:29:38 +02:00