Author Topic: 3ds Loading  (Read 3584 times)

Offline jtxx000

  • byte
  • *
  • Posts: 13
    • View Profile
3ds Loading
« on: September 24, 2003, 11:54:19 pm »
What's the best way to load and texture a 3ds file?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
3ds Loading
« Reply #1 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.

Offline jtxx000

  • byte
  • *
  • Posts: 13
    • View Profile
3ds Loading
« Reply #2 on: September 28, 2003, 02:46:13 pm »
What 3D program do you use to do your 3D models.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
3ds Loading
« Reply #3 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: