Unload/ remove 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
MeisterK
Posts: 66
Joined: Sat Feb 26, 2005 1:20 pm

Unload/ remove mesh

Post by MeisterK »

Maybe I'm blind, but I cant find a way to unload or remove a mesh :_(

Why? I need to call ISceneManager::addHillPlaneMesh("MESHNAME",...) more than onces. But the 2nd call failed because a mesh with this name allready exists. I dont want to use different names.

Thx
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Well, I think the name is like an ID (idendifier) and in this case you can't use the same name for more than one mesh (node) !!!
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Guest

Post by Guest »

isnt there a mesh->drop(); ? if there is no such command, you could try a mesh->setVisible(false); , that would atleast make it invisible (and invisible it takes no performance, or does irrlicht dont sort this out?)
MeisterK
Posts: 66
Joined: Sat Feb 26, 2005 1:20 pm

Post by MeisterK »

Right, the name is used as an ID.

I guess calling mesh->drop(); would produce a nice error later because I didn't create the mesh with a 'createXXX' function and I changed the reference counter by this call.

Invisible nodes are not taking rendering performance but they are still in memory (ok, maybe not that much memory) and the name/ID is still engaged.

Since other addSceneNode functions (like addTerrainMesh) have the same problem I suggest to add a "remove-a-mesh" feature. But this might be impossible/difficult since you need to keep track which node relies on which mesh, don't you?
aigam
Posts: 17
Joined: Fri May 06, 2005 3:17 pm

Post by aigam »

you can make a grab() first, not?
MeisterK
Posts: 66
Joined: Sat Feb 26, 2005 1:20 pm

Post by MeisterK »

I could- but why? As far as I know is grab/ drop only for keeping track how many other objects using this particular object (it is just a counter)
It does nothing for disposing the object from Irrlicht.
aigam
Posts: 17
Joined: Fri May 06, 2005 3:17 pm

Post by aigam »

mmmmmmm, the problem is with the "core::array<MeshEntry> Meshes;" array in SCne, that stores the names of the meshes.

the mesh is succeful destroyed with the drop() command:
smgr->getMesh("MESHNAME")->drop();

But the array of names mantain the mesh... the array is private and there is no function that eliminates a name already registered... It's a bug.. the drop() command must destroy also the name of the mesh
SARIN
Posts: 139
Joined: Fri Oct 29, 2004 3:53 am

Post by SARIN »

i think u can drop the mesh with drop, yeh.
but u might want to remove the scene node with ISceneNode->remove(), then ISceneNode->drop().
Post Reply