Hi,

I am using the OpenFlightPlugin (osg 2.9.0, win32 XP, VS2005) . 

Today I experienced a crash when loading a flt-file with osg which was also 
written by osg. After some investigation I found out that the MultiSwitch was 
the problem. Somehow after writing to flt the Switch had more children than 
masks and even more than 32 what lead to the crash. 

See OpenFlight/PrimaryRecords.cpp, line 597ff:

Code:

virtual void addChild(osg::Node& child)
{
        if (_multiSwitch.valid())
        {
            unsigned int nChild = _multiSwitch->getNumChildren();
            for (unsigned int nMask=0; nMask<_numberOfMasks; ++nMask) 
            {
                // test if this child is active in the current mask (itMask)
                unsigned int nMaskBit = nChild % 32;
                unsigned int nMaskWord = nMask * _wordsInMask + nChild / 32;
                _multiSwitch->setValue(nMask, nChild, (_masks[nMaskWord] & 
(uint32(1) << nMaskBit))!=0 );
            }

            _multiSwitch->addChild(&child);
       }
}



For the child number 32 nMaskWord became 15, but _numberOfMasks was only 15...

Maybe the problem is, that the switch has a lot of lod children. If I write the 
file to osg the switch has only 15 childs, because the lod nodes are combined. 
(Instead of 3 lods with one child, 1 lod with 3 childs).

I can send an example flt file if anyone want to step into this further. (Which 
would be nice ;-) )


Thank you!

Cheers,
Katharina ;) [/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=27155#27155





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to