Hello,

the OpenFlight-Plugin prevents reacting on missing Textures via a 
ReadFileCallback, because osgDB::readRefImageFile (called by function 
readTexture) is not called if the file does not exist. Would be great if this 
could be changed.

A fix could look like this (file PaletteRecords.cpp, line 436):

Code:

    virtual void readRecord(RecordInputStream& in, Document& document)
    {
        if (document.getTexturePoolParent())
            // Using parent's texture pool -- ignore this record.
            return;

        int maxLength = (document.version() < VERSION_14) ? 80 : 200;
        std::string filename = in.readString(maxLength);
        int32 index = in.readInt32(-1);
        /*int32 x =*/ in.readInt32();
        /*int32 y =*/ in.readInt32();

        osg::StateSet* stateset = NULL;
        // Need full path for unique key in local texture cache.
        std::string pathname = 
osgDB::findDataFile(filename,document.getOptions());
        if (pathname.empty())
        {
            // allow the aplication to react on missing texture via 
ReadFileCallback
            stateset = readTexture(filename,document);
            if( !stateset) 
            {
                osg::notify(osg::WARN) << "Can't find texture (" << index << ") 
" << filename << std::endl;
                return;
            }
        }
        else
        {
            // Is texture in local cache?
            osg::StateSet* stateset = 
flt::Registry::instance()->getTextureFromLocalCache(pathname);
        }

        // Read file if not in cache.
        if (!stateset)
        {
            stateset = readTexture(pathname,document);

            // Add to texture cache.
            
flt::Registry::instance()->addTextureToLocalCache(pathname,stateset);
        }

        // Add to texture pool.
        TexturePool* tp = document.getOrCreateTexturePool();
        (*tp)[index] = stateset;
    }




Thank you!

Greetings,
Katharina[/code]

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





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

Reply via email to