本文整理汇总了C++中FileIO::openForRead方法的典型用法代码示例。如果您正苦于以下问题:C++ FileIO::openForRead方法的具体用法?C++ FileIO::openForRead怎么用?C++ FileIO::openForRead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileIO
的用法示例。
在下文中一共展示了FileIO::openForRead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rcMax
Sample_Debug::Sample_Debug() :
m_chf(0),
m_cset(0),
m_pmesh(0)
{
resetCommonSettings();
// Test
/* m_chf = rcAllocCompactHeightfield();
FileIO io;
if (!io.openForRead("test.chf"))
{
delete m_chf;
m_chf = 0;
}
else
{
if (!duReadCompactHeightfield(*m_chf, &io))
{
delete m_chf;
m_chf = 0;
}
}*/
/* if (m_chf)
{
unsigned short ymin = 0xffff;
unsigned short ymax = 0;
for (int i = 0; i < m_chf->spanCount; ++i)
{
const rcCompactSpan& s = m_chf->spans[i];
if (s.y < ymin) ymin = s.y;
if (s.y > ymax) ymax = s.y;
}
printf("ymin=%d ymax=%d\n", (int)ymin, (int)ymax);
int maxSpans = 0;
for (int i = 0; i < m_chf->width*m_chf->height; ++i)
{
maxSpans = rcMax(maxSpans, (int)m_chf->cells[i].count);
}
printf("maxSpans = %d\n", maxSpans);
}*/
/* const float orig[3] = {0,0,0};
m_navMesh = new dtNavMesh;
m_navMesh->init(orig, 133.333f,133.333f, 2048, 4096, 4096);
unsigned char* data = 0;
int dataSize = 0;
// Tile_-13_-14.bin is basically just the bytes that was output by Detour. It should be loaded at X: -13 and Y: -14.
dataSize = loadBin("Tile_-13_-13.bin", &data);
if (dataSize > 0)
{
m_navMesh->addTileAt(-13,-13, data, dataSize, true);
dtMeshHeader* header = (dtMeshHeader*)data;
vcopy(m_bmin, header->bmin);
vcopy(m_bmax, header->bmax);
}
dataSize = loadBin("Tile_-13_-14.bin", &data);
if (dataSize > 0)
{
m_navMesh->addTileAt(-13,-14, data, dataSize, true);
}
dataSize = loadBin("Tile_-14_-14.bin", &data);
if (dataSize > 0)
{
m_navMesh->addTileAt(-14,-14, data, dataSize, true);
}
const float ext[3] = {40,100,40};
const float center[3] = { -1667.9491f, 135.52649f, -1680.6149f };
dtQueryFilter filter;
m_ref = m_navMesh->findNearestPoly(center, ext, &filter, 0);
vcopy(m_ext, ext);
vcopy(m_center, center);*/
{
m_cset = rcAllocContourSet();
if (m_cset)
{
FileIO io;
if (io.openForRead("PathSet_TMP_NA_PathingTestAReg1_1_2_CS.rc"))
{
duReadContourSet(*m_cset, &io);
printf("bmin=(%f,%f,%f) bmax=(%f,%f,%f)\n",
m_cset->bmin[0], m_cset->bmin[1], m_cset->bmin[2],
m_cset->bmax[0], m_cset->bmax[1], m_cset->bmax[2]);
printf("cs=%f ch=%f\n", m_cset->cellSizeXZ, m_cset->cellSizeY);
}
else
{
//.........这里部分代码省略.........