本文整理汇总了C++中rcAlloc函数的典型用法代码示例。如果您正苦于以下问题:C++ rcAlloc函数的具体用法?C++ rcAlloc怎么用?C++ rcAlloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rcAlloc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rcBuildDistanceField
/// @par
///
/// This is usually the second to the last step in creating a fully built
/// compact heightfield. This step is required before regions are built
/// using #rcBuildRegions or #rcBuildRegionsMonotone.
///
/// After this step, the distance data is available via the rcCompactHeightfield::maxDistance
/// and rcCompactHeightfield::dist fields.
///
/// @see rcCompactHeightfield, rcBuildRegions, rcBuildRegionsMonotone
bool rcBuildDistanceField(rcContext* ctx, rcCompactHeightfield& chf)
{
rcAssert(ctx);
ctx->startTimer(RC_TIMER_BUILD_DISTANCEFIELD);
if (chf.dist)
{
rcFree(chf.dist);
chf.dist = 0;
}
unsigned short* src = (unsigned short*)rcAlloc(sizeof(unsigned short)*chf.spanCount, RC_ALLOC_TEMP);
if (!src)
{
ctx->log(RC_LOG_ERROR, "rcBuildDistanceField: Out of memory 'src' (%d).", chf.spanCount);
return false;
}
unsigned short* dst = (unsigned short*)rcAlloc(sizeof(unsigned short)*chf.spanCount, RC_ALLOC_TEMP);
if (!dst)
{
ctx->log(RC_LOG_ERROR, "rcBuildDistanceField: Out of memory 'dst' (%d).", chf.spanCount);
rcFree(src);
return false;
}
unsigned short maxDist = 0;
ctx->startTimer(RC_TIMER_BUILD_DISTANCEFIELD_DIST);
calculateDistanceField(chf, src, maxDist);
chf.maxDistance = maxDist;
ctx->stopTimer(RC_TIMER_BUILD_DISTANCEFIELD_DIST);
ctx->startTimer(RC_TIMER_BUILD_DISTANCEFIELD_BLUR);
// Blur
if (boxBlur(chf, 1, src, dst) != src)
rcSwap(src, dst);
// Store distance.
chf.dist = src;
ctx->stopTimer(RC_TIMER_BUILD_DISTANCEFIELD_BLUR);
ctx->stopTimer(RC_TIMER_BUILD_DISTANCEFIELD);
rcFree(dst);
return true;
}
开发者ID:Frankenhooker,项目名称:OpenWoW541,代码行数:62,代码来源:RecastRegion.cpp
示例2: CacheLine
static void CacheLine(WCHAR *lptr, char *xbuf)
{
if (inSymFile)
{
char *p = strchr(xbuf, '#');
if (p)
return;
}
if ((incldepth == 0 && (!*lptr || *lptr == '#')) || inSymFile)
{
char *s = rcStrdup(xbuf);
LIST *x = rcAlloc(sizeof(LIST));
x->data = s;
if (inSymFile)
{
*hCachedLineTail = x;
hCachedLineTail = &(*hCachedLineTail)->next;
}
else
{
*cachedLineTail = x;
cachedLineTail = &(*cachedLineTail)->next;
}
}
}
开发者ID:NoSuchProcess,项目名称:OrangeC,代码行数:26,代码来源:rcgs.c
示例3: allocSpan
static rcSpan* allocSpan(rcHeightfield& hf)
{
// If running out of memory, allocate new page and update the freelist.
if (!hf.freelist || !hf.freelist->next)
{
// Create new page.
// Allocate memory for the new pool.
rcSpanPool* pool = (rcSpanPool*)rcAlloc(sizeof(rcSpanPool), RC_ALLOC_PERM);
if (!pool) return 0;
// Add the pool into the list of pools.
pool->next = hf.pools;
hf.pools = pool;
// Add new items to the free list.
rcSpan* freelist = hf.freelist;
rcSpan* head = &pool->items[0];
rcSpan* it = &pool->items[RC_SPANS_PER_POOL];
do
{
--it;
it->next = freelist;
freelist = it;
}
while (it != head);
hf.freelist = it;
}
// Pop item from in front of the free list.
rcSpan* it = hf.freelist;
hf.freelist = hf.freelist->next;
return it;
}
开发者ID:DopaminaInTheVein,项目名称:ItLightens,代码行数:32,代码来源:RecastRasterization.cpp
示例4: rcCreateHeightfield
/// @par
///
/// See the #rcConfig documentation for more information on the configuration parameters.
///
/// @see rcAllocHeightfield, rcHeightfield
bool rcCreateHeightfield(rcContext* /*ctx*/, rcHeightfield& hf, int width, int height,
const float* bmin, const float* bmax,
float cs, float ch)
{
// TODO: VC complains about unref formal variable, figure out a way to handle this better.
// rcAssert(ctx);
hf.width = width;
hf.height = height;
rcVcopy(hf.bmin, bmin);
rcVcopy(hf.bmax, bmax);
hf.cs = cs;
hf.ch = ch;
hf.spans = (rcSpan**)rcAlloc(sizeof(rcSpan*)*hf.width*hf.height, RC_ALLOC_PERM);
if (!hf.spans)
return false;
memset(hf.spans, 0, sizeof(rcSpan*)*hf.width*hf.height);
#if EPIC_ADDITION_USE_NEW_RECAST_RASTERIZER
hf.EdgeHits = (rcEdgeHit*)rcAlloc(sizeof(rcEdgeHit) * (hf.height + 1), RC_ALLOC_PERM);
memset(hf.EdgeHits, 0, sizeof(rcEdgeHit) * (hf.height + 1));
hf.RowExt = (rcRowExt*)rcAlloc(sizeof(rcRowExt) * (hf.height + 2), RC_ALLOC_PERM);
for (int i = 0; i < hf.height + 2; i++)
{
hf.RowExt[i].MinCol = hf.width + 2;
hf.RowExt[i].MaxCol = -2;
}
hf.tempspans = (rcTempSpan*)rcAlloc(sizeof(rcTempSpan)*(hf.width + 2) * (hf.height + 2), RC_ALLOC_PERM);
for (int i = 0; i < hf.height + 2; i++)
{
for (int j = 0; j < hf.width + 2; j++)
{
hf.tempspans[i * (hf.width + 2) + j].sminmax[0] = 32000;
hf.tempspans[i * (hf.width + 2) + j].sminmax[1] = -32000;
}
}
#endif
return true;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:50,代码来源:Recast.cpp
示例5: DoInsert
static void DoInsert(struct resRes *menuData, MENUITEM **items, int code, MENUITEM *parent)
{
switch (code)
{
MENUITEM *newItem;
case IDM_DELETE:
UndoDelete(menuData, items);
(*items)->expanded = FALSE;
*items = (*items)->next;
ResSetDirty(menuData);
InvalidateRect(menuData->activeHwnd, 0, FALSE);
break;
case IDM_INSERT:
ResGetHeap(workArea, menuData);
newItem = rcAlloc(sizeof(MENUITEM));
newItem->next = *items;
*items = newItem;
StringAsciiToWChar(&newItem->text, "New Item", 8);
if (parent)
{
newItem->id = parent->id;
parent->id = NULL;
}
else
{
newItem->id = ResAllocateMenuId();
}
UndoInsert(menuData, items);
ResSetDirty(menuData);
InvalidateRect(menuData->activeHwnd, 0, FALSE);
break;
case IDM_INSERT_SEPARATOR:
ResGetHeap(workArea, menuData);
newItem = rcAlloc(sizeof(MENUITEM));
newItem->next = *items;
SetSeparatorFlag(menuData->resource->u.menu, newItem, TRUE);
*items = newItem;
UndoInsert(menuData, items);
ResSetDirty(menuData);
InvalidateRect(menuData->activeHwnd, 0, FALSE);
break;
}
}
开发者ID:jossk,项目名称:OrangeC,代码行数:43,代码来源:drawmenu.c
示例6: while
/// @par
///
/// Using this method ensures the array is at least large enough to hold
/// the specified number of elements. This can improve performance by
/// avoiding auto-resizing during use.
void rcIntArray::doResize(int n)
{
if (!m_cap) m_cap = n;
while (m_cap < n) m_cap *= 2;
int* newData = (int*)rcAlloc(m_cap*sizeof(int), RC_ALLOC_TEMP);
rcAssert(newData);
if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int));
rcFree(m_data);
m_data = newData;
}
开发者ID:090809,项目名称:TrinityCore,代码行数:15,代码来源:RecastAlloc.cpp
示例7: rcBuildDistanceField
/// @par
///
/// This is usually the second to the last step in creating a fully built
/// compact heightfield. This step is required before regions are built
/// using #rcBuildRegions or #rcBuildRegionsMonotone.
///
/// After this step, the distance data is available via the rcCompactHeightfield::maxDistance
/// and rcCompactHeightfield::dist fields.
///
/// @see rcCompactHeightfield, rcBuildRegions, rcBuildRegionsMonotone
bool rcBuildDistanceField(rcCompactHeightfield& chf)
{
if (chf.dist)
{
rcFree(chf.dist);
chf.dist = 0;
}
unsigned short* src = (unsigned short*)rcAlloc(sizeof(unsigned short)*chf.spanCount, RC_ALLOC_TEMP);
if (!src)
{
return false;
}
unsigned short* dst = (unsigned short*)rcAlloc(sizeof(unsigned short)*chf.spanCount, RC_ALLOC_TEMP);
if (!dst)
{
rcFree(src);
return false;
}
unsigned short maxDist = 0;
calculateDistanceField(chf, src, maxDist);
chf.maxDistance = maxDist;
// Blur
if (boxBlur(chf, 1, src, dst) != src)
rcSwap(src, dst);
// Store distance.
chf.dist = src;
rcFree(dst);
return true;
}
开发者ID:ngoaho91,项目名称:bamboocc,代码行数:46,代码来源:RecastRegion.cpp
示例8: rcCreateHeightfield
bool rcCreateHeightfield(rcHeightfield& hf, int width, int height,
const float* bmin, const float* bmax,
float cs, float ch)
{
hf.width = width;
hf.height = height;
rcVcopy(hf.bmin, bmin);
rcVcopy(hf.bmax, bmax);
hf.cs = cs;
hf.ch = ch;
hf.spans = (rcSpan**)rcAlloc(sizeof(rcSpan*)*hf.width*hf.height, RC_ALLOC_PERM);
if (!hf.spans)
return false;
memset(hf.spans, 0, sizeof(rcSpan*)*hf.width*hf.height);
return true;
}
开发者ID:1414648814,项目名称:OpenglESGame,代码行数:16,代码来源:Recast.cpp
示例9: rcCreateHeightfield
/// @par
///
/// See the #rcConfig documentation for more information on the configuration parameters.
///
/// @see rcAllocHeightfield, rcHeightfield
bool rcCreateHeightfield(rcContext* ctx, rcHeightfield& hf, int width, int height,
const dtCoordinates& bmin, const dtCoordinates& bmax,
float cs, float ch)
{
rcIgnoreUnused(ctx);
hf.width = width;
hf.height = height;
rcVcopy(hf.bmin, bmin);
rcVcopy(hf.bmax, bmax);
hf.cs = cs;
hf.ch = ch;
hf.spans = (rcSpan**)rcAlloc(sizeof(rcSpan*)*hf.width*hf.height, RC_ALLOC_PERM);
if (!hf.spans)
return false;
memset(hf.spans, 0, sizeof(rcSpan*)*hf.width*hf.height);
return true;
}
开发者ID:infini,项目名称:_task,代码行数:23,代码来源:Recast.cpp
示例10: mergeContours
static bool mergeContours(rcContour& ca, rcContour& cb, int ia, int ib)
{
const int maxVerts = ca.nverts + cb.nverts + 2;
int* verts = (int*)rcAlloc(sizeof(int)*maxVerts*4, RC_ALLOC_PERM);
if (!verts)
return false;
int nv = 0;
// Copy contour A.
for (int i = 0; i <= ca.nverts; ++i)
{
int* dst = &verts[nv*4];
const int* src = &ca.verts[((ia+i)%ca.nverts)*4];
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
dst[3] = src[3];
nv++;
}
// Copy contour B
for (int i = 0; i <= cb.nverts; ++i)
{
int* dst = &verts[nv*4];
const int* src = &cb.verts[((ib+i)%cb.nverts)*4];
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
dst[3] = src[3];
nv++;
}
rcFree(ca.verts);
ca.verts = verts;
ca.nverts = nv;
rcFree(cb.verts);
cb.verts = 0;
cb.nverts = 0;
return true;
}
开发者ID:rwindegger,项目名称:recastnavigation,代码行数:43,代码来源:RecastContour.cpp
示例11: rcCreateHeightfield
bool rcCreateHeightfield(rcContext* /*ctx*/, rcHeightfield& hf, int width, int height,
const float* bmin, const float* bmax,
float cs, float ch)
{
// TODO: VC complains about unref formal variable, figure out a way to handle this better.
// rcAssert(ctx);
hf.width = width;
hf.height = height;
rcVcopy(hf.bmin, bmin);
rcVcopy(hf.bmax, bmax);
hf.cs = cs;
hf.ch = ch;
hf.spans = (rcSpan**)rcAlloc(sizeof(rcSpan*)*hf.width*hf.height, RC_ALLOC_PERM);
if (!hf.spans)
return false;
memset(hf.spans, 0, sizeof(rcSpan*)*hf.width*hf.height);
return true;
}
开发者ID:drwbns,项目名称:tpnew---latest-ogre_v2-1,代码行数:19,代码来源:Recast.cpp
示例12: StringTableInsert
static void StringTableInsert(struct resRes *stringTableData, int index)
{
if (index != -1)
{
STRINGS *strings = rcAlloc(sizeof(STRINGS));
ResGetHeap(workArea, stringTableData);
if (strings)
{
int origIndex = 0;
STRINGS **p = &stringTableData->resource->u.stringtable;
strings->id = ResAllocateStringId();
strings->length = StringAsciiToWChar(&strings->string, " ", 1);
for ( ; index && *p; index--, origIndex++, p = &(*p)->next);
strings->next = *p;
*p = strings;
PopulateItem(stringTableData->gd.childWindow, strings, origIndex);
StringTableSetInserted(stringTableData, origIndex);
}
}
}
开发者ID:jossk,项目名称:OrangeC,代码行数:20,代码来源:drawstrings.c
示例13: if
void NavMeshCreator::allocIntermediateResults()
{
if (m_success)
{
if ((m_intermediateContourSet = rcAllocContourSet()) == 0)
{
m_context->log(RC_LOG_ERROR, "NavMeshCreator: unable to allocate memory for the contour set.");
m_success = false;
}
else if ((m_intermediatePolyMesh = rcAllocPolyMesh()) == 0)
{
m_context->log(RC_LOG_ERROR, "NavMeshCreator: unable to allocate memory for the polygon mesh.");
m_success = false;
}
else if ((m_intermediateHeightfield = rcAllocHeightfield()) == 0)
{
m_context->log(RC_LOG_ERROR, "NavMeshCreator: unable to allocate memory for the heightfield.");
m_success = false;
}
else if ((m_intermediateCompactHeightfield = rcAllocCompactHeightfield()) == 0)
{
m_context->log(RC_LOG_ERROR, "NavMeshCreator: unable to allocate memory for the compact heightfield.");
m_success = false;
}
else if ((m_intermediatePolyMeshDetail = rcAllocPolyMeshDetail()) == 0)
{
m_context->log(RC_LOG_ERROR, "NavMeshCreator: unable to allocate memory for the detail polygon mesh.");
m_success = false;
}
else if ((m_intermediateTriangleTags = static_cast<unsigned char*>(rcAlloc(sizeof(unsigned char) * m_inputTrianglesCount,RC_ALLOC_TEMP))) == 0)
{
m_context->log(RC_LOG_ERROR, "NavMeshCreator: unable to allocate memory for the triangle tags.");
m_success = false;
}
else if ((m_intermediateNavMeshCreateParams = static_cast<dtNavMeshCreateParams*>(rcAlloc(sizeof(dtNavMeshCreateParams),RC_ALLOC_TEMP)))==0)
{
m_context->log(RC_LOG_ERROR, "NavMeshCreator: unable to allocate memory for the Detour navmesh creation parameters.");
m_success = false;
}
}
}
开发者ID:Conglang,项目名称:recastdetour,代码行数:41,代码来源:NavMeshCreator.cpp
示例14: PropSetIdName
void PropSetIdName(struct resRes *data, char *buf, EXPRESSION **exp, CONTROL *ctls)
{
WCHAR name[512], *p = name;
char xx[256],*q;
int id = GetId(*exp);
while (isspace(*buf))
buf ++;
q = buf;
if (!isalpha(*q) && *q != '_')
return;
while (*q)
{
if (!isalnum(*q) && (*q) != '_')
return;
q++;
}
ResGetHeap(workArea, data);
ResSetDirty(data);
if (!ctls)
ResSetTreeName(data,buf);
while (*buf)
*p++ = *buf++;
*p = 0;
*exp = ReadExpFromString(name);
if (!*exp)
{
*exp = rcAlloc(sizeof(EXPRESSION));
(*exp)->type = e_int;
(*exp)->rendition = rcStrdup(name);
SetId(data, *exp, id, ctls);
}
else
{
sprintf(xx, "%d", (*exp)->val);
if (!strcmp(xx, (*exp)->rendition))
(*exp)->rendition = NULL;
else
SetId(data, *exp, id, ctls);
}
}
开发者ID:doniexun,项目名称:OrangeC,代码行数:40,代码来源:propswnd.c
示例15: rcBuildRegions
/// @par
///
/// Non-null regions will consist of connected, non-overlapping walkable spans that form a single contour.
/// Contours will form simple polygons.
///
/// If multiple regions form an area that is smaller than @p minRegionArea, then all spans will be
/// re-assigned to the zero (null) region.
///
/// Watershed partitioning can result in smaller than necessary regions, especially in diagonal corridors.
/// @p mergeRegionArea helps reduce unecessarily small regions.
///
/// See the #rcConfig documentation for more information on the configuration parameters.
///
/// The region data will be available via the rcCompactHeightfield::maxRegions
/// and rcCompactSpan::reg fields.
///
/// @warning The distance field must be created using #rcBuildDistanceField before attempting to build regions.
///
/// @see rcCompactHeightfield, rcCompactSpan, rcBuildDistanceField, rcBuildRegionsMonotone, rcConfig
bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf,
const int borderSize, const int minRegionArea, const int mergeRegionArea)
{
rcAssert(ctx);
ctx->startTimer(RC_TIMER_BUILD_REGIONS);
rcScopedDelete<unsigned short> spanBuf4 = (unsigned short*)rcAlloc(sizeof(unsigned short)*chf.spanCount*4, RC_ALLOC_TEMP);
if (!spanBuf4)
{
ctx->log(RC_LOG_ERROR, "rcBuildRegions: Out of memory 'spanBuf4' (%d).", chf.spanCount*4);
return false;
}
ctx->startTimer(RC_TIMER_BUILD_REGIONS_WATERSHED);
unsigned short* srcReg = spanBuf4;
if (!rcGatherRegionsNoFilter(ctx, chf, borderSize, spanBuf4))
return false;
ctx->stopTimer(RC_TIMER_BUILD_REGIONS_WATERSHED);
ctx->startTimer(RC_TIMER_BUILD_REGIONS_FILTER);
// Filter out small regions.
const int chunkSize = rcMax(chf.width, chf.height);
if (!filterSmallRegions(ctx, minRegionArea, mergeRegionArea, chunkSize, chf.maxRegions, chf, srcReg))
return false;
ctx->stopTimer(RC_TIMER_BUILD_REGIONS_FILTER);
// Write the result out.
for (int i = 0; i < chf.spanCount; ++i)
chf.spans[i].reg = srcReg[i];
ctx->stopTimer(RC_TIMER_BUILD_REGIONS);
return true;
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:57,代码来源:RecastRegion.cpp
示例16: rcBuildHeightfieldLayersChunky
bool rcBuildHeightfieldLayersChunky(rcContext* ctx, rcCompactHeightfield& chf,
const int borderSize, const int walkableHeight,
const int chunkSize,
rcHeightfieldLayerSet& lset)
{
rcAssert(ctx);
ctx->startTimer(RC_TIMER_BUILD_LAYERS);
rcScopedDelete<unsigned short> srcReg = (unsigned short*)rcAlloc(sizeof(unsigned short)*chf.spanCount, RC_ALLOC_TEMP);
if (!srcReg)
{
ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: Out of memory 'srcReg' (%d).", chf.spanCount);
return false;
}
memset(srcReg,0xff,sizeof(unsigned short)*chf.spanCount);
rcLayerRegionMonotone* regs = NULL;
int nregs = 0;
const bool bHasRegions = CollectLayerRegionsChunky(ctx, chf, borderSize, chunkSize, srcReg, regs, nregs);
if (!bHasRegions)
{
return false;
}
const bool bHasSaved = SplitAndStoreLayerRegions(ctx, chf, borderSize, walkableHeight, srcReg, regs, nregs, lset);
rcFree(regs);
if (!bHasSaved)
{
return false;
}
ctx->stopTimer(RC_TIMER_BUILD_LAYERS);
return true;
}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:38,代码来源:RecastLayers.cpp
示例17: rcAllocHeightfield
rcHeightfield* rcAllocHeightfield()
{
rcHeightfield* hf = (rcHeightfield*)rcAlloc(sizeof(rcHeightfield), RC_ALLOC_PERM);
memset(hf, 0, sizeof(rcHeightfield));
return hf;
}
开发者ID:drwbns,项目名称:tpnew---latest-ogre_v2-1,代码行数:6,代码来源:Recast.cpp
示例18: rcBuildCompactHeightfield
bool rcBuildCompactHeightfield(rcContext* ctx, const int walkableHeight, const int walkableClimb,
rcHeightfield& hf, rcCompactHeightfield& chf)
{
rcAssert(ctx);
ctx->startTimer(RC_TIMER_BUILD_COMPACTHEIGHTFIELD);
const int w = hf.width;
const int h = hf.height;
const int spanCount = rcGetHeightFieldSpanCount(ctx, hf);
// Fill in header.
chf.width = w;
chf.height = h;
chf.spanCount = spanCount;
chf.walkableHeight = walkableHeight;
chf.walkableClimb = walkableClimb;
chf.maxRegions = 0;
rcVcopy(chf.bmin, hf.bmin);
rcVcopy(chf.bmax, hf.bmax);
chf.bmax[1] += walkableHeight*hf.ch;
chf.cs = hf.cs;
chf.ch = hf.ch;
chf.cells = (rcCompactCell*)rcAlloc(sizeof(rcCompactCell)*w*h, RC_ALLOC_PERM);
if (!chf.cells)
{
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Out of memory 'chf.cells' (%d)", w*h);
return false;
}
memset(chf.cells, 0, sizeof(rcCompactCell)*w*h);
chf.spans = (rcCompactSpan*)rcAlloc(sizeof(rcCompactSpan)*spanCount, RC_ALLOC_PERM);
if (!chf.spans)
{
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Out of memory 'chf.spans' (%d)", spanCount);
return false;
}
memset(chf.spans, 0, sizeof(rcCompactSpan)*spanCount);
chf.areas = (unsigned char*)rcAlloc(sizeof(unsigned char)*spanCount, RC_ALLOC_PERM);
if (!chf.areas)
{
ctx->log(RC_LOG_ERROR, "rcBuildCompactHeightfield: Out of memory 'chf.areas' (%d)", spanCount);
return false;
}
memset(chf.areas, RC_NULL_AREA, sizeof(unsigned char)*spanCount);
const int MAX_HEIGHT = 0xffff;
// Fill in cells and spans.
int idx = 0;
for (int y = 0; y < h; ++y)
{
for (int x = 0; x < w; ++x)
{
const rcSpan* s = hf.spans[x + y*w];
// If there are no spans at this cell, just leave the data to index=0, count=0.
if (!s) continue;
rcCompactCell& c = chf.cells[x + y*w];
c.index = idx;
c.count = 0;
while (s)
{
if (s->area != RC_NULL_AREA)
{
const int bot = (int)s->smax;
const int top = s->next ? (int)s->next->smin : MAX_HEIGHT;
chf.spans[idx].y = (unsigned short)rcClamp(bot, 0, 0xffff);
chf.spans[idx].h = (unsigned char)rcClamp(top - bot, 0, 0xff);
chf.areas[idx] = s->area;
idx++;
c.count++;
}
s = s->next;
}
}
}
// Find neighbour connections.
const int MAX_LAYERS = RC_NOT_CONNECTED - 1;
int tooHighNeighbour = 0;
for (int y = 0; y < h; ++y)
{
for (int x = 0; x < w; ++x)
{
const rcCompactCell& c = chf.cells[x + y*w];
for (int i = (int)c.index, ni = (int)(c.index + c.count); i < ni; ++i)
{
rcCompactSpan& s = chf.spans[i];
for (int dir = 0; dir < 4; ++dir)
{
rcSetCon(s, dir, RC_NOT_CONNECTED);
const int nx = x + rcGetDirOffsetX(dir);
const int ny = y + rcGetDirOffsetY(dir);
// First check that the neighbour cell is in bounds.
if (nx < 0 || ny < 0 || nx >= w || ny >= h)
continue;
// Iterate over all neighbour spans and check if any of the is
// accessible from current cell.
const rcCompactCell& nc = chf.cells[nx + ny*w];
//.........这里部分代码省略.........
开发者ID:drwbns,项目名称:tpnew---latest-ogre_v2-1,代码行数:101,代码来源:Recast.cpp
示例19: rcAllocPolyMeshDetail
rcPolyMeshDetail* rcAllocPolyMeshDetail()
{
rcPolyMeshDetail* dmesh = (rcPolyMeshDetail*)rcAlloc(sizeof(rcPolyMeshDetail), RC_ALLOC_PERM);
memset(dmesh, 0, sizeof(rcPolyMeshDetail));
return dmesh;
}
开发者ID:drwbns,项目名称:tpnew---latest-ogre_v2-1,代码行数:6,代码来源:Recast.cpp
示例20: rcAllocPolyMesh
rcPolyMesh* rcAllocPolyMesh()
{
rcPolyMesh* pmesh = (rcPolyMesh*)rcAlloc(sizeof(rcPolyMesh), RC_ALLOC_PERM);
memset(pmesh, 0, sizeof(rcPolyMesh));
return pmesh;
}
开发者ID:drwbns,项目名称:tpnew---latest-ogre_v2-1,代码行数:6,代码来源:Recast.cpp
注:本文中的rcAlloc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论