instead of osgDB::Registry where it original lay. This has been done to allow fileName strings to be encode data rather than just file names, such as one requires when using PagedLOD along with plugins for doing dynamic tesselation.
44 lines
950 B
C++
44 lines
950 B
C++
#include "ReaderWriterTXP.h"
|
|
#include <osg/Group>
|
|
#include <osg/Object>
|
|
#include <osg/Node>
|
|
#include <osg/Notify>
|
|
|
|
#include <osgDB/Registry>
|
|
#include <osgDB/FileUtils>
|
|
|
|
#include <iostream>
|
|
|
|
#include "TrPageArchive.h"
|
|
|
|
#include "TerrapageNode.h"
|
|
|
|
using namespace txp;
|
|
using namespace osg;
|
|
|
|
osgDB::ReaderWriter::ReadResult ReaderWriterTXP::readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options)
|
|
{
|
|
if( !acceptsExtension(osgDB::getFileExtension(fileName) ))
|
|
return ReadResult::FILE_NOT_HANDLED;
|
|
|
|
osg::ref_ptr<txp::TerrapageNode> pager = new TerrapageNode;
|
|
|
|
pager->setDatabaseName(fileName);
|
|
|
|
if (options)
|
|
{
|
|
pager->setDatabaseOptions(options->getOptionString());
|
|
}
|
|
|
|
if (pager->loadDatabase())
|
|
{
|
|
return pager.get();
|
|
}
|
|
else
|
|
return ReadResult::ERROR_IN_READING_FILE;
|
|
|
|
}
|
|
|
|
osgDB::RegisterReaderWriterProxy<ReaderWriterTXP> g_txpReaderWriterProxy;
|
|
|