---------*/
unsigned long ReadLightChunk (void) {
unsigned char end_found=FALSE,boolean; unsigned int temp_int;
unsigned long current_pointer; unsigned long temp_pointer;
unsigned long tellertje=6L; // 2 id + 4 pointer float light_coors [3];
current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer ();
fread (&(light_coors [0]),sizeof (float),1,bin3ds); fread (&(light_coors [1]),sizeof (float),1,bin3ds); fread (&(light_coors [2]),sizeof (float),1,bin3ds);
#ifdef __DEBUG__
printf (\light at coordinates: X: %5.2f, Y: %5.2f,Z: %5.2f\\n\ light_coors [0], light_coors [1], light_coors [2]); #endif
while (end_found==FALSE) {
temp_int=ReadInt ();
switch (temp_int) {
case LIT_UNKNWN01 :
#ifdef __DEBUG__
printf (\of %0X\\n\ #endif
tellertje+=ReadUnknownChunk (LIT_UNKNWN01); break; case LIT_OFF :
#ifdef __DEBUG__
printf (\chunk: %0X\\n\ #endif
tellertje+=ReadBooleanChunk (&boolean); #ifdef __DEBUG__
if (boolean==TRUE)
printf (\ else
printf (\ #endif break; case LIT_SPOT :
#ifdef __DEBUG__ printf (\SpotLight: %0X\\n\ #endif
tellertje+=ReadSpotChunk (); break; case COL_RGB :
#ifdef __DEBUG__
printf (\of %0X\\n\
#endif
tellertje+=ReadRGBColor (); break; case COL_TRU :
#ifdef __DEBUG__
printf (\of %0X\\n\
#endif
tellertje+=ReadTrueColor (); 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 ReadCameraChunk (void) {
unsigned long current_pointer;
unsigned long temp_pointer; float camera_eye [3]; float camera_focus [3]; float rotation,lens;
current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer ();
fread (&(camera_eye [0]),sizeof (float),1,bin3ds); fread (&(camera_eye [1]),sizeof (float),1,bin3ds); fread (&(camera_eye [2]),sizeof (float),1,bin3ds);
#ifdef __DEBUG__
printf (\Y: %5.2f,Z: %5.2f\\n\ camera_eye [0], camera_eye [1], camera_eye [2]); #endif
fread (&(camera_focus [0]),sizeof (float),1,bin3ds); fread (&(camera_focus [1]),sizeof (float),1,bin3ds); fread (&(camera_focus [2]),sizeof (float),1,bin3ds);
#ifdef __DEBUG__
printf (\Y: %5.2f,Z: %5.2f\\n\ camera_focus [0], camera_focus [1], camera_focus [2]); #endif
fread (&rotation,sizeof (float),1,bin3ds); fread (&lens,sizeof (float),1,bin3ds); #ifdef __DEBUG__
printf (\ printf (\ #endif
if ((temp_pointer-38)0) // this means more chunks are to follow {
#ifdef __DEBUG__
printf (\ #endif
if (ReadInt ()==CAM_UNKNWN01) {
#ifdef __DEBUG__
printf (\ #endif
ReadUnknownChunk (CAM_UNKNWN01); }
if (ReadInt ()==CAM_UNKNWN02) {
#ifdef __DEBUG__
printf (\ #endif
ReadUnknownChunk (CAM_UNKNWN02); } }
ChangeChunkPointer (current_pointer+temp_pointer); // move to the new chunk position return (temp_pointer); }
/*----------------------------------------------------------------------------*/
unsigned long ReadVerticesChunk (void) {
unsigned long current_pointer; unsigned long temp_pointer; float vertices [3]; // x,y,z unsigned int numb_v;
current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer (); numb_vertices =ReadInt ();
#ifdef __DEBUG__
printf (\ #endif
for (int i=0;i fread (&(vertices [0]),sizeof (float),1,bin3ds); fread (&(vertices [1]),sizeof (float),1,bin3ds); fread (&(vertices [2]),sizeof (float),1,bin3ds); #ifdef __DEBUG__ printf (\ i, vertices [0], vertices [1], vertices [2]); #endif } ChangeChunkPointer (current_pointer+temp_pointer); // move to the new chunk position return (temp_pointer); } /*----------------------------------------------------------------------------*/ unsigned long ReadSmoothingChunk () { unsigned long current_pointer; unsigned long temp_pointer; unsigned long smoothing; current_pointer=GetChunkPointer (); temp_pointer =ReadChunkPointer (); for (int i=0;i smoothing=ReadLong(); smoothing=smoothing; // compiler warnig depressor *:) #ifdef __DEBUG__ printf (\smoothing group for face []] is %d\\n\ #endif } ChangeChunkPointer (current_pointer+temp_pointer); // move to the new chunk position return (temp_pointer); } /*----------------------------------------------------------------------------*/ unsigned long ReadFacesChunk (void) { unsigned long current_pointer; unsigned long temp_pointer; unsigned int temp_diff; unsigned int faces [6]; // a,b,c,Diff (Diff= AB: BC: CA: )