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);
cloud_root = new osg::Group;
cloud_root->setNodeMask(simgear::MODEL_BIT);
cloud_root->setName("SGSky-cloud-root");
pre_selector = new osg::Switch;
pre_transform = new osg::Group;

View File

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

View File

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