]> git.mxchange.org Git - simgear.git/commitdiff
Debugging message improvements for the particle system.
authorEdward d'Auvergne <edward@nmr-relax.com>
Mon, 15 Feb 2016 13:30:50 +0000 (14:30 +0100)
committerEdward d'Auvergne <edward@nmr-relax.com>
Fri, 19 Feb 2016 13:33:30 +0000 (14:33 +0100)
simgear/debug/debug_types.h
simgear/debug/logstream.cxx
simgear/scene/model/SGReaderWriterXML.cxx
simgear/scene/model/particles.cxx

index c6f31c26f948319face191398b0aa8bb10b4cb07..ea666c869828c5a0bf49be5b341f541514372a56 100644 (file)
@@ -33,7 +33,8 @@ typedef enum {
     SG_NAVAID      = 0x00400000,
     SG_GUI         = 0x00800000,
     SG_TERRASYNC   = 0x01000000,
-    SG_UNDEFD      = 0x02000000, // For range checking
+    SG_PARTICLES   = 0x02000000,
+    SG_UNDEFD      = 0x04000000, // For range checking
 
     SG_ALL         = 0xFFFFFFFF
 } sgDebugClass;
index 699cae068d2a01caf4db6939d3447d1c53180c57..a8a1a2e2dcd91a5777dcab7933fa67fde52a8b6a 100644 (file)
@@ -72,6 +72,7 @@ const char* debugClassToString(sgDebugClass c)
     case SG_NAVAID:     return "navaid";
     case SG_GUI:        return "gui";
     case SG_TERRASYNC:  return "terrasync";
+    case SG_PARTICLES:  return "particles";
     default:            return "unknown";
     }
 }
