is there a need for modell storage?

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
RenoRosco
Posts: 11
Joined: Sat Sep 15, 2007 7:26 am

is there a need for modell storage?

Post by RenoRosco »

Hi,

after i have worked through the tutorials and did some basic classes i want to do my first small game. While planning it i was curiose about the storage of the modells.

Does irrlicht load a Mesh 2+ times or does it recordnice that he has load this mesh former and just copy it from the first modell/mesh.

If not i will write a repository for the modells but if irrlicht manage that itself it would be some useless work.

sry for my english
CuteAlien
Admin
Posts: 9735
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

All loaded meshes are put in irr::scene::IMeshCache. If you try to load them again they are taken from there.

So no need to do that yourself :-)
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
RenoRosco
Posts: 11
Joined: Sat Sep 15, 2007 7:26 am

Post by RenoRosco »

Thx for your fast reply.

Just a additional basic question?

I load a Modell and alter the Mesh. Now i Load the same File again. Is it the altered Mesh or complete new and loaded from file?
Or does the CMeshCache class holds the data independent from the nodes. So 1 copy for the CMeshCache class and one copy for each modell with the mesh.
CuteAlien
Admin
Posts: 9735
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I think it's like that:

The mesh is only identified by it's filename. So when you try to load a file again and there's a mesh with the same filename in the cache, then the cached mesh is used. If you don't want that behavior you can remove meshes from the cache.

And the nodes should directly use the meshes. At least the MeshSceneNode seems to to so. Can't guarantee it for the other nodetypes, I would have to check them, but I think this is the usual way. But it also shouldn't be that hard to implement a custom scenenode which would keep or create it's own copies of meshes.
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
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You can clone a mesh via the meshManipulator class. That will create a new copy which is independent of the old one. But yes, otherwise loading would not recover the original mesh, but also return the altered one.
RenoRosco
Posts: 11
Joined: Sat Sep 15, 2007 7:26 am

Post by RenoRosco »

Thx for your replies

thats enough answers to start my first project.

Hope to get something to show soon.
Post Reply