227 Commits

Author SHA1 Message Date
Graham Pentheny
b7a83e0afb Fixed rule of 3 violations in many places.
* 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
2016-01-20 11:57:32 -05:00
Bill Bierman
92bc6ce5bd Change if to else-if to avoid unnecessary comparison 2016-01-19 11:34:04 -10:00
Ben Hymers
551d1b250e Use size_t for rcAlloc and dtAlloc
This was already partly done by @cexikitin in #65, I'm just finishing it
off in their absence!

Closes #65
2016-01-15 00:36:18 +00:00
Jakob Botsch Nielsen
0143337a64 Merge pull request #154 from Janiels/fix-detail-unsampled-heights
Increase recover radius for unsampled heights
2016-01-14 22:18:43 +01:00
Jakob Botsch Nielsen
b99d62047b Increase recover radius for unsampled heights
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
2016-01-14 19:20:43 +01:00
Jakob Botsch Nielsen
f002387afc Merge pull request #151 from Janiels/fix-detail-sampling
Use flood fill for potentially overlapping polys
2016-01-14 16:48:13 +01:00
Jakob Botsch Nielsen
5fce286267 Use flood fill for potentially overlapping polys
This changes the detail sampling to find height data by using the flood
fill method for polygons that were merged because of a border vertex
removal. This could potentially cause overlapping polygons to receive
the same region IDs which would later make the fast-path sampling in
getHeightData sample the wrong heights.

Also includes optimizations for this path and getHeightData itself.
Previously the seeding was responsible for 25% of the total time spent
in getHeightData in these cases. We now use the direction and prefer
moving directly towards the center of the polygon. This makes the
overhead of seedArrayWithPolyCenter virtually nonexistent (~2%
according to profiling).

Fix #146
2016-01-14 11:25:48 +01:00
Jakob Botsch Nielsen
c1f9fd8406 Fix heap corruption when collecting region layers
The collecting could overflow the neighbours array due to a missing boundary
check.

