• Create Account

### #ActualderKai

Posted 03 November 2013 - 07:37 AM

OK, here is the counts for a single mesh:

number of positions: 342

number of uv coords: 1884

number of faces: 628

okay.. here you see the number of uv coords is 3 times the number of faces.. this is very typical for textured models..

i've never seen separete index lists per semantic. i guess all your index lists are of the same size (3 * 628)

if thats so you may allocate your vertexbuffer (or buffers if you don't want interleaved vertexbuffers), iterate over the index lists and fill your buffer with the data at the given indices:

positionBuffer[faceCount*3]
tecCoordsBuffer[faceCount*3]

for(int i=0; i<faceCount*3; i++)
{
positionBuffer[i] = positionData[positionIndices[i]];
texCoordBuffer[i] = texCoordData[texCoordIndices[i]];
}


this will flatten you buffers (you don't need the indexbuffer for drawing)

for a interleaved buffer you will create a struct containing fields for position and texcoords and an array of these structs in a similar way

### #1derKai

Posted 03 November 2013 - 07:36 AM

OK, here is the counts for a single mesh:

number of positions: 342

number of uv coords: 1884

number of faces: 628

okay.. here you see the number of uv coords is 3 times the number of faces.. this is very typical for textured models..

i've never seen separete index lists per semantic. i guess all your index lists are of the same size (3 * 628)

if thats so you may allocate your vertexbuffer (or buffers if you don't want interleaved vertexbuffers), iteratete of the lists:

positionBuffer[faceCount*3]
tecCoordsBuffer[faceCount*3]

for(int i=0; i<faceCount*3; i++)
{
positionBuffer[i] = positionData[positionIndices[i]];
texCoordBuffer[i] = texCoordData[texCoordIndices[i]];
}


this will flatten you buffers (you don't need the indexbuffer for drawing)

for a interleaved buffer you will create a struct containing fields for position and texcoords and an array of these structs in a similar way

PARTNERS