[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

10/18/2005 at 01:04AM PDT, ID: 21598504
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

DirectX "X" binary file with c++

Asked by nutterx in Game Programming

Tags: binary, directx, token_template

Hiya fella's

I need a little help to get started in writing a parser for Directx Binary file(eof file). haha before you tell me to use  directx's builtin loader functions i aint using direct3d i am using OpenGL. I have seen code to parse text file version but i want to use the binary version. I should also add i don't expect anyone to write the whole lot i just need a little kickstart and i will figure the rest out. Another thing is i don't require any animation, just need to load a mesh and it's materials.

i can load in the header of the binary file.

//////////////////////////////////////////CODE////////////////////////////////////////////////////////////////

//from MSDN:
#define XOFFILE_FORMAT_MAGIC \
  ((long)'x' + ((long)'o' << 8) + ((long)'f' << 16) + ((long)' ' << 24))

#define XOFFILE_FORMAT_VERSION03 \
  ((long)'0' + ((long)'3' << 8)) //+ ((long)'0' << 16) + ((long)'2' << 24))

#define XOFFILE_FORMAT_BINARY \
  ((long)'b' + ((long)'i' << 8) + ((long)'n' << 16) + ((long)' ' << 24))

#define XOFFILE_FORMAT_TEXT   \
  ((long)'t' + ((long)'x' << 8) + ((long)'t' << 16) + ((long)' ' << 24))

#define XOFFILE_FORMAT_COMPRESSED \
  ((long)'c' + ((long)'m' << 8) + ((long)'p' << 16) + ((long)' ' << 24))

#define XOFFILE_FORMAT_FLOAT_BITS_32 \
  ((long)'0' + ((long)'0' << 8) + ((long)'3' << 16) + ((long)'2' << 24))

#define XOFFILE_FORMAT_FLOAT_BITS_64 \
  ((long)'0' + ((long)'0' << 8) + ((long)'6' << 16) + ((long)'4' << 24))

struct X_HEADER
{
unsigned long Magic;
unsigned short MajVersion;
unsigned short MinVersion;
unsigned long Format;
unsigned long Size;
};

ifstream myFile;

X_Header header;

.......................
void main()
{
myFile.open("test.x",ios::in| ios::binary);

myFile.read((char*)&header,sizeof(X_HEADER));
if(!ProcessHeader())
{
//error code
}

}

//check file header is correct binary file

bool ProcessHeader()
 {
      if (header.Magic != XOFFILE_FORMAT_MAGIC)
         {
      printf("Not a .X model file. Aborted...\n");
         return false;
    }

      if (header.Format != XOFFILE_FORMAT_BINARY)
      {
            printf("Not A Binary .x Model File. Aborted...\n");
      return false;
      }

      if (header.MajVersion != XOFFILE_FORMAT_VERSION03)
      {
            printf("Wrong File Version. Aborted...\n");
      return false;
      }

      if (header.MinVersion != XOFFILE_FORMAT_VERSION03)
      {
            printf("Wrong File Version. Aborted...\n");
      return false;
      }

      return true;
 }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

I just haven't got my head around all this token and template stuff that MSDN is talking and howto parse it properly.

so if someone could just get me started and show me how to load say just the first template...hopefully after i see how it is done i will understand it better and can than load the other stuff like the mesh and it's vertices etc etc

Thanks everyone
[+][-]10/24/05 12:17 PM, ID: 15149057

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/25/05 04:26 AM, ID: 15153352

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/31/05 11:50 AM, ID: 15195717

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Game Programming
Tags: binary, directx, token_template
Sign Up Now!
Solution Provided By: aqua9880
Participating Experts: 1
Solution Grade: B
 
 
[+][-]10/31/05 12:59 PM, ID: 15196299

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74