Updated win32 project.
Fixed allocation of rcRegions, use placement new per array object, not for the whole array.
This commit is contained in:
parent
cd3a351f40
commit
377315641e
@ -438,7 +438,7 @@ static unsigned short* expandRegions(int maxIter, unsigned short level,
|
|||||||
|
|
||||||
struct rcRegion
|
struct rcRegion
|
||||||
{
|
{
|
||||||
inline rcRegion() : count(0), id(0), area(0), remap(false) {}
|
inline rcRegion(unsigned short i) : count(0), id(i), area(0), remap(false) {}
|
||||||
|
|
||||||
int count;
|
int count;
|
||||||
unsigned short id;
|
unsigned short id;
|
||||||
@ -697,7 +697,7 @@ static bool filterSmallRegions(int minRegionSize, int mergeRegionSize,
|
|||||||
const int h = chf.height;
|
const int h = chf.height;
|
||||||
|
|
||||||
const int nreg = maxRegionId+1;
|
const int nreg = maxRegionId+1;
|
||||||
rcRegion* regions = new(rcAlloc(sizeof(rcRegion)*nreg, RC_ALLOC_TEMP)) rcRegion[nreg];
|
rcRegion* regions = (rcRegion*)rcAlloc(sizeof(rcRegion)*nreg, RC_ALLOC_TEMP);
|
||||||
if (!regions)
|
if (!regions)
|
||||||
{
|
{
|
||||||
if (rcGetLog())
|
if (rcGetLog())
|
||||||
@ -705,8 +705,9 @@ static bool filterSmallRegions(int minRegionSize, int mergeRegionSize,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Construct regions
|
||||||
for (int i = 0; i < nreg; ++i)
|
for (int i = 0; i < nreg; ++i)
|
||||||
regions[i].id = (unsigned short)i;
|
new(®ions[i]) rcRegion((unsigned short)i);
|
||||||
|
|
||||||
// Find edge of a region and find connections around the contour.
|
// Find edge of a region and find connections around the contour.
|
||||||
for (int y = 0; y < h; ++y)
|
for (int y = 0; y < h; ++y)
|
||||||
|
Binary file not shown.
@ -187,6 +187,10 @@
|
|||||||
RelativePath="..\..\..\Recast\Include\Recast.h"
|
RelativePath="..\..\..\Recast\Include\Recast.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Include\RecastAlloc.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\Recast\Include\RecastLog.h"
|
RelativePath="..\..\..\Recast\Include\RecastLog.h"
|
||||||
>
|
>
|
||||||
@ -203,6 +207,10 @@
|
|||||||
RelativePath="..\..\..\Recast\Source\Recast.cpp"
|
RelativePath="..\..\..\Recast\Source\Recast.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Recast\Source\RecastAlloc.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\Recast\Source\RecastArea.cpp"
|
RelativePath="..\..\..\Recast\Source\RecastArea.cpp"
|
||||||
>
|
>
|
||||||
@ -247,6 +255,10 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Include"
|
Name="Include"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Include\DetourAlloc.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\Detour\Include\DetourCommon.h"
|
RelativePath="..\..\..\Detour\Include\DetourCommon.h"
|
||||||
>
|
>
|
||||||
@ -267,6 +279,10 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Source"
|
Name="Source"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\..\Detour\Source\DetourAlloc.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\Detour\Source\DetourCommon.cpp"
|
RelativePath="..\..\..\Detour\Source\DetourCommon.cpp"
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user