Loading a .3ds static mesh as node??

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
powerpop
Posts: 171
Joined: Thu Jan 08, 2004 1:39 am
Location: san francisco

Loading a .3ds static mesh as node??

Post by powerpop »

well, i am finally attempting some coding with IRR - i have the basics up and running BUT i have a newbie problem - i want to load a .3ds model that is static - i have not found in the examples or documents how to load this model - the only examples are loading the testmodel or an md2/3 or a quake bsp level - i cannot find an example of how to load a 3ds model into a node???

i tried:
node = smgr->addMeshSceneNode(smgr->getMesh("media/full.3ds"));

but since getMesh sends back an animated mesh it chokes - so how do i load a static 3ds mesh and pass it to addMeshSceneNode??

oh, and on the todo list - it would be great to have an example that did NOT load a quake level - instead it set up a plane under the player and placed a couple objects around - if someone tells me how to make a ground plane in IRR i will gladly write this example using some of my .3ds objects!

thanks!
powerpop
Posts: 171
Joined: Thu Jan 08, 2004 1:39 am
Location: san francisco

Post by powerpop »

i tried to load this as an animated mesh just for the hell of it (so i could go test other things) - i think it would work but i found out that the 3ds loader only loads version 3 or less of the 3ds format - and i guess my objects are saved in a more recent version :(

node = smgr->addAnimatedMeshSceneNode(smgr->getMesh("media/full.3ds"));

well, what format objects should i stick with for my static objects - .x ? - i see that niko has made a .x loader - will it load static meshes? - if i grab the 4.2 update will i get the .x loader with it? and if not .x what other format will be around for the long haul?

thanks for any replies and help!
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

You can create a static mesh from an animated mesh, by simply getting its first frame. For example: smgr->getMesh("media/full.3ds")->getMesh(0).

The .x file loader will be available first in version 0.5, but it will support static meshes, yes.

And you can find an example of how to load a static mesh from a .3ds file in the special effects example.

Hope it helps.
powerpop
Posts: 171
Joined: Thu Jan 08, 2004 1:39 am
Location: san francisco

Post by powerpop »

what happens to the rest animated mesh that gets loaded by the smgr? (since i will only be referencing the first frame of it - will it get unloaded correctly?) - actually, i cant even ask that correctly since i dont know how IRR gets rid of nodes ...

if my call is:
node = smgr->addMeshSceneNode(smgr->getMesh("media/full.obj")->getMesh(0));

* now i am using maya object instead of a .3ds

so if my call is as above what happens to the animated mesh that the smgr loads - since i am only adding the first frame of it? who handles getting rid of the animated mesh structure?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Don't worry about that, the scene manager does this all for you, because it creates the meshes. The only time you have to worry about deleting objects is when you create..() one.

And in case of .obj files: There is no animation at all in them, they only consist of one frame.
Post Reply