Main Menu

3ds Loading

Started by jtxx000, September 24, 2003, 11:54:19 PM

Previous topic - Next topic

jtxx000

What's the best way to load and texture a 3ds file?

EgonOlsen

The 3ds-loader will return you an array of Object3Ds. Just iterate through them like so:
 
     Object3D[] levelParts=Loader.load3DS("3ds/ql.3ds", 10f);

     for (int i=0; i<levelParts.length; i++) {
        Object3D part=levelParts[i];

        // You may do some other stuff to "part" here (build an octree for it...whatever).

        theWorld.addObject(part);
     }

     ...theWorld.buildAllObjects();


The loader will ask the TextureManager for textures that are named like the textures in the 3DS-material list. For example "hurgel.jpg" if a material uses this texture. If no texture named "hurgel.jpg" can be found in the TextureManager, a new one is created (bright white). You may replace it on your own after loading the object or (and that's the way prefer it) you load them before loading the 3ds-object, because that way, the TextureManager already has them and there's no need to create these replacement textures instead.
The new example i'm working on will include a sample of how to do it. 0.94 (to be released within hours...) will support merging too, so that you may merge all your "part"s to one Object3D...can be helpfull sometimes...
Hope this helps.

Edit: 0.94 is out. It includes the "fps"-example that loads 3ds.

jtxx000

What 3D program do you use to do your 3D models.

EgonOlsen

Quote from: "jtxx000"What 3D program do you use to do your 3D models.
Actually none at all. I'm using freeware models to test the engine. I'm not writing a game with jPCT ATM, so i don't need to model my own stuff. Some years ago, i've used a version of 3D Studio (version 4 i believe) to make some models, but i wasn't very good at it... :wink: