void ReadScene(void)
{
int i;
FILE *l_file;
unsigned short l_chunk_id;
unsigned int l_chunk_lenght;
unsigned char l_char;
unsigned short l_qty;
unsigned short l_face_flags;
if ((l_file=fopen (\"dwa.3ds\", \"rb\"))== NULL); //Open the file
while (ftell (l_file)
{
fread (&l_chunk_id, 2, 1, l_file); //Read the chunk header
fread (&l_chunk_lenght, 4, 1, l_file); //Read the lenght of the chunk
switch (l_chunk_id)
{
case 0x4D4D:
break;
case 0x3d3d:
break;
case 0x4130:
i=0;
do
{
fread (&l_char, 1, 1, l_file);
name1=l_char;
i++;
}while(l_char != \'\\0\' && i
break;
case 0x4000:
ilosc++;
i=0;
do
{
fread (&l_char, 1, 1, l_file);
name=l_char;
i++;
}while(l_char != \'\\0\' && i
break;
case 0x4100:
break;
case 0x4110:
fread (&l_qty, sizeof (unsigned short), 1, l_file);
vertices = l_qty;
for (i=0; i
{
fread (&vertex[0], sizeof(float), 1, l_file);
fread (&vertex[1], sizeof(float), 1, l_file);
fread (&vertex[2], sizeof(float), 1, l_file);
}
break;
case 0x4120:
fread (&l_qty, sizeof (unsigned short), 1, l_file);
polygons = l_qty;
for (i=0; i
{
fread (&polygon[0], sizeof (unsigned short), 1, l_file);
fread (&polygon[1], sizeof (unsigned short), 1, l_file);
fread (&polygon[2], sizeof (unsigned short), 1, l_file);
fread (&l_face_flags, sizeof (unsigned short), 1, l_file);
}
break;
default:
fseek(l_file, l_chunk_lenght-6, SEEK_CUR);
}
}
fclose (l_file);
}