Fix #30
2016-01-02 13:33:27 +01:00
Rafael Stahl
15025e8519 handle the case when allocSpan fails to allocate memory. adds bool return types to rcAddSpan, rcRasterizeTriangle and rcRasterizeTriangles 2015-12-18 16:41:02 +01:00
Rafael Stahl
6d3c9b38ba add rcScopedTimer to fix timers not being stopped on all paths and to prevent it in the future. 2015-12-18 14:48:31 +01:00
Jakob Botsch Nielsen
35fb7d5c16 Merge pull request #78 from grahamboree/RC_SPAN_HEIGHT_BITS_fix
Use RC_SPAN_HEIGHT_BITS when setting the bitfield size of rcSpan::smin and rcSpan::smax
2015-12-17 14:16:02 +01:00
jackpoz
18b537c23f Fix 2 "unused parameter" build warnings 2015-06-28 21:32:16 +02:00
CharlesJClark
6730d4ddda Update RecastMesh.cpp
Fixed validation checks of allocations.
2015-06-19 09:33:27 -07:00
Kromster80
3ca4db4864 Fixed loop overrun 2015-02-19 14:03:59 +03:00
Graham Pentheny
df6fac219b Use RC_SPAN_HEIGHT_BITS when setting the bitfield size of smin and smax in rcSpan. 2015-01-31 17:18:02 -05:00
Kromster80
ce304d195f Removed superflous memset
We have already filled whole set of layers with zeroes at line 477. It looks like we don't need to fill the layers once again. Right?
2014-12-23 11:10:05 +03:00
Mikko Mononen
ff7549bb57 Merge pull request #51 from Kromster80/HULL-UNDEF
Renamed enums to avoid name collisions with "hull" variables
2014-12-13 13:55:33 +02:00
Mikko Mononen
b869953fd2 Merge pull request #54 from Kromster80/var
Removed unnecessary variable assignment
2014-12-13 13:44:45 +02:00
Mikko Mononen
ace7f1f19a Merge pull request #52 from Kromster80/typo-fixes
Typo fixes
2014-12-13 13:35:40 +02:00
Kromster80
a94ecdc079 Removed unneeded assignment 2014-12-13 10:55:04 +03:00
Kromster80
d1bdd8192e Update Recast.cpp 2014-11-13 17:36:22 +03:00
Kromster80
ccc346fd53 Fixed typos 2014-11-13 16:52:10 +03:00
Kromster80
5dfb3b01e7 Renamed enum to avoid name collisions with "hull" variables 2014-11-10 15:23:28 +03:00
Kromster80
d9652b362e Update RecastMeshDetail.cpp 2014-11-10 15:08:03 +03:00
Kromster80
f9ddd31493 Update RecastMesh.cpp 2014-11-10 15:07:17 +03:00
Kromster80
519b148451 Update RecastContour.cpp 2014-11-10 15:06:43 +03:00
Kromster80
6c3b575052 Rolled back to pull 2014-10-30 21:19:19 +04:00
Kromster80
a7a67af47b Typo fixes 2014-10-30 17:05:39 +03:00
Kromster80
e3d5c9904e Renamed local variable to avoid scope collisions
I'm not sure if C++ vars are scoped into {} blocks, but in ported code that is an issue. It's easier to have vars names unique. Does not harm anyone I guess? ;-)
2014-10-30 16:59:51 +03:00
Kromster80
5df28b45bc Matched the implementation/docs name of the parameter 2014-10-30 13:35:37 +03:00
Mikko Mononen
129efa5833 Fix for issue #38 and improvements to detail mesh tessellation
- do circumCircle calculations relative to first vertex for adde
precision
- improved the results of triangulateHull(), produces less degen
triangles
- fixed case with contour merging when outline is null
2014-06-24 15:23:53 +03:00
Mikko Mononen
480f56e94d Fixed memory allocation in detail mesh and memcpy in polymesh copy 2014-06-24 15:23:53 +03:00
Janiels
89233e807d Fix comment in rcHeightfieldLayer 2014-06-14 15:43:22 +02:00
Mikko Mononen
24a11a2823 Fixed silly mistake in detail mesh next(), prev() functions 2014-06-14 15:59:32 +03:00
Mikko Mononen
e6fc6a3817 Removed unused code 2014-06-13 13:28:46 +03:00
Mikko Mononen
3cb87f2432 Merge branch 'master' of https://github.com/memononen/recastnavigation 2014-06-13 13:25:07 +03:00
Mikko Mononen
a89bb843d7 Added new method to partition heighfield
- added layer based heighfield partitioning
- the method is a bit slower than monotone partitioning, but does not
suffer from the long thin ploys
- the method partitions the heighfield into non-overlapping areas, but
does not try to resolve holes
- improved contour hole merging so that it can properly handle all
kinds of holes
- improved polygon triangulation to handle overlapping segments
- improved small and long polygon detail mesh generation
- updated samples to include all 3 partition methods and little
documentation to help to choose between them
2014-06-13 13:25:01 +03:00
Mikko Mononen
740a7ba516 Merge pull request #18 from jackpoz/rcMergePolyMeshes_portals_fix
Fix rcMergePolyMeshes() ignoring portals of input meshes.
2014-02-21 10:35:39 +02:00
Mikko Mononen
3e8b413036 Fix for detail mesh height data generation
- if the new region based height data generation fails, use the old
flood fill based method
2014-02-21 10:32:35 +02:00
jackpoz
77ebf64353 Fix rcMergePolyMeshes() ignoring portals of input meshes.
Copy the portals from input meshes on border to the output mesh.
2014-02-19 21:00:14 +01:00
axelrodR
adcd4f472e bugfix: divPoly could produce an 8th point after several calls because some of the old clipPoly code on which it was based
can add the same point twice consecutively (interpolation+adding the point).
Rather than raising the buffer I rewrote divPoly to avoid adding the same point twice.
2014-01-21 22:05:40 +02:00
axelrodR
f60468abcb Merge branch 'master' of https://github.com/memononen/recastnavigation
thrown away the fix I made to Recast/Source/RecastMeshDetail.cpp in favor of the upstream code.
2014-01-20 01:28:33 +02:00
axelrodR
4d657b9561 changed remarks 2014-01-20 00:55:40 +02:00
axelrodR
0c40165908 bugfix in RecastMeshDetail: in some rare dense cases the polygon simplification moves the polygon to a point where the center is very far from the region. For now we just fall back to the old code (flood-fill from the vertices) 2014-01-20 00:54:18 +02:00
axelrodR
b4204ba9a2 bugfix: minor typo caused stack overrun when several vertices happen to fall exactly on cell boundaries 2014-01-20 00:12:53 +02:00
Mikko Mononen
29db8cde1b Fix for detail mesh corner cases
- fix case where thing long poly center may not be on the region
2014-01-19 17:49:40 +02:00
Mikko Mononen
ad7a13cbf3 Small formatting change to dividePoly() 2014-01-19 16:47:26 +02:00
axelrodR
98f2f02c2b Optimization of of the mesh detail construction: replaced the first of the 2 flood-fill algorithms (the one used to find the span corresponding to the center of the polygon) with a search of span at the center with the region matching the polygon. 2014-01-19 14:02:41 +02:00
axelrodR
e063ba6f5a Rasterization optimization: replaced clipping for each individual cell. the clipping line/plane between two adjacent cells is common so data from former cell can be reused if we keep track of the "remaining polygon". 2014-01-15 14:14:08 +02:00
axelrodR
8e4633c64b Performance optimizations:
1. Triangle rasterization: replaced loops over all the grid cells of the AABB with looping over the area of the triangle itself (i.e. bounds are set per row).
2. Region expansion: instead of sweeping through all the cells at each expandRegion() and finding the right level - sweep once per few levels and divide among several stacks. Left over are appended.
2014-01-08 12:02:00 +02:00