44 lines
947 B
C++
44 lines
947 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;
|
|
|