Debugging message improvements for the particle system.

This commit is contained in:
Edward d'Auvergne
2016-02-15 14:30:50 +01:00
parent e7598df4d3
commit 4b7f7861cd
4 changed files with 30 additions and 11 deletions

View 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;

View 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";
}
}

View 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) {

View 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;