From 7ec5673a7ecd3dcb48c9d7185a53be55588d0c36 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 17 Mar 2008 10:29:23 +0000 Subject: [PATCH] Added fire effect, enabled by --fire command line option. The new fire effect has been introduced to reproduce the scaling of paricle effects --- examples/osgsimulation/CMakeLists.txt | 7 +++---- examples/osgsimulation/osgsimulation.cpp | 14 +++++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/examples/osgsimulation/CMakeLists.txt b/examples/osgsimulation/CMakeLists.txt index 02c3828d0..a8b293171 100644 --- a/examples/osgsimulation/CMakeLists.txt +++ b/examples/osgsimulation/CMakeLists.txt @@ -1,7 +1,6 @@ -#this file is automatically generated - - SET(TARGET_SRC osgsimulation.cpp ) -SET(TARGET_ADDED_LIBRARIES osgSim osgGA ) + +SET(TARGET_ADDED_LIBRARIES osgParticle osgSim osgGA ) + #### end var setup ### SETUP_EXAMPLE(osgsimulation) diff --git a/examples/osgsimulation/osgsimulation.cpp b/examples/osgsimulation/osgsimulation.cpp index 93a736caf..a1458990a 100644 --- a/examples/osgsimulation/osgsimulation.cpp +++ b/examples/osgsimulation/osgsimulation.cpp @@ -64,6 +64,8 @@ #include #include +#include + #include osg::Node* createEarth() @@ -293,6 +295,7 @@ int main(int argc, char **argv) std::string pathfile; while (arguments.read("-p",pathfile)) {} + bool addFireEffect = arguments.read("--fire"); // if user request help write it out to cout. if (arguments.read("-h") || arguments.read("--help")) @@ -401,7 +404,16 @@ int main(int argc, char **argv) osg::MatrixTransform* scaler = new osg::MatrixTransform; scaler->addChild(cessna); scaler->setMatrix(osg::Matrixd::scale(s,s,s)*osg::Matrixd::rotate(rotation)); - scaler->getOrCreateStateSet()->setMode(GL_RESCALE_NORMAL,osg::StateAttribute::ON); + scaler->getOrCreateStateSet()->setMode(GL_RESCALE_NORMAL,osg::StateAttribute::ON); + + if (addFireEffect) + { + osg::Vec3d center = cessna->getBound().center(); + + osgParticle::FireEffect* fire = new osgParticle::FireEffect(center, 10.0f); + scaler->addChild(fire); + } + if (false) {