本文整理汇总了C++中osg::Group::getUserData方法的典型用法代码示例。如果您正苦于以下问题:C++ Group::getUserData方法的具体用法?C++ Group::getUserData怎么用?C++ Group::getUserData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Group
的用法示例。
在下文中一共展示了Group::getUserData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: guard
void
FltExportVisitor::apply( osg::Group& node )
{
ScopedStatePushPop guard( this, node.getStateSet() );
if (_firstNode)
{
// On input, a FLT header creates a Group node.
// On export, we always write a Header record, but then the first Node
// we export is the Group that was created from the original input Header.
// On successive roundtrips, this results in increased redundant top-level Group nodes/records.
// Avoid this by NOT outputting anything for a top-level Group node.
_firstNode = false;
traverse( node );
return;
}
// A Group node could indicate one of many possible records.
// Header record -- Don't need to support this here. We always output a header.
// Group record -- HIGH
// Child of an LOD node -- HIGH Currently write out a Group record regardless.
// InstanceDefinition/InstanceReference -- MED -- multiparented Group is an instance
// Extension record -- MED
// Object record -- MED
// LightPointSystem record (if psgSim::MultiSwitch) -- LOW
osgSim::MultiSwitch* multiSwitch = dynamic_cast<osgSim::MultiSwitch*>( &node );
if (multiSwitch)
{
writeSwitch( multiSwitch );
}
else
{
osgSim::ObjectRecordData* ord =
dynamic_cast< osgSim::ObjectRecordData* >( node.getUserData() );
if (ord)
{
// This Group should write an Object Record.
writeObject( node, ord );
}
else
{
// Handle other cases here.
// For now, just output a Group record.
writeGroup( node );
}
}
writeMatrix( node.getUserData() );
writeComment( node );
writePushTraverseWritePop( node );
}
示例2: apply
void TileMapper::apply(osg::Group& node)
{
if (node.getName()=="TileContent")
{
_containsGeode = true;
return;
}
if (isCulled(node))
return;
// push the culling mode.
pushCurrentMask();
TileIdentifier* tid = dynamic_cast<TileIdentifier*>(node.getUserData());
if (tid)
{
_containsGeode = false;
}
traverse(node);
if (tid)
{
if (_containsGeode)
{
insertTile(*tid);
_containsGeode = false;
}
}
// pop the culling mode.
popCurrentMask();
}
示例3: apply
void TileMapper::apply(osg::Group& node)
{
if (node.getName()=="TileContent")
{
_containsGeode = true;
return;
}
if (isCulled(node))
return;
// push the culling mode.
pushCurrentMask();
TileIdentifier* tid = dynamic_cast<TileIdentifier*>(node.getUserData());
if (tid)
{
_tileStack.push_back(TileStack::value_type(*tid,&node));
_containsGeode = false;
}
traverse(node);
if (tid)
{
if (_containsGeode)
{
insertTile(*tid);
_containsGeode = false;
#if 0
std::cout<<"found Group="<<tid->lod
<<" X="<<tid->x
<<" Y="<<tid->y
<<" ptr="<<&node<<std::endl;
std::cout<<" inheritance list "<<_tileStack.size()<<std::endl;
for(TileStack::iterator itr=_tileStack.begin();
itr!=_tileStack.end();
++itr)
{
std::cout<<" LOD="<<itr->first.lod
<<" X="<<itr->first.x
<<" Y="<<itr->first.y
<<" className="<<itr->second->className()
<<" ptr="<<itr->second<<std::endl;
}
osg::StateSet* stateset = node.getOrCreateStateSet();
osg::Material* material = new osg::Material;
material->setColorMode(osg::Material::OFF);
stateset->setAttribute(material);
switch(tid->lod)
{
case(0): material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(1.0f,1.0f,1.0f,1.0f)); break;
case(1): material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(1.0f,0.0f,0.0f,1.0f)); break;
case(2): material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(0.0f,1.0f,0.0f,1.0f)); break;
case(3): material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(0.0f,0.0f,1.0f,1.0f)); break;
case(4): material->setEmission(osg::Material::FRONT_AND_BACK,osg::Vec4(1.0f,0.0f,1.0f,1.0f)); break;
}
#endif
}
_tileStack.pop_back();
}
// pop the culling mode.
popCurrentMask();
}