Loading multiple objects from single mesh

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
Markhor
Posts: 20
Joined: Thu Sep 02, 2010 2:09 pm

Loading multiple objects from single mesh

Post by Markhor »

Well, bad topic title, something probably been discussed before, but I'm looking for some ideas.
Now I did read, at least for shadows, that every "object"(think the word was "mesh") generates its own shadow. Ok.
Currently I just threw together a terrain map file in blender, an actual model of the testing grounds, and made a .obj file out of it.
Now I looked through some of the API and didn't find exactly what I was looking for, so I ask it. If i had say, 2 objects or 2 models, no child/parent relation, can I "find" the location of one? I put a box in there to act as a hardpoint, for spawning. As in its co-ords would become the spawn points' co-ords. I took this old habit from modding another game that had the engine, albeit old, load triangles for where the weapons would emit from.

So is this doable, if so with what file types, and what tutorial/functions should I be looking for?
Thanks. I know I'm hard to get along with at times.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Loading multiple objects from single mesh

Post by hybrid »

Having both objects stored in one mesh file is not a good idea. Since an object file (whether .obj format or any other doesn't matter here) will lead to exactly one IAnimatedMesh. This means that searching capabilities are limited, sometimes the extra objects are even merged into other mesh buffers and are barely "visible" (searchable) at all anymore. You should instead use a scene format. Best would be to set up the terrain in whatever format you like, and create a .irr scene which contains the mesh (including placement) and the extra spawn boxes (as dummy nodes, which are automatically invisible). Since you can give names to the scene nodes created from each object in a .irr file, it's easy to recover thos boxes and get their positions.
Markhor
Posts: 20
Joined: Thu Sep 02, 2010 2:09 pm

Re: Loading multiple objects from single mesh

Post by Markhor »

I see. Ok so my fear was true, but I'm glad I know.
Therefore, say I wanted to make a city, prebuilt. I'd need to load the terrain first, then each building individually? And from there I could simply call on it from the main loop? Makes sense, thanks hybrid.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Loading multiple objects from single mesh

Post by hybrid »

Well, using a scene format you have only one call to loadScene(). This loads all objects of the scene. It's more a question how you get your scene pre-built into a scene format that Irrlicht properly supports. Collada might be an option for many tools, the .irr format is supported by the Irrlicht editors developed by Ambiera (Niko)
Post Reply