www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: jtxx000 on September 24, 2003, 11:54:19 pm

Title: 3ds Loading
Post by: jtxx000 on September 24, 2003, 11:54:19 pm
What's the best way to load and texture a 3ds file?
Title: 3ds Loading
Post by: EgonOlsen on September 25, 2003, 09:15:50 pm
The 3ds-loader will return you an array of Object3Ds. Just iterate through them like so:
Code: [Select]
 
      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.
Title: 3ds Loading
Post by: jtxx000 on September 28, 2003, 02:46:13 pm
What 3D program do you use to do your 3D models.
Title: 3ds Loading
Post by: EgonOlsen on September 29, 2003, 06:43:05 pm
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: