本文整理汇总了C++中NodeContainer::end方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeContainer::end方法的具体用法?C++ NodeContainer::end怎么用?C++ NodeContainer::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeContainer
的用法示例。
在下文中一共展示了NodeContainer::end方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: uniqueHandle
InternedString uniqueHandle( const InternedString &handle )
{
if( m_nodes.find( handle ) == m_nodes.end() )
{
return handle;
}
string result;
for( int i = 1; true; ++i )
{
result = handle.string() + std::to_string( i );
if( m_nodes.find( result ) == m_nodes.end() )
{
return result;
}
}
}
示例2: removeShader
NodeContainer::iterator removeShader( NodeContainer::iterator it )
{
if( m_output.shader == it->handle )
{
m_output = Parameter();
}
for( const auto &c : it->inputConnections )
{
auto sourceIt = m_nodes.find( c.source.shader );
assert( sourceIt != m_nodes.end() );
sourceIt->mutableOutputConnections().erase( c.destination );
}
for( const auto &c : it->outputConnections )
{
auto destinationIt = m_nodes.find( c.destination.shader );
assert( destinationIt != m_nodes.end() );
destinationIt->mutableInputConnections().erase( c.destination );
}
m_hashDirty = true;
return m_nodes.erase( it );
}
示例3: LayoutAsGrid
void LayoutAsGrid()
{
// calculate bounding box
osg::BoundingBox bbox;
for (NodeIterator node = nodes.begin(); node != nodes.end(); ++node)
bbox.expandBy((*node)->getBound());
// setup grid information
osg::Group ** groups = new osg::Group*[GridX * GridY];
int i;
for (i = 0; i < GridX * GridY; i++)
groups[i] = new osg::Group();
float xGridStart = bbox.xMin();
float xGridSize = (bbox.xMax() - bbox.xMin()) / GridX;
float yGridStart = bbox.yMin();
float yGridSize = (bbox.yMax() - bbox.yMin()) / GridY;
// arrange buildings into right grid
for (NodeIterator nodeIter = nodes.begin(); nodeIter != nodes.end(); ++nodeIter)
{
osg::Node * node = nodeIter->get();
osg::Vec3 center = node->getBound().center();
int x = (int)floor((center.x() - xGridStart) / xGridSize);
int z = (int)floor((center.y() - yGridStart) / yGridSize);
groups[z * GridX + x]->addChild(node);
}
// add nodes to building root
for (i = 0; i < GridX * GridY; i++)
{
osg::StateSet * stateset = new osg::StateSet();
osg::Material * material = new osg::Material();
osg::Vec4 color = osg::Vec4(
0.5f + (static_cast<double> (rand()) / (2.0*static_cast<double> (RAND_MAX))),
0.5f + (static_cast<double> (rand()) / (2.0*static_cast<double> (RAND_MAX))),
0.5f + (static_cast<double> (rand()) / ( 2.0*static_cast<double>(RAND_MAX))),
1.0f);
material->setAmbient(osg::Material::FRONT_AND_BACK, color);
material->setDiffuse(osg::Material::FRONT_AND_BACK, color);
stateset->setAttributeAndModes(material, osg::StateAttribute::ON);
groups[i]->setStateSet(stateset);
if (UseImpostor)
{
osgSim::Impostor * impostor = new osgSim::Impostor();
impostor->setImpostorThreshold(static_cast<float> (Threshold));
impostor->addChild(groups[i]);
impostor->setRange(0, 0.0f, 1e7f);
impostor->setCenter(groups[i]->getBound().center());
Root->addChild(impostor);
}
else
{
Root->addChild(groups[i]);
}
}
delete[] groups;
}