Issues with Mesh Loader in a game

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
L o
Posts: 44
Joined: Sun Mar 29, 2009 2:53 pm

Issues with Mesh Loader in a game

Post by L o »

Hey,

I tried to put my own level loader (it is named "ODFL loader") into one of a game a friend of mine wrote. Usually, ODFL loader loads the level with simple irrlicht test programs I wrote. However, with this game, it failed with a memory bug:

Code: Select all

==16830==    by 0x430A980: irr::scene::CAnimatedMeshSceneNode::setJointMode(irr::scene::E_JOINT_UPDATE_ON_RENDER) (CAnimatedMeshSceneNode.cpp:892)
The reason is pretty clear: it fails in this line:

Code: Select all

scene::IAnimatedMesh *level = smgr->getMesh("testlevel.odfl");
nodeList.push_back(smgr->addAnimatedMeshSceneNode(level)); // <- HERE 
My friend was adding an animated mesh, I never did that when I used ODFL loader. I loaded it like this, instead:

Code: Select all

scene::IAnimatedMesh* level = smgr->getMesh("testlevel.odfl");
odflnode = smgr->addOctTreeSceneNode(level->getMesh(0));
"Google"ing tells me that I'll need to provide "joints" for irrlicht. Is this the reason for that segfault? What can I do to fix it?

Thank you a lot for any help!
- Johannes
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

It seems to be more of a badly programmed loader. I guess that it does not use a skinned mesh internally, but sets the mesh type wrongly. This would cause an illegal access somewhere in the render methods. I fear you have to fix the loader to make this more fail safe.
L o
Posts: 44
Joined: Sun Mar 29, 2009 2:53 pm

Post by L o »

Hey,

to be honest, it was me who wrote the loader. :lol:

I remember trying to use the loader in that game my friend wrote. But loading failed with an assertion saying that the mesh needed to have a type of EAMT_SKINNED. So I replaced (in the loader)

Code: Select all

animatedmesh = new SAnimatedMesh();
with

Code: Select all

animatedmesh = new irr::scene::CSkinnedMesh();
This passed the assertion then, but caused the segfault :( Is there a possibility to help the loader get working in that game?

Greetings,
Johannes
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Since your format does not seem to have a skeleton animation, you're not supposed to use EAMT_SKINNED_MESH or CSkinnedMesh. You should create an SMesh, fill the structures as intended, put that one mesh into a newly created SAnimatedMesh and return that one in turn. Just set the type no EAMT_UNKNOWN or EAMT_3DS (or some other non-animated format). Check the other static mesh loaders how the final few code lines should look like.
Post Reply