protected override void ReadGeometry( BinaryReader reader, VertexData data )
{
short texCoordSet = 0;
short bindIdx = 0;
data.vertexStart = 0;
data.vertexCount = ReadInt( reader );
ReadGeometryPositions( bindIdx++, reader, data );
if ( !IsEOF( reader ) )
{
// check out the next chunk
MeshChunkID chunkID = ReadChunk( reader );
// keep going as long as we have more optional buffer chunks
while ( !IsEOF( reader ) &&
( chunkID == MeshChunkID.GeometryNormals ||
chunkID == MeshChunkID.GeometryColors ||
chunkID == MeshChunkID.GeometryTexCoords ) )
{
switch ( chunkID )
{
case MeshChunkID.GeometryNormals:
ReadGeometryNormals( bindIdx++, reader, data );
break;
case MeshChunkID.GeometryColors:
ReadGeometryColors( bindIdx++, reader, data );
break;
case MeshChunkID.GeometryTexCoords:
ReadGeometryTexCoords( bindIdx++, reader, data, texCoordSet++ );
break;
} // switch
// read the next chunk
if ( !IsEOF( reader ) )
{
chunkID = ReadChunk( reader );
}
} // while
if ( !IsEOF( reader ) )
{
// skip back so the continuation of the calling loop can look at the next chunk
// since we already read past it
Seek( reader, -ChunkOverheadSize );
}
}
}