资源简介

osg爆炸仿真及火烟模拟,包括爆炸效果,碎片仿真,火焰模拟和烟气模拟

资源截图

代码片段和文件信息

#include “stdafx.h“
#include “Conduit .h“

Conduit::Conduit(void)
: m_fTheNum(800)
 m_fTheSize(0.2)
 m_fTheSpeech(100)
{
m_VecPosition.set (15 64 3) ;
}

Conduit::~Conduit(void)
{
}

osgParticle::ParticleSystem * Conduit::CreateConduitScene(osg::Group* root)
{
    osgParticle::Particle ptemplate;


    ptemplate.setLifeTime(2);        // 2 seconds of life

    ptemplate.setSizeRange(osgParticle::rangef(0.1f 0.1f));
    ptemplate.setAlphaRange(osgParticle::rangef(1.0f 0.5f));
    ptemplate.setColorRange(osgParticle::rangev4(
        osg::Vec4(0.7f 1.0f 1.0f 1.5f) 
        osg::Vec4(0.8f 0.8f 1.0f 0.0f)));

    ptemplate.setRadius(m_fTheSize);    // 5 cm wide particles
    ptemplate.setMass(0.05f);    // 50 g heavy

   
    osgParticle::ParticleSystem *ps = new osgParticle::ParticleSystem;
    ps->setDefaultAttributes(“Images/smoke.rgb“ false false);


    ps->setDefaultParticleTemplate(ptemplate);


    osgParticle::ModularEmitter *emitter = new osgParticle::ModularEmitter;
    emitter->setParticleSystem(ps);

    osgParticle::RandomRateCounter *counter = new osgParticle::RandomRateCounter;    
counter->setRateRange(m_fTheNum m_fTheNum);
    emitter->setCounter(counter);
    
osgParticle::PointPlacer *placer = new osgParticle::PointPlacer;
    placer->setCenter(m_VecPosition);
    emitter->setPlacer(placer);


    osgParticle::RadialShooter *shooter = new osgParticle::RadialShooter;
    shooter->setInitialSpeedRange(m_fTheSpeech 0);
    emitter->setShooter(shooter);


    root->addChild(emitter);


osgParticle::ModularProgram *program = new osgParticle::ModularProgram;
    program->setParticleSystem(ps);

    osgParticle::AccelOperator *op1 = new osgParticle::AccelOperator;
    op1->setToGravity();
    program->addOperator(op1);

    osgParticle::FluidFrictionOperator *op3 = new osgParticle::FluidFrictionOperator;
    op3->setFluidToAir();
    program->addOperator(op3);


    root->addChild(program);


    osg::Geode *geode = new osg::Geode;
    geode->addDrawable(ps);


    root->addChild(geode);

    return ps;
}

osg::Node * Conduit::CreateConduit(osg::Group * root)
{
    osgParticle::ParticleSystem *ps2 = CreateConduitScene(root);

        osgParticle::ParticleSystemUpdater *psu = new osgParticle::ParticleSystemUpdater;

        psu->addParticleSystem(ps2);

return psu ;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     190976  2013-04-09 16:28  OSG_MFC_Explosion\Debug\OSG_MFC.exe

     文件   10685440  2013-04-09 16:28  OSG_MFC_Explosion\Debug\OSG_MFC.pdb

     文件       2435  2013-03-27 19:50  OSG_MFC_Explosion\OSG_MFC\Conduit .cpp

     文件       1139  2008-06-18 02:12  OSG_MFC_Explosion\OSG_MFC\Conduit .h

     文件       7300  2013-04-09 16:28  OSG_MFC_Explosion\OSG_MFC\Debug\BuildLog.htm

     文件     756229  2013-04-08 20:21  OSG_MFC_Explosion\OSG_MFC\Debug\Conduit .obj

     文件     703838  2013-04-09 16:06  OSG_MFC_Explosion\OSG_MFC\Debug\Explosion.obj

     文件     623087  2013-04-09 15:43  OSG_MFC_Explosion\OSG_MFC\Debug\Fire.obj

     文件      34502  2013-04-08 20:21  OSG_MFC_Explosion\OSG_MFC\Debug\MainFrm.obj

     文件     998246  2013-04-08 20:21  OSG_MFC_Explosion\OSG_MFC\Debug\MFC_OSG.obj

     文件         65  2013-04-09 16:28  OSG_MFC_Explosion\OSG_MFC\Debug\mt.dep

     文件       1196  2013-03-25 20:19  OSG_MFC_Explosion\OSG_MFC\Debug\OSG_MFC.exe.embed.manifest

     文件       1260  2013-03-25 20:19  OSG_MFC_Explosion\OSG_MFC\Debug\OSG_MFC.exe.embed.manifest.res

     文件       1120  2013-04-09 16:28  OSG_MFC_Explosion\OSG_MFC\Debug\OSG_MFC.exe.intermediate.manifest

     文件     887382  2013-04-08 20:21  OSG_MFC_Explosion\OSG_MFC\Debug\OSG_MFC.obj

     文件   25296896  2013-04-08 20:20  OSG_MFC_Explosion\OSG_MFC\Debug\OSG_MFC.pch

     文件      28196  2013-04-08 20:21  OSG_MFC_Explosion\OSG_MFC\Debug\OSG_MFC.res

     文件      21536  2013-04-08 20:21  OSG_MFC_Explosion\OSG_MFC\Debug\OSG_MFCDoc.obj

     文件     885166  2013-04-09 16:27  OSG_MFC_Explosion\OSG_MFC\Debug\OSG_MFCView.obj

     文件     618716  2013-04-09 15:43  OSG_MFC_Explosion\OSG_MFC\Debug\Smoke.obj

     文件     466515  2013-04-08 20:20  OSG_MFC_Explosion\OSG_MFC\Debug\stdafx.obj

     文件    2853888  2013-04-09 16:27  OSG_MFC_Explosion\OSG_MFC\Debug\vc90.idb

     文件    8474624  2013-04-09 16:27  OSG_MFC_Explosion\OSG_MFC\Debug\vc90.pdb

     文件       9398  2013-04-09 16:05  OSG_MFC_Explosion\OSG_MFC\Explosion.cpp

     文件       1433  2013-04-01 10:02  OSG_MFC_Explosion\OSG_MFC\Explosion.h

     文件       3916  2013-04-09 15:43  OSG_MFC_Explosion\OSG_MFC\Fire.cpp

     文件        739  2013-04-01 20:33  OSG_MFC_Explosion\OSG_MFC\Fire.h

     文件       1797  2013-03-21 10:25  OSG_MFC_Explosion\OSG_MFC\MainFrm.cpp

     文件        655  2013-03-21 10:25  OSG_MFC_Explosion\OSG_MFC\MainFrm.h

     文件       7670  2013-04-02 20:07  OSG_MFC_Explosion\OSG_MFC\MFC_OSG.cpp

............此处省略152个文件信息

评论

共有 条评论