parsing milkshape files

hi

i was wondering if anyone could tell me how to parse milkshape files. I do not how to read the chunks like }ÄHÀ³Q±½"VD@½7 · ðÀ7`PEAto make them usefull. I want to do this using fstream.h and ifstreams.  have attached an example file
Model.txt
LVL 1
sassekAsked:
Who is Participating?
 
js-profiCommented:
It is ms3d file format specified at http://chumbalum.swissquake.ch/ms3d/ms3dspec.txt

Use #include  and not fstream.h which is deprecated.

Goto project settings C++ code generation and switch alignment to 1-byte packed.

Open file with

    std::ifstream ms("model.dat", ios_base::binary | ios_base::in);

Then read first header

   ms3d_header_t msh;
   ms.read((char*)&msh, sizeof(msh));
 
Then number of vertices

  unsigned short numV;
  ms.read((char*)&numV, 2);

For each vertex read into vertext struct
    std::vector v;  
   for (unsigned short n = 0; n < numV; ++n)
   {
       v.push_back(ms3d_vertex_t);
       ms.read((char*)&v.back(), sizeof(ms3d_vertex_t));
   }

Then do similar with triangles, groups, joints, materials, ...
0
 
johnnash1180Commented:
The milkshape files should be in binary format. Go through the following urls to get the details of that file format.

http://en.wikipedia.org/wiki/MilkShape_3D#MilkShape_3D_file_format
http://local.wasp.uwa.edu.au/~pbourke/dataformats/ms3d/

You can use the http://local.wasp.uwa.edu.au/~pbourke/dataformats/ms3d/ms3dspec.h header file to get structure of that ms3d file format details.

John Nash
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.