Files
OpenSceneGraph/src/osgPlugins/flt/ReaderWriterFLT.cpp
Robert Osfield 6bb8002116 Added in guard to png loader so that it only accepts png files. This has been
added since the png loader itself doesn't not seem robust enough at detecting
non png files.

Added a tab in to the flt code to make it more obvious what is happening in
the flow of the code.
2002-11-04 08:40:51 +00:00

39 lines
962 B
C++

// ReaderWriterFLT.cpp
#if defined(_MSC_VER)
#pragma warning( disable : 4786 )
#endif
#include "ReaderWriterFLT.h"
#include "FltFile.h"
#include <osg/Object>
#include <osg/Node>
#include <osgDB/Registry>
using namespace flt;
osgDB::ReaderWriter::ReadResult ReaderWriterFLT::readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* opt)
{
return readNode(fileName,opt);
}
osgDB::ReaderWriter::ReadResult ReaderWriterFLT::readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*)
{
if( !acceptsExtension(osgDB::getFileExtension(fileName) ))
return ReadResult::FILE_NOT_HANDLED;
osg::ref_ptr<FltFile> read = new FltFile;
osg::Node* node = read.get()->readNode(fileName);
if (node) return node;
else return ReadResult::FILE_NOT_HANDLED;
}
// now register with Registry to instantiate the above
// reader/writer.
osgDB::RegisterReaderWriterProxy<ReaderWriterFLT> g_fltReaderWriterProxy;