Archived

This topic is now archived and is closed to further replies.

JoeZ

Reading 3ds file Autodisk version 0.93

Recommended Posts

Hi: I have a question regarding the Autodesk 0.93 1997 code for reading 3ds files. I think there is something wrong the the following code ReadLong(). temp1 reads in two bytes temp2 reads in two bytes then it returns temp3 and temp4 but there is nothing in temp3 and temp4. unsigned long ReadLong (void) { unsigned long temp1,temp2; unsigned long temp3,temp4; temp1=ReadInt (); temp2=ReadInt (); return (temp3+(temp4*0x10000L)); } Am I right? unsigned char ReadChar (void) { return (fgetc (bin3ds)); } unsigned int ReadInt (void) { unsigned int temp = ReadChar(); return ( temp | (ReadChar () << 8)); } Thanks. [edited by - JoeZ on April 28, 2003 5:34:55 PM]

Share this post


Link to post
Share on other sites
Perhaps someone can correct me if I''m wrong, but it looks like that code is written for a big endian machine, where the PC is a little endian machine.

When I was trying to write a 3ds loader, I noticed that I didn''t need to swap the bytes around to read an int, but one of the documents on the 3ds format said I did have to. I can only assume the document was written with big-endian in mind.

Share this post


Link to post
Share on other sites