I asked Sinbad if he would be kind enough to make an API giving access
to the triangle data, but found out that there is no central location
that stores all this data, and his suggestion was to derive this data
manually using the 'getHeightAt' API.
Still, in order for me to ask the right questions, I need to
understand what the triangle data really is. I'm looking through the
MeshLoaderObj class to try and figure it out, it looks like the
triangle data is an array of ints?
while (src < srcEnd)
{
// Parse one row
row[0] = '\0';
src = parseRow(src, srcEnd, row, sizeof(row)/sizeof(char));
// Skip comments
if (row[0] == '#') continue;
if (row[0] == 'v' && row[1] != 'n' && row[1] != 't')
{
// Vertex pos
sscanf(row+1, "%f %f %f", &x, &y, &z);
addVertex(x, y, z, vcap);
}
if (row[0] == 'f')
{
// Faces
nv = parseFace(row+1, face, 32, m_vertCount);
for (int i = 2; i < nv; ++i)
addTriangle(face[0], face[i-1], face[i], tcap);
}
}
So in here we add vertices and faces depending on what is read in from
the .obj file. The triangle data looks to be retrieved from the face
data:
void rcMeshLoaderObj::addTriangle(int a, int b, int c, int& cap)
{
if (m_triCount+1 > cap)
{
cap = !cap ? 8 : cap*2;
int* nv = new int[cap*3];
if (m_triCount)
memcpy(nv, m_tris, m_triCount*3*sizeof(int));
delete [] m_tris;
m_tris = nv;
}
int* dst = &m_tris[m_triCount*3];
*dst++ = a;
*dst++ = b;
*dst++ = c;
m_triCount++;
}
As you can tell this process for getting data is nothing similar to
how I would get it from an a mesh or heightfield object. (No parsing
of files)
In this situation, what does a face represent, how is it different
from a triangle? How does an int represent a triangle, maybe each
triangle is a few ints within the array? (are they ints in the array
grouped together to form some meaningful data?)
Thanks for the help. (really looking forward to using recast but I'm
not used to the lower level side of graphics programming.. :( )
Ben
> > I'm basically not sure how to retrieve triangle, face, and normal data.- Hide quoted text -
>
> - Show quoted text -