Added fire effect, enabled by --fire command line option. The new fire effect

has been introduced to reproduce the scaling of paricle effects
This commit is contained in:
Robert Osfield 2008-03-17 10:29:23 +00:00
parent a1c0c2a3eb
commit 7ec5673a7e
2 changed files with 16 additions and 5 deletions

View File

@ -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)

View File

@ -64,6 +64,8 @@
#include <osgGA/AnimationPathManipulator>
#include <osgGA/TerrainManipulator>
#include <osgParticle/FireEffect>
#include <iostream>
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)
{