Object names for STG groups / nodes.

This commit is contained in:
James Turner 2013-06-22 14:27:53 +01:00
parent 4d1e7c536f
commit 6f54fb90eb
3 changed files with 15 additions and 4 deletions

View File

@ -61,7 +61,7 @@ SGSky::SGSky( void ) {
pre_root->setStateSet(preStateSet); pre_root->setStateSet(preStateSet);
cloud_root = new osg::Group; cloud_root = new osg::Group;
cloud_root->setNodeMask(simgear::MODEL_BIT); cloud_root->setNodeMask(simgear::MODEL_BIT);
cloud_root->setName("SGSky-cloud-root");
pre_selector = new osg::Switch; pre_selector = new osg::Switch;
pre_transform = new osg::Group; pre_transform = new osg::Group;

View File

@ -118,12 +118,14 @@ struct ReaderWriterSTG::_ModelBin {
readNode(const std::string&, const osgDB::Options*) readNode(const std::string&, const osgDB::Options*)
{ {
osg::ref_ptr<osg::Group> group = new osg::Group; osg::ref_ptr<osg::Group> group = new osg::Group;
group->setName("STG-group-A");
group->setDataVariance(osg::Object::STATIC); group->setDataVariance(osg::Object::STATIC);
for (std::list<_ObjectStatic>::iterator i = _objectStaticList.begin(); i != _objectStaticList.end(); ++i) { for (std::list<_ObjectStatic>::iterator i = _objectStaticList.begin(); i != _objectStaticList.end(); ++i) {
osg::ref_ptr<osg::Node> node; osg::ref_ptr<osg::Node> node;
if (i->_proxy) { if (i->_proxy) {
osg::ref_ptr<osg::ProxyNode> proxy = new osg::ProxyNode; osg::ref_ptr<osg::ProxyNode> proxy = new osg::ProxyNode;
proxy->setName("proxyNode");
proxy->setLoadingExternalReferenceMode(osg::ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER); proxy->setLoadingExternalReferenceMode(osg::ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER);
proxy->setFileName(0, i->_name); proxy->setFileName(0, i->_name);
proxy->setDatabaseOptions(i->_options.get()); proxy->setDatabaseOptions(i->_options.get());
@ -147,6 +149,7 @@ struct ReaderWriterSTG::_ModelBin {
osg::MatrixTransform* matrixTransform; osg::MatrixTransform* matrixTransform;
matrixTransform = new osg::MatrixTransform(matrix); matrixTransform = new osg::MatrixTransform(matrix);
matrixTransform->setName("positionStaticObject");
matrixTransform->setDataVariance(osg::Object::STATIC); matrixTransform->setDataVariance(osg::Object::STATIC);
matrixTransform->addChild(node.get()); matrixTransform->addChild(node.get());
group->addChild(matrixTransform); group->addChild(matrixTransform);
@ -368,6 +371,7 @@ struct ReaderWriterSTG::_ModelBin {
osg::ref_ptr<osg::Group> terrainGroup = new osg::Group; osg::ref_ptr<osg::Group> terrainGroup = new osg::Group;
terrainGroup->setDataVariance(osg::Object::STATIC); terrainGroup->setDataVariance(osg::Object::STATIC);
terrainGroup->setName("terrain");
if (_foundBase) { if (_foundBase) {
for (std::list<_Object>::iterator i = _objectList.begin(); i != _objectList.end(); ++i) { for (std::list<_Object>::iterator i = _objectList.begin(); i != _objectList.end(); ++i) {
@ -385,6 +389,7 @@ struct ReaderWriterSTG::_ModelBin {
osg::Node* node = SGOceanTile(bucket, options->getMaterialLib()); osg::Node* node = SGOceanTile(bucket, options->getMaterialLib());
if (node) { if (node) {
node->setName("SGOceanTile");
terrainGroup->addChild(node); terrainGroup->addChild(node);
} else { } else {
SG_LOG( SG_TERRAIN, SG_ALERT, SG_LOG( SG_TERRAIN, SG_ALERT,
@ -410,6 +415,7 @@ struct ReaderWriterSTG::_ModelBin {
} else { } else {
osg::PagedLOD* pagedLOD = new osg::PagedLOD; osg::PagedLOD* pagedLOD = new osg::PagedLOD;
pagedLOD->setCenterMode(osg::PagedLOD::USE_BOUNDING_SPHERE_CENTER); pagedLOD->setCenterMode(osg::PagedLOD::USE_BOUNDING_SPHERE_CENTER);
pagedLOD->setName("pagedObjectLOD");
// This should be visible in any case. // This should be visible in any case.
// If this is replaced by some lower level of detail, the parent LOD node handles this. // If this is replaced by some lower level of detail, the parent LOD node handles this.

View File

@ -399,13 +399,16 @@ struct SGTileGeometryBin {
if (matlib) if (matlib)
mat = matlib->find(i->first); mat = matlib->find(i->first);
eg = new EffectGeode; eg = new EffectGeode;
eg->setName("EffectGeode");
if (mat) if (mat)
eg->setEffect(mat->get_effect(i->second)); eg->setEffect(mat->get_effect(i->second));
eg->addDrawable(geometry); eg->addDrawable(geometry);
eg->runGenerators(geometry); // Generate extra data needed by effect eg->runGenerators(geometry); // Generate extra data needed by effect
if (group) if (group) {
group->setName("surfaceGeometryGroup");
group->addChild(eg); group->addChild(eg);
} }
}
if (group) if (group)
return group; return group;
else else
@ -953,6 +956,7 @@ SGLoadBTG(const std::string& path, const simgear::SGReaderWriterOptions* options
osg::ref_ptr<osg::Group> forestNode; osg::ref_ptr<osg::Group> forestNode;
osg::ref_ptr<osg::Group> buildingNode; osg::ref_ptr<osg::Group> buildingNode;
osg::Group* terrainGroup = new osg::Group; osg::Group* terrainGroup = new osg::Group;
terrainGroup->setName("BTGTerrainGroup");
osg::Node* node = tileGeometryBin.getSurfaceGeometry(matlib); osg::Node* node = tileGeometryBin.getSurfaceGeometry(matlib);
if (node) if (node)
@ -1001,6 +1005,7 @@ SGLoadBTG(const std::string& path, const simgear::SGReaderWriterOptions* options
osg::MatrixTransform* position = osg::MatrixTransform* position =
new osg::MatrixTransform(transformMat); new osg::MatrixTransform(transformMat);
position->setName("positionRandomeModel");
position->addChild(node); position->addChild(node);
models.push_back(ModelLOD(position, obj.lod)); models.push_back(ModelLOD(position, obj.lod));
} }