These could lead to undefined behaviour if e.g. a negative value from ftell
was used to allocate memory.
Also store result of ftell in a long;
The result may previously have been truncated on some platforms
m_sample was being checked for null after being used, which looks like a
null dereference, though actually if m_sample becomes null, the tool will
be deactivated anyway. Regardless, this code looks more sensible.
These were reported by Coverity Scan. They're extremely unlikely but still
possible - if all edges of a poly are FLT_MAX or further away from the
input point, a negative index may be used to access the verts array of a
poly.
The fix is to arbitrarily pick the first edge as the closest in case all
are tied as being very far away.
Would crash if selecting a test with geometry then a test with missing geometry
Would use the previous sample type if selecting a sample that doesn't exist in the list
Two of the test cases had an incorrect sample name
dtNavMeshQuery now fails initialization if too many nodes are requested
in the node pool. This could cause wrong paths and infinite loops to
happen if the node indices started overflowing dtNodeIndex or
dtNode::pidx.
Fix#178
Fix three warnings added in fc5df2c, and increase the text pool size in
the demo. This would frequently be overflowed, even just by building
with the default settings and expanding the log.
This adds a version of queryPolygon that takes an interface which is
passed batches of polygons in the search area. This new API is then used
from the old queryPolygons to collect polygons, and from findNearestRef
to find the nearest poly in an arbitrarily sized area. Previously
findNearestPoly had an arbitrary poly limit of 128 which could cause it
to return potentially wrong results.
Fix#107
* Added virtual qualifier to a few destructors in subclasses.
* Removed a few empty destructors that didn't need to be explicitly defined.
* Fixed a few typos
* Removed unnecessary empty virtual destructors in some classes with parent's who derrived from a class with a virtual destructor
This adds the ability for geometry sets to store build settings that can
be automatically applied when they are loaded. This should allow sharing
of .gset files to demonstrate problems with certain settings on certain
files. It also allows people to diagnose problems more easily by being
able to dump their own triangle meshes and settings and load them in the
demo, with all of its visualization options. .gset files can be created
from the current mesh and settings by pressing the 9 key, which will
generate it in the same folder as the input mesh.
Also converts more of the demo to use STL.
The readme was looking lonely after the BitDeli badge was taken away. Here are some nice badges to replace it, which also helpfully show how active a project this has become! They show recent average time to close issues and PRs.
There is a class and a struct called BuildContext in two different files,
one .h and one .cpp. Depending on how the user structures their program,
it's possible that this would cause a compile or link error, as seems to
have happened in #44. I've just renamed the struct to get around this.
Fixes#44
It appears that BitDeli is defunct; their website has had a banner about a change in the GitHub API for a long time, which is a dead link to a blog article, and none of the example stats have been updated for years. Let's just remove it!
When the detail mesh sampling sees an unset height it previously tried
to recover by looking for heights of neighbors. When the heightfield was
not eroded this recovery would fail since the contour simplification
could mean that the nearest valid cell was further away than a neighbor.
We now walk adjacent cells in a spiral to find a height and do this
depending on the max simplification error.
Fix#153