#include "stdafx.h"
#include "../include/LoadLib.h"
#include <iostream>
#include <osg/Node>
#include <osg/Group>
#include <osg/Geode>
#include <osg/lod>
#include <osgViewer/Viewer>
#include <osgUtil/Optimizer>
#include <osgDB/WriteFile>
#include <osgDB/ReadFile>
osg::ref_ptr<osg::Node> CreateLodNode()
{
osg::ref_ptr<osg::Node> n1 = osgDB::readNodeFile("cow.osg");
osg::ref_ptr<osg::Node> n2 = osgDB::readNodeFile("glider.osg");
osg::ref_ptr<osg::LOD> lod = new osg::LOD();
lod->addChild(n1,0.0f,30.0f);
lod->addChild(n2,30.0f,100.0f);
return lod.get();
}
int _tmain(int argc, _TCHAR* argv[])
{
osg::ref_ptr<osg::Group> root = new osg::Group();
root->addChild(CreateLodNode().get());
osgDB::writeNodeFile(*(root.get()),"lod.osg");
osgViewer::Viewer viewer;
viewer.setSceneData(root.get());
osgUtil::Optimizer optimizer;
optimizer.optimize(root.get());
viewer.realize();
viewer.run();
return 0;
}
#include "../include/LoadLib.h"
#include <iostream>
#include <osg/Node>
#include <osg/Group>
#include <osg/Geode>
#include <osg/lod>
#include <osgViewer/Viewer>
#include <osgUtil/Optimizer>
#include <osgDB/WriteFile>
#include <osgDB/ReadFile>
osg::ref_ptr<osg::Node> CreateLodNode()
{
osg::ref_ptr<osg::Node> n1 = osgDB::readNodeFile("cow.osg");
osg::ref_ptr<osg::Node> n2 = osgDB::readNodeFile("glider.osg");
osg::ref_ptr<osg::LOD> lod = new osg::LOD();
lod->addChild(n1,0.0f,30.0f);
lod->addChild(n2,30.0f,100.0f);
return lod.get();
}
int _tmain(int argc, _TCHAR* argv[])
{
osg::ref_ptr<osg::Group> root = new osg::Group();
root->addChild(CreateLodNode().get());
osgDB::writeNodeFile(*(root.get()),"lod.osg");
osgViewer::Viewer viewer;
viewer.setSceneData(root.get());
osgUtil::Optimizer optimizer;
optimizer.optimize(root.get());
viewer.realize();
viewer.run();
return 0;
}