Loading and Unloading Meshes

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
ceisnaugle

Loading and Unloading Meshes

Post by ceisnaugle »

I've been working on a viewer that allows me to look at various maps I am putting together in 3DS format. Had a couple questions about what to do when I want to unload a mesh and load a new one and swap out collinsion selectors.

- If I want to delete the current world mesh loaded, can I just mesh->drop()? or do I have to do other resource cleanup manually?

- Do I do the same on a collision selector that I have created, just drop it? At this point the assocaited pointer with the camera will not be valid so do I need to manually set that to null? Or can I just drop the first triangle collision selector and set a new one that I load?

basically Im wanting to load a map look at it test it, then unload it and load a new one all without exiting the application, so trying to undertsand all the cleanup or things I need to do, how to delete the mesh and materials, collision selectors and so forth so im working with a clean slate before loading the next world.

Thanks
Guest

Post by Guest »

1.) The mesh drop will work and no further cleanup is necissary

2.) Yes, almost, if not anything can be droped as long as it will no longer be referenced

3.)Yes drop drop drop

Irrlicht handles all of your clean up. Maybe I am wrong but I think so.

A quick trial do a loop that keeps adding and droping new nodes and watch your memory usage. Thats the easy way!
bappy
Posts: 63
Joined: Fri Dec 12, 2003 10:49 am
Location: france
Contact:

Post by bappy »

on my machine ,drop crash my app,
if you have the same problem
just use node->remove(); instead node->drop()
-----------------------------
Sans danger, pas de gloire...
http;//bappy.free.fr
-----------------------------
Miwa
Posts: 28
Joined: Wed Feb 18, 2004 10:48 pm

Post by Miwa »

How do you drop a mesh tho?

mesh->drop() doesn't really get rid of it (if you do a load on the same filename later, it returns the pointer to the free'd memory space). So you'll delete the memory for your mesh, but if you ever try to load one with same filename again, you're hosed.

the comment for ISceneManager::getMesh() says the returned pointer should never be dropped.

I don't see a way to get the filename out of the Meshes member of CSceneManager without deleting the scene manager.
Post Reply