#include <osgViewer/Viewer>
#include 
<osg/Node>
#include 
<osg/Geometry>
#include 
<osg/Geode>
#include 
<osg/Group>
#include 
<osg/AutoTransform>

#include 
<osgDB/ReadFile>
#include 
<osgDB/WriteFile>

#include 
<osgText/Text>

#include 
<osgUtil/Optimizer>
#include 
<osgSim/Impostor>

#include 
<iostream>

int main()
{
    osg::ref_ptr
<osgViewer::Viewer> viewer=new osgViewer::Viewer;
    osg::ref_ptr
<osg::Group> root=new osg::Group;

    osg::ref_ptr
<osg::Node> node=osgDB::readNodeFile("D:\\my work\\aerolite\\aerolite-0.10\\bin\\cow.osg");

    osg::ref_ptr
<osgSim::Impostor> impostor=new osgSim::Impostor;
    
//设置50.0f之后开始使用贴图
    impostor->setImpostorThreshold(50.0f);
    
//设置模型的显示范围在0-10000内
    impostor->addChild(node.get(),0,100.0f);


    
    root
->addChild(impostor.get());

    viewer
->setSceneData(root.get());

    viewer
->realize();

    viewer
->run();
}
posted on 2011-03-28 15:04  jackdesk  阅读(1142)  评论(0编辑  收藏  举报