OSG学习笔记(三)动画效果

1.雨雪;起火爆炸。

#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/api/Win32/GraphicsWindowWin32>
#include <osgDB/ReadFile>
#include <osgDB/ReaderWriter>
#include <osgFX/Scribe>
#include <osg/Switch>
#include <osg/MatrixTransform>
#include <osgParticle/PrecipitationEffect>
#include <osgParticle/FireEffect>
#include <osgParticle/ExplosionEffect>
#include <osgParticle/ExplosionDebrisEffect>

#include <iostream>



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

	//root->addChild(osgDB::readNodeFile("D://3rdparty//OSG3.6.3//OpenSceneGraph-Data//glider.osg"));

	//osg::ref_ptr<osgParticle::PrecipitationEffect> pe = new osgParticle::PrecipitationEffect();
	//pe->snow(0.5);//雨雪效果,rain
	//pe->setParticleColor(osg::Vec4(1.0, 1, 1, 0.5));
	//pe->setWind(osg::Vec3(0.5, 0, 0));
	//root->addChild(pe);

	osg::ref_ptr<osgParticle::FireEffect> fe = new osgParticle::FireEffect(osg::Vec3(30, 30, 30), 90);
	root->addChild(fe);

	osg::ref_ptr<osgParticle::ExplosionEffect> ee = new osgParticle::ExplosionEffect(osg::Vec3(30, 30, 30), 90);
	root->addChild(ee);

	osg::ref_ptr<osgParticle::ExplosionDebrisEffect> ede = new osgParticle::ExplosionDebrisEffect(osg::Vec3(30, 30, 30), 9);
	root->addChild(ede);

	viewer->setSceneData(root.get());
	viewer->addEventHandler(new osgViewer::WindowSizeHandler);	
	viewer->run();                                             

	return 0;
}

 

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页