当前位置: 首页>>代码示例>>C++>>正文


C++ NodeContainer::end方法代码示例

本文整理汇总了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;
				}
			}
		}
开发者ID:ImageEngine,项目名称:cortex,代码行数:17,代码来源:ShaderNetwork.cpp

示例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 );
		}
开发者ID:ImageEngine,项目名称:cortex,代码行数:24,代码来源:ShaderNetwork.cpp

示例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;
}
开发者ID:artoolkit,项目名称:osg,代码行数:66,代码来源:osgimpostor.cpp


注:本文中的NodeContainer::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。