]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/model/particles.cxx
Improved tile cache priority scheme.
[simgear.git] / simgear / scene / model / particles.cxx
index 9f3aeb7d686414cbc4b57b67904e4cc7f205389e..acac7dfc6b8696724f42b4c6125df048ce97fab8 100644 (file)
@@ -59,14 +59,16 @@ void GlobalParticleCallback::operator()(osg::Node* node, osg::NodeVisitor* nv)
     SGQuatd q
         = SGQuatd::fromLonLatDeg(modelRoot->getFloatValue("/position/longitude-deg",0),
                                  modelRoot->getFloatValue("/position/latitude-deg",0));
-    osg::Matrix om(q.osg());
+    osg::Matrix om(toOsg(q));
     osg::Vec3 v(0,0,9.81);
     gravity = om.preMult(v);
+    // NOTE: THIS WIND COMPUTATION DOESN'T SEEM TO AFFECT PARTICLES
     const osg::Vec3& zUpWind = Particles::getWindVector();
-    osg::Vec3 w(zUpWind.y(), zUpWind.x(), - zUpWind.z());
+    osg::Vec3 w(zUpWind.y(), zUpWind.x(), -zUpWind.z());
     wind = om.preMult(w);
 
-    //SG_LOG(SG_GENERAL, SG_ALERT, "wind vector:"<<w[0]<<","<<w[1]<<","<<w[2]<<"\n");
+    // SG_LOG(SG_GENERAL, SG_ALERT,
+    //        "wind vector:" << w[0] << "," <<w[1] << "," << w[2]);
 }
 
 
@@ -80,6 +82,7 @@ osg::ref_ptr<osg::Group> Particles::commonRoot;
 osg::ref_ptr<osgParticle::ParticleSystemUpdater> Particles::psu = new osgParticle::ParticleSystemUpdater;
 osg::ref_ptr<osg::Geode> Particles::commonGeode = new osg::Geode;;
 osg::Vec3 Particles::_wind;
+bool Particles::_frozen = false;
 
 Particles::Particles() : 
     useGravity(false),
@@ -510,6 +513,8 @@ osg::Group * Particles::appendParticles(const SGPropertyNode* configNode,
 void Particles::operator()(osg::Node* node, osg::NodeVisitor* nv)
 {
     //SG_LOG(SG_GENERAL, SG_ALERT, "callback!\n");
+    this->particleSys->setFrozen(_frozen);
+
     using namespace osg;
     if (shooterValue)
         shooter->setInitialSpeedRange(shooterValue->getValue(),
@@ -552,7 +557,7 @@ void Particles::operator()(osg::Node* node, osg::NodeVisitor* nv)
             if (displace * displace > 10000.0 * 10000.0) {
                 // Make new frame for particle system, coincident with
                 // the emitter frame, but oriented with local Z.
-                SGGeod geod = SGGeod::fromCart(SGVec3d(emitOrigin));
+                SGGeod geod = SGGeod::fromCart(toSG(emitOrigin));
                 Matrix newParticleMat = geod.makeZUpFrame();
                 Matrix changeParticleFrame
                     = particleMat * Matrix::inverse(newParticleMat);