index 744c5dfd63667cfde20076f0e4b6d9d04e2d1482..e7c0b3f5fc042d8f529a2f69184413018897d662 100644 (file)
@@ -485,6 +485,7 @@ sgLoad3DModel_internal(const SGPath& path,
         std::vector<SGPropertyNode_ptr> particle_nodes;
         particle_nodes = props->getChildren("particlesystem");
         for (unsigned i = 0; i < particle_nodes.size(); ++i) {
+            SG_LOG(SG_PARTICLES, SG_DEBUG, "Reading in particle " << i << " from file: " << path.str());
             osg::ref_ptr<SGReaderWriterOptions> options2;
             options2 = new SGReaderWriterOptions(*options);
             if (i==0) {
index a7fee2ded106e3dbb4c69bd8570bd6f930ddd6f6..1b0551277e24a2e914b1f1df6d05bb8b89db6967 100644 (file)
@@ -62,7 +62,7 @@ void GlobalParticleCallback::operator()(osg::Node* node, osg::NodeVisitor* nv)
     osg::Vec3 w(zUpWind.y(), zUpWind.x(), -zUpWind.z());
     wind = om.preMult(w);
 
-    // SG_LOG(SG_GENERAL, SG_ALERT,
+    // SG_LOG(SG_PARTICLES, SG_ALERT,
     //        "wind vector:" << w[0] << "," <<w[1] << "," << w[2]);
 }
 
@@ -104,7 +104,7 @@ osg::Group* Particles::getCommonRoot()
 {
     if(!commonRoot.valid())
     {
-        SG_LOG(SG_GENERAL, SG_DEBUG, "Particle common root called!\n");
+        SG_LOG(SG_PARTICLES, SG_DEBUG, "Particle common root called.");
         commonRoot = new osg::Group;
         commonRoot.get()->setName("common particle system root");
         commonGeode.get()->setName("common particle system geode");
@@ -134,7 +134,23 @@ osg::Group * Particles::appendParticles(const SGPropertyNode* configNode,
                                           const osgDB::Options*
                                           options)
 {
-    SG_LOG(SG_GENERAL, SG_DEBUG, "Setting up a particle system!\n");
+    SG_LOG(SG_PARTICLES, SG_DEBUG,
+           "Setting up a particle system." << std::boolalpha
+        << "\n  Name: " << configNode->getStringValue("name", "")
+        << "\n  Type: " << configNode->getStringValue("type", "point")
+        << "\n  Attach: " << configNode->getStringValue("attach", "")
+        << "\n  Texture: " << configNode->getStringValue("texture", "")
+        << "\n  Emissive: " << configNode->getBoolValue("emissive")
+        << "\n  Lighting: " << configNode->getBoolValue("lighting")
+        << "\n  Align: " << configNode->getStringValue("align", "")
+        << "\n  Placer: " << configNode->hasChild("placer")
+        << "\n  Shooter: " << configNode->hasChild("shooter")
+        << "\n  Particle: " << configNode->hasChild("particle")
+        << "\n  Program: " << configNode->hasChild("program")
+        << "\n    Fluid: " << configNode->getChild("program")->getStringValue("fluid", "air")
+        << "\n    Gravity: " << configNode->getChild("program")->getBoolValue("gravity", true)
+        << "\n    Wind: " << configNode->getChild("program")->getBoolValue("wind", true)
+        << std::noboolalpha);
 
     osgParticle::ParticleSystem *particleSys;
 
@@ -174,7 +190,7 @@ osg::Group * Particles::appendParticles(const SGPropertyNode* configNode,
 
     align->setName("particle align");
 
-    //if (dynamic_cast<CustomModularEmitter*>(emitter)==0) SG_LOG(SG_GENERAL, SG_ALERT, "observer error\n");
+    //if (dynamic_cast<CustomModularEmitter*>(emitter)==0) SG_LOG(SG_PARTICLES, SG_ALERT, "observer error\n");
     //align->addObserver(dynamic_cast<CustomModularEmitter*>(emitter));
 
     align->addChild(emitter);
@@ -197,15 +213,15 @@ osg::Group * Particles::appendParticles(const SGPropertyNode* configNode,
     }
     std::string textureFile;
     if (configNode->hasValue("texture")) {
-        //SG_LOG(SG_GENERAL, SG_ALERT,
+        //SG_LOG(SG_PARTICLES, SG_ALERT,
         //       "requested:"<<configNode->getStringValue("texture","")<<"\n");
         textureFile= osgDB::findFileInPath(configNode->getStringValue("texture",
                                                                       ""),
                                            options->getDatabasePathList());
-        //SG_LOG(SG_GENERAL, SG_ALERT, "found:"<<textureFile<<"\n");
+        //SG_LOG(SG_PARTICLES, SG_ALERT, "found:"<<textureFile<<"\n");
 
         //for(unsigned i = 0; i < options->getDatabasePathList().size(); ++i)
-        //    SG_LOG(SG_GENERAL, SG_ALERT,
+        //    SG_LOG(SG_PARTICLES, SG_ALERT,
         //           "opts:"<<options->getDatabasePathList()[i]<<"\n");
     }
 
@@ -255,7 +271,7 @@ osg::Group * Particles::appendParticles(const SGPropertyNode* configNode,
                 }
                 emitter->setPlacer(msplacer);
             } else {
-                SG_LOG(SG_GENERAL, SG_ALERT,
+                SG_LOG(SG_PARTICLES, SG_ALERT,
                        "Detected particle system using segment(s) with less than 2 vertices\n");
             }
         } //else the default placer in ModularEmitter is used (PointPlacer)
@@ -481,7 +497,7 @@ osg::Group * Particles::appendParticles(const SGPropertyNode* configNode,
     }
 
     if (callback.get()) {  //this means we want property-driven changes
-        SG_LOG(SG_GENERAL, SG_DEBUG, "setting up particle system user data and callback\n");
+        SG_LOG(SG_PARTICLES, SG_DEBUG, "Setting up particle system user data and callback.");
         //setup data and callback
         callback.get()->setGeneralData(dynamic_cast<osgParticle::RadialShooter*>(emitter->getShooter()),
                                        dynamic_cast<osgParticle::RandomRateCounter*>(emitter->getCounter()),
@@ -494,7 +510,7 @@ osg::Group * Particles::appendParticles(const SGPropertyNode* configNode,
 
 void Particles::operator()(osg::Node* node, osg::NodeVisitor* nv)
 {
-    //SG_LOG(SG_GENERAL, SG_ALERT, "callback!\n");
+    //SG_LOG(SG_PARTICLES, SG_ALERT, "callback!\n");
     this->particleSys->setFrozen(_frozen);
 
     using namespace osg;