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
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.
* 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.
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.
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
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
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
This adds a method to dtNavMeshQuery that allows users to retrieve paths
from the nodes explored by the previous Dijkstra search. This is useful
after Dijkstra searches to retrieve arbitrary paths inside the explored
area.
findPolysAroundCircle and findPolysAroundShape were only using distances
to compute the costs. This was inconsistent with other APIs that
performed cost-based searches and accepted filters as parameters.
This changes the Dijkstra searches in findPolysAroundCircle and
findPolysAroundShape to append the results when we visit nodes in the
main loop. The algorithm guarantees that we will never visit them again
after this, so at this point we are guaranteed that we cannot find a
better path.
Previously results would be appended the first time we saw a polygon
which meant later improvements on the paths to those polygons would not
be reflected in the results.
Fix#204
When creating the tile's links, offmesh connections inside the tile were
added twice, leading to the array of links being full and not being able
to store the links computed after (portals between tiles).
This changes dtTileCache::update to add an optional parameter that
indicates whether the tile cache is up to date. This is useful to
determine whether calling the function again would do anything.