From fca9709196d0b6885ae4dae409de173c04b4c2e2 Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Thu, 8 Jul 2010 11:41:08 +0000 Subject: [PATCH] fix for issue 85:Make getSpanCount accessible --- Recast/Include/Recast.h | 12 +++++++++--- Recast/Source/Recast.cpp | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Recast/Include/Recast.h b/Recast/Include/Recast.h index c3dcbd3..84a9069 100644 --- a/Recast/Include/Recast.h +++ b/Recast/Include/Recast.h @@ -102,13 +102,12 @@ struct rcCompactHeightfield { inline rcCompactHeightfield() : maxDistance(0), maxRegions(0), cells(0), - spans(0), dist(0), /*regs(0),*/ areas(0) {} + spans(0), dist(0), areas(0) {} inline ~rcCompactHeightfield() { delete [] cells; delete [] spans; delete [] dist; -// delete [] regs; delete [] areas; } int width, height; // Width and height of the heighfield. @@ -121,7 +120,6 @@ struct rcCompactHeightfield rcCompactCell* cells; // Pointer to width*height cells. rcCompactSpan* spans; // Pointer to spans. unsigned short* dist; // Pointer to per span distance to border. -// unsigned short* regs; // Pointer to per span region ID. unsigned char* areas; // Pointer to per span area ID. }; @@ -521,10 +519,18 @@ void rcFilterLedgeSpans(const int walkableHeight, void rcFilterWalkableLowHeightSpans(int walkableHeight, rcHeightfield& solid); +// Returns number of spans contained in a heightfield. +// Params: +// flags - (in) require flags for a cell to be included. +// hf - (in) heightfield to be compacted +// Returns number of spans. +int rcGetHeightFieldSpanCount(const unsigned char flags, rcHeightfield& hf); + // Builds compact representation of the heightfield. // Params: // walkableHeight - (in) minimum height where the agent can still walk // walkableClimb - (in) maximum height between grid cells the agent can climb +// flags - (in) require flags for a cell to be included in the compact heightfield. // hf - (in) heightfield to be compacted // chf - (out) compact heightfield representing the open space. // Returns false if operation ran out of memory. diff --git a/Recast/Source/Recast.cpp b/Recast/Source/Recast.cpp index 9fed737..864ad5f 100644 --- a/Recast/Source/Recast.cpp +++ b/Recast/Source/Recast.cpp @@ -105,7 +105,7 @@ void rcMarkWalkableTriangles(const float walkableSlopeAngle, } } -static int getSpanCount(unsigned char flags, rcHeightfield& hf) +int rcGetHeightFieldSpanCount(const unsigned char flags, rcHeightfield& hf) { const int w = hf.width; const int h = hf.height; @@ -132,7 +132,7 @@ bool rcBuildCompactHeightfield(const int walkableHeight, const int walkableClimb const int w = hf.width; const int h = hf.height; - const int spanCount = getSpanCount(flags, hf); + const int spanCount = rcGetHeightFieldSpanCount(flags, hf); // Fill in header. chf.width = w;