current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer (); numb_faces =ReadInt (); #ifdef __DEBUG__
printf (\ #endif
for (int i=0;i faces [0]=ReadInt (); faces [1]=ReadInt (); faces [2]=ReadInt (); temp_diff=ReadInt () & 0x000F; faces [3]=(temp_diff & 0x0004) 2; faces [4]=(temp_diff & 0x0002) 1; faces [5]=(temp_diff & 0x0001); #ifdef __DEBUG__ printf (\ i, faces [0], faces [1], faces [2], faces [3], faces [4], faces [5]); #endif } if (ReadInt ()==TRI_SMOOTH) ReadSmoothingChunk (); #ifdef __DEBUG__ else printf (\ #endif ChangeChunkPointer (current_pointer+temp_pointer); // move to the new chunk position return (temp_pointer); } /*----------------------------------------------------------------------------*/ unsigned long ReadTranslationChunk (void) { unsigned long current_pointer; unsigned long temp_pointer; current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer (); for (int j=0;j<4;j++) { for (int i=0;i<3;i++) fread (&(trans_mat [j][i]),sizeof (float),1,bin3ds); } trans_mat [0][3]=0; trans_mat [1][3]=0; trans_mat [2][3]=0; trans_mat [3][3]=1; #ifdef __DEBUG__ printf (\ for (int i=0;i<4;i++) printf (\ trans_mat [i][0], trans_mat [i][1], trans_mat [i][2], trans_mat [i][3]); #endif ChangeChunkPointer (current_pointer+temp_pointer); // move to the new chunk position return (temp_pointer); } /*----------------------------------------------------------------------------*/ unsigned long ReadObjChunk (void) { unsigned char end_found=FALSE,boolean=TRUE; unsigned int temp_int; unsigned long current_pointer; unsigned long temp_pointer; unsigned long tellertje=6L; // 2 id + 4 pointer current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer (); while (end_found==FALSE) { temp_int=ReadInt (); switch (temp_int) { case TRI_VERTEXL : #ifdef __DEBUG__ printf (\Found Object vertices chunk id of %0X\\n\ temp_int); #endif tellertje+=ReadVerticesChunk (); break; case TRI_FACEL1 : #ifdef __DEBUG__ printf (\Found Object faces (1) chunk id of %0X\\n\ temp_int); #endif tellertje+=ReadFacesChunk (); break; case TRI_FACEL2 : #ifdef __DEBUG__ printf (\Found Object faces (2) chunk id of %0X\\n\ temp_int); #endif tellertje+=ReadUnknownChunk (temp_int); break; case TRI_LOCAL : #ifdef __DEBUG__ printf (\of %0X\\n\ temp_int); #endif tellertje+=ReadTranslationChunk (); break; case TRI_VISIBLE : #ifdef __DEBUG__ printf (\Found Object vis/invis chunk id of %0X\\n\ temp_int); #endif tellertje+=ReadBooleanChunk (&boolean); #ifdef __DEBUG__ if (boolean==TRUE) printf (\ else printf (\ #endif break; default: break; } tellertje+=2; if (tellertje=temp_pointer) end_found=TRUE; } ChangeChunkPointer (current_pointer+temp_pointer); // move to the new chunk position return (temp_pointer); } /*----------------------------------------------------------------------------*/ unsigned long ReadObjectChunk (void) { unsigned char end_found=FALSE; unsigned int temp_int; unsigned long current_pointer; unsigned long temp_pointer; unsigned long tellertje=6L; // 2 id + 4 pointer current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer (); if (ReadName ()==-1) { #ifdef __DEBUG__ printf (\ #endif } while (end_found==FALSE) { temp_int=ReadInt (); switch (temp_int) { case OBJ_UNKNWN01:tellertje+=ReadUnknownChunk (OBJ_UNKNWN01);break; case OBJ_UNKNWN02:tellertje+=ReadUnknownChunk (OBJ_UNKNWN02);break; case OBJ_TRIMESH : #ifdef __DEBUG__ printf (\ OBJ_TRIMESH); #endif tellertje+=ReadObjChunk (); break; case OBJ_LIGHT : #ifdef __DEBUG__ printf (\ OBJ_LIGHT); #endif tellertje+=ReadLightChunk (); break; case OBJ_CAMERA : #ifdef __DEBUG__ printf (\ OBJ_CAMERA); #endif tellertje+=ReadCameraChunk (); break; default: break; } tellertje+=2; if (tellertje=temp_pointer) end_found=TRUE; } ChangeChunkPointer (current_pointer+temp_pointer); // move to the new chunk position return (temp_pointer); } /*----------------------------------------------------------------------------*/ unsigned long ReadBackgrChunk (void) { unsigned char end_found=FALSE; unsigned int temp_int; unsigned long current_pointer; unsigned long temp_pointer;