Irrlicht-1.5: setMesh

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Irrlicht-1.5: setMesh

Post by sudi »

Ok in my game i'm using a tilebased map and in the editor i can change a tile by simply clicking on it. Then the mesh is changed using the setMesh command of IAnimatedMeshSceneNode. Well unfortunatly this is not working in 1.5 anymore. Either the mesh is not chaged at all or irrlicht crashes.
And now the funny part. Before the scenenode is rendered the first time i can change the mesh as often as i want without any problems. And when the app crashes it crashes with a assert error on irr::core::array it tells that the index accesed is to big. Btw this crash appears in ISceneManager::drawAll during the rendering of the registered scenenodes. The crash must be in one of the render functions of the scenenodes, probably in the one that changed the mesh. But i can't find the error.

Ok here is some code which reproduces the bug:
Edit: press a,s,d to change the mesh of last mesh

Code: Select all

#include <irrlicht.h>
using namespace irr;
class Events : public irr::IEventReceiver
{
public:
    Events(irr::scene::IAnimatedMeshSceneNode* node, irr::scene::ISceneManager* mm)
    {
        Node = node;
        smgr = mm;
    }
    bool OnEvent(const irr::SEvent& event)
    {
        if (event.EventType == irr::EET_KEY_INPUT_EVENT && event.KeyInput.Key == irr::KEY_KEY_A)
            Node->setMesh(smgr->getMesh("show/Naruto.obj"));
        else if (event.EventType == irr::EET_KEY_INPUT_EVENT && event.KeyInput.Key == irr::KEY_KEY_S)
            Node->setMesh(smgr->getMesh("show/Space.obj"));
        else if (event.EventType == irr::EET_KEY_INPUT_EVENT && event.KeyInput.Key == irr::KEY_KEY_D)
            Node->setMesh(smgr->getMesh("show/Tyke.obj"));
        Node->setMaterialFlag(irr::video::EMF_LIGHTING, false);
        return false;
    }
    irr::scene::IAnimatedMeshSceneNode* Node;
    irr::scene::ISceneManager* smgr;
};
 int main()
 {
        // start up the engine
        IrrlichtDevice *device = createDevice(video::EDT_OPENGL,
                core::dimension2d<s32>(640,480));

        video::IVideoDriver* driver = device->getVideoDriver();
        scene::ISceneManager* scenemgr = device->getSceneManager();

        device->setWindowCaption(L"Hello World!");


        // load and show quake2 .md2 model
        scene::IAnimatedMeshSceneNode* node = scenemgr->addAnimatedMeshSceneNode(
                scenemgr->getMesh("show/Naruto.3ds"));
        node->setMaterialFlag(irr::video::EMF_LIGHTING, false);

        node = scenemgr->addAnimatedMeshSceneNode(
                scenemgr->getMesh("show/Space.3ds"), NULL, -1, core::vector3df(50,0,0));
        node->setMaterialFlag(irr::video::EMF_LIGHTING, false);

        node = scenemgr->addAnimatedMeshSceneNode(
                scenemgr->getMesh("show/Tyke.3ds"), NULL, -1, core::vector3df(100,0,0));
        node->setMaterialFlag(irr::video::EMF_LIGHTING, false);

        Events* events = new Events(node, scenemgr);



        device->setEventReceiver(events);

        // add a first person shooter style user controlled camera
        scenemgr->addCameraSceneNodeFPS();

        // draw everything
        while(device->run() && driver)
        {
                driver->beginScene(true, true, video::SColor(255,0,0,255));
                scenemgr->drawAll();
                driver->endScene();
        }

        // delete device
        device->drop();
        return 0;
 }
The needed media files are here:
Download
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

sry to bump this but hey thats a bug report with guidiance on how to reproduce it. No ideas at all???
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, money transfer still on its way, I guess. At least I didn't get any. Or where did you get the impression that you're being served immediately?
Anyway, I don't see any debuger output, so I guess you didn't really track the error.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Well i thought i trasfered the money yesterday....well i guess it takes some time.

Anyway the debugger is not stating anything...thats the problem. I compiled all code with debugging symbols(also irrlicht) but the debugger is still not showing anything. Thats the problem. Only thing i can say is that the error must be in the render() method of the scenenode that switched the mesh.

Debugger output:

Code: Select all

Building to ensure sources are up-to-date
Build succeeded
Selecting target: 
Debug
Adding source dir: D:\Programmieren\Projects\ObjectEditor\
Adding source dir: D:\Programmieren\Projects\ObjectEditor\
Changing directory to: bin
Adding file: bin\Debug\ObjectEditor.exe
Starting debugger: 
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.8
Child process PID: 5628
At D:/Programmieren/Libs/irrlicht-1.5/include/IQ3Shader.h:21
Continuing...
Program exited with code 03.
Debugger finished with status 0
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Thanks for the report. This was a problem with animated mesh scene nodes holding on to the last calculated frame of their meshes. I've fixed it on the trunk in SVN 1963 and 1.5.X in 1964.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

thx
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Post Reply