#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
#include <osgGA/TrackballManipulator>
#include <osgOcean/OceanScene>
#include <osgOcean/FFTOceanSurface>
#include <osgViewer/ViewerEventHandlers>
#include <osg/TextureCubeMap>
#include <osg/MatrixTransform> #pragma comment(lib, "osgViewerd.lib")
#pragma comment(lib, "osgd.lib")
#pragma comment(lib, "osgDBd.lib")
#pragma comment(lib, "osgOceanD.lib")
#pragma comment(lib, "osgGAd.lib")
#pragma comment(lib, "osgUtild.lib") int main()
{
osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
viewer->setUpViewInWindow(,,,,); osg::ref_ptr<osgOcean::FFTOceanSurface> surface = new osgOcean::FFTOceanSurface(,,,osg::Vec2(1.1f,1.1f),,,0.8,1e-,true,2.5,20.0,);
osg::ref_ptr<osgOcean::OceanScene> scene = new osgOcean::OceanScene(surface.get()); scene->setAboveWaterFog(0.0012,osg::Vec4(0.67,0.87,0.97,1.0));
scene->enableReflections(true); surface->setFoamBottomHeight(2.2);
surface->setFoamTopHeight(3.0);
surface->enableCrestFoam(true); viewer->addEventHandler(surface->getEventHandler());
viewer->addEventHandler(scene->getEventHandler()); osgGA::TrackballManipulator *tb = new osgGA::TrackballManipulator;
tb->setHomePosition(osg::Vec3d(,,),osg::Vec3d(,,),osg::Z_AXIS);
viewer->setCameraManipulator(tb);
viewer->addEventHandler(new osgViewer::StatsHandler); viewer->setSceneData(scene.get());
viewer->run();
return ;
}

osgOcean测试-LMLPHP

05-10 23:29