Unloading a 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
brcolow

Unloading a mesh?

Post by brcolow »

If I load a model like so:

Code: Select all

scene::IAnimatedMesh* weaponMesh = smgr->getMesh("models/weapon.obj"); 

scene::IAnimatedMeshSceneNode* weaponNode = smgr->addAnimatedMeshSceneNode( weaponMesh, camera, 0, irr::core::vector3df(40.0f, -40.0f, 40.0f), irr::core::vector3df(0.0f, 0.0f, 30.0f) );

weaponNode->setMaterialTexture( 0, driver->getTexture("textures/texture.jpg") );
How can I "unload" the model, to free resources?

Thanks!
brcolow

Post by brcolow »

Sorry for the double post...

Can I just use..

drop->weaponMesh ? ..or drop->weaponNode
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

Looking into documentation is a nice habit. You should try it.
To remove node:
http://irrlicht.sourceforge.net/docu/cl ... e.html#a18

To remove mesh:
When all node using this mesh will be removed mesh also should be removed unless there are other pointers pointing to it.

You can also remove things using drop() but it's unsafe because you can end for example with some nodes using freshly deleted mesh :twisted:
To learn more about drop() use documentation:
http://irrlicht.sourceforge.net/docu/cl ... wn.html#a3
Tomasz Nowakowski
Openoko - www.openoko.pl
Post Reply