Page 1 of 1

Unload/ remove mesh

Posted: Tue May 10, 2005 9:47 pm
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

Posted: Tue May 10, 2005 10:16 pm
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) !!!

Posted: Wed May 11, 2005 6:56 am
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?)

Posted: Wed May 11, 2005 10:08 am
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?

Posted: Wed May 11, 2005 1:41 pm
by aigam
you can make a grab() first, not?

Posted: Wed May 11, 2005 1:55 pm
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.

Posted: Thu May 12, 2005 7:58 am
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

Posted: Fri May 13, 2005 4:45 am
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().