I did a quick search before posting this and didn't find anything that was specific to my question.
OK so I'm new to Irrlicht, new to c++ in fact.
My question is how would be best to load different models in to my scene? I currently have about five different 3D models loaded into my scene hovering above a terrain I created from the terrain tutorial. At the moment I'm using the method from tutorial 1 where you create a mesh then a node for the mesh, then an if statement for each node. So how would be best to do it? Also, how would I go about using the same model and loading it multiple times across the terrain (e.g a tree).
Thanks for everyones replies in advance
Tom
Best way to add multiple models [SOLVED]
Best way to add multiple models [SOLVED]
Last edited by TJBaldy on Mon Jan 09, 2012 2:27 pm, edited 1 time in total.
Re: Best way to add multiple models.
You can have multiple nodes working with the same mesh. So you need to load the mesh just once and then can use it all over the place. Maybe check this page on Wiki if you're new to this stuff: http://www.irrlicht3d.org/wiki/index.ph ... ommonTerms
For larger scenes you will no longer load each model one-by-one in code, but instead use some scene-format. You can for example use the .irr format which allows you to create scene in irrEdit which you can load then with a single command.
For larger scenes you will no longer load each model one-by-one in code, but instead use some scene-format. You can for example use the .irr format which allows you to create scene in irrEdit which you can load then with a single command.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Best way to add multiple models.
Well, sounds really like a basic programming question. You can refine all those steps into a function and call that function with the mesh file name, returning the scene node. This would save code duplication. Other possibility is to create a scene file somewhere and load a whole scene with one call. This is only applicable if you can create the scene file prior to all this of course.
Loading the same mesh multiple times does not create a significant overhead. Irrlicht has a mesh cache which avoid mesh duplication. You could be a little more efficient by storing the mesh pointer and adding scene nodes from that mesh multiple times. But since you don't call this method thousands of times it's ok to go first the first approach.
Ahh, CuteAlien was faster, but I'll still post my text...
Loading the same mesh multiple times does not create a significant overhead. Irrlicht has a mesh cache which avoid mesh duplication. You could be a little more efficient by storing the mesh pointer and adding scene nodes from that mesh multiple times. But since you don't call this method thousands of times it's ok to go first the first approach.
Ahh, CuteAlien was faster, but I'll still post my text...
Re: Best way to add multiple models.
Thanks for the replies guys. I've managed to work out how to add multiple objects of the same item by playing around with the code. I added three tree objects using the same mesh . My project is part of a University Degree and the course is about using a game engine so unfortunately I can't just go and create a scene using some software and then load it up with code.
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Re: Best way to add multiple models.
Irrlicht is NOT a game engine, it's a 3D engine. There's a huge difference.the course is about using a game engine so unfortunately I can't just go and create a scene using some software and then load it up with code.
And you can compose your scene with irrEdit and load it in Irrlicht easily.
"Whoops..."
-
- Posts: 56
- Joined: Wed Nov 23, 2011 11:53 pm
Re: Best way to add multiple models.
It's not hard to make into a game engine. You just need to write all that code yourself Irrlicht is pretty simple to work with and has some nice wrappers and data structures, one I am particularly in love with ATM is array<T> <3
Re: Best way to add multiple models.
Yeh I meant 3D engine... Thanks again for everyone's help