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.
This commit is contained in:
Robert Osfield
2002-11-04 08:40:51 +00:00
parent 268e83c354
commit 6bb8002116
2 changed files with 7 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterFLT::readObject(const std::string& f
osgDB::ReaderWriter::ReadResult ReaderWriterFLT::readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*)
{
if( !acceptsExtension(osgDB::getFileExtension(fileName) ))
return ReadResult::FILE_NOT_HANDLED;
return ReadResult::FILE_NOT_HANDLED;
osg::ref_ptr<FltFile> read = new FltFile;

View File

@@ -1,9 +1,10 @@
#include <osg/Image>
#include "osg/Notify"
#include <osg/Geode>
#include "osg/GL"
#include <osg/GL>
#include "osgDB/Registry"
#include <osgDB/Registry>
#include <osgDB/FileNameUtils>
using namespace osg;
@@ -35,6 +36,9 @@ class ReaderWriterPNG : public osgDB::ReaderWriter
virtual ReadResult readImage(const std::string& fileName, const osgDB::ReaderWriter::Options*)
{
if( !acceptsExtension(osgDB::getFileExtension(fileName) ))
return ReadResult::FILE_NOT_HANDLED;
int trans = PNG_ALPHA;
FILE *fp = NULL;
pngInfo pInfo;