Archived

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

ldquyet

How to load 3D Max/3DS file

Recommended Posts

I am a beginer of game programming. I want to write a 3d game engine myself. I see 3D max is a very good to for designing a scenes/characters. but How can i load this kind of format file in DirectX. Can any specialist help me this? Thanks alot! Quyet Le

Share this post


Link to post
Share on other sites
I can't tell you how to write your own 3DS loader, sorry. But I would suggest using lib3ds, it's a free library for loading 3DS files. You can use its functions and structures to load the mesh (or any other data you need) from a 3DS file and then convert it to your own format. It's quite easy, e.g.:
  
// load file

Lib3dsFile * File3DS = lib3ds_file_load("mymodel.3ds");
// get number of vertices in file

int numVertices = File3DS->meshes->points;
// get xyz coordinates of first vertex from file

File3DS->meshes->pointL[0].pos[0]; // x

File3DS->meshes->pointL[0].pos[1]; // y

File3DS->meshes->pointL[0].pos[2]; // z

// ...and so on



Edited by - baumep on February 1, 2002 2:22:42 AM

Share this post


Link to post
Share on other sites