#include <iostream>
#include <osgViewer/Viewer>
#include <osg/Node>
#include <osg/Geode>
#include <osg/Group>
#include <osg/PagedLOD>
#include <osg/PositionAttitudeTransform>
#include <osg/MatrixTransform>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgGA/TrackballManipulator>
#include <osgUtil/Optimizer>
using namespace std;
osg::ref_ptr<osg::Group> createPagedLOD()
{
osg::ref_ptr<osg::PagedLOD> page = new osg::PagedLOD();
page->setCenter(osg::Vec3(0.0f, 0.0f, 0.0f));
page->setFileName(0, "/home/zhaogang/work/thirdparty/OpenSceneGraph-3.2.1/data/cow.osg");
page->setRange(0, 0.0f, 50.0f);
page->setFileName(1, "/home/zhaogang/work/thirdparty/OpenSceneGraph-3.2.1/data/glider.osg");
page->setRange(1, 50.0f, 100.0f);
page->setFileName(2, "/home/zhaogang/work/thirdparty/OpenSceneGraph-3.2.1/data/cessna.osg");
page->setRange(2, 100.0f ,200.0f);
return page.get();
}
int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer();
osg::ref_ptr<osg::Group> root = new osg::Group();
osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform();
mt->addChild(createPagedLOD());
osg::Matrix m;
m.makeRotate(60.0f, 0.0f, 0.0f, 1.0f);
mt->setMatrix(m);
root->addChild(mt.get());
osgDB::writeNodeFile(*root, "page.osg");
osgUtil::Optimizer optimizer;
optimizer.optimize(root.get());
viewer->setSceneData(root.get());
viewer->realize();
viewer->run();
return 0;
}
#include <osgViewer/Viewer>
#include <osg/Node>
#include <osg/Geode>
#include <osg/Group>
#include <osg/PagedLOD>
#include <osg/PositionAttitudeTransform>
#include <osg/MatrixTransform>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgGA/TrackballManipulator>
#include <osgUtil/Optimizer>
using namespace std;
osg::ref_ptr<osg::Group> createPagedLOD()
{
osg::ref_ptr<osg::PagedLOD> page = new osg::PagedLOD();
page->setCenter(osg::Vec3(0.0f, 0.0f, 0.0f));
page->setFileName(0, "/home/zhaogang/work/thirdparty/OpenSceneGraph-3.2.1/data/cow.osg");
page->setRange(0, 0.0f, 50.0f);
page->setFileName(1, "/home/zhaogang/work/thirdparty/OpenSceneGraph-3.2.1/data/glider.osg");
page->setRange(1, 50.0f, 100.0f);
page->setFileName(2, "/home/zhaogang/work/thirdparty/OpenSceneGraph-3.2.1/data/cessna.osg");
page->setRange(2, 100.0f ,200.0f);
return page.get();
}
int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer();
osg::ref_ptr<osg::Group> root = new osg::Group();
osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform();
mt->addChild(createPagedLOD());
osg::Matrix m;
m.makeRotate(60.0f, 0.0f, 0.0f, 1.0f);
mt->setMatrix(m);
root->addChild(mt.get());
osgDB::writeNodeFile(*root, "page.osg");
osgUtil::Optimizer optimizer;
optimizer.optimize(root.get());
viewer->setSceneData(root.get());
viewer->realize();
viewer->run();
return 0;
}
-----
TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += main.cpp
LIBS += -L/usr/local/lib/
LIBS += -lOpenThreads
LIBS += -losg
LIBS += -losgDB
LIBS += -losgFX
LIBS += -losgGA
LIBS += -losgManipulator
LIBS += -losgParticle
LIBS += -losgShadow
LIBS += -losgSim
LIBS += -losgTerrain
LIBS += -losgText
LIBS += -losgUtil
LIBS += -losgViewer
----