From: Edward d'Auvergne Date: Mon, 15 Feb 2016 13:30:50 +0000 (+0100) Subject: Debugging message improvements for the particle system. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4b7f7861cdaeb9153dbc680d89b7a073777197d1;p=simgear.git Debugging message improvements for the particle system. --- diff --git a/simgear/debug/debug_types.h b/simgear/debug/debug_types.h index c6f31c26..ea666c86 100644 --- a/simgear/debug/debug_types.h +++ b/simgear/debug/debug_types.h @@ -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; diff --git a/simgear/debug/logstream.cxx b/simgear/debug/logstream.cxx index 699cae06..a8a1a2e2 100644 --- a/simgear/debug/logstream.cxx +++ b/simgear/debug/logstream.cxx @@ -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"; } } diff --git a/simgear/scene/model/SGReaderWriterXML.cxx b/simgear/scene/model/SGReaderWriterXML.cxx index 744c5dfd..e7c0b3f5 100644 --- a/simgear/scene/model/SGReaderWriterXML.cxx +++ b/simgear/scene/model/SGReaderWriterXML.cxx @@ -485,6 +485,7 @@ sgLoad3DModel_internal(const SGPath& path, std::vector 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 options2; options2 = new SGReaderWriterOptions(*options); if (i==0) { diff --git a/simgear/scene/model/particles.cxx b/simgear/scene/model/particles.cxx index a7fee2de..1b055127 100644 --- a/simgear/scene/model/particles.cxx +++ b/simgear/scene/model/particles.cxx @@ -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] << "," <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(emitter)==0) SG_LOG(SG_GENERAL, SG_ALERT, "observer error\n"); + //if (dynamic_cast(emitter)==0) SG_LOG(SG_PARTICLES, SG_ALERT, "observer error\n"); //align->addObserver(dynamic_cast(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:"<getStringValue("texture","")<<"\n"); textureFile= osgDB::findFileInPath(configNode->getStringValue("texture", ""), options->getDatabasePathList()); - //SG_LOG(SG_GENERAL, SG_ALERT, "found:"<getDatabasePathList().size(); ++i) - // SG_LOG(SG_GENERAL, SG_ALERT, + // SG_LOG(SG_PARTICLES, SG_ALERT, // "opts:"<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(emitter->getShooter()), dynamic_cast(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;