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


C++ InternedString::string方法代码示例

本文整理汇总了C++中InternedString::string方法的典型用法代码示例。如果您正苦于以下问题:C++ InternedString::string方法的具体用法?C++ InternedString::string怎么用?C++ InternedString::string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InternedString的用法示例。


在下文中一共展示了InternedString::string方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: acceptsInput

bool RenderManShader::acceptsInput( const Plug *plug, const Plug *inputPlug ) const
{
	if( !Shader::acceptsInput( plug, inputPlug ) )
	{
		return false;
	}
	
	if( parametersPlug()->isAncestorOf( plug ) )
	{
		const Plug *sourcePlug = inputPlug->source<Plug>();
		if( plug->typeId() == Plug::staticTypeId() )
		{
			// coshader parameter - input must be another
			// renderman shader hosting a coshader.
			const RenderManShader *inputShader = sourcePlug->parent<RenderManShader>();
			if(
				!inputShader ||
				sourcePlug != inputShader->outPlug() ||
				inputShader->typePlug()->getValue() != "ri:shader"
			)
			{
				return false;
			}
			// so far all is good, but we also need to check that
			// the coshaderType annotations match if present.
			ConstCompoundDataPtr dstAnnotations = annotations();
			if( !dstAnnotations )
			{
				return true;
			}
			InternedString parameterName = plug->getName();
			if( plug->parent<GraphComponent>() != parametersPlug() )
			{
				// array parameter
				parameterName = plug->parent<GraphComponent>()->getName();
			}
			const StringData *dstType = dstAnnotations->member<StringData>( parameterName.string() + ".coshaderType" );
			if( !dstType )
			{
				return true;
			}
			ConstCompoundDataPtr srcAnnotations = inputShader->annotations();
			if( !srcAnnotations )
			{
				return false;
			}
			const StringData *srcType = srcAnnotations->member<StringData>( "coshaderType" );
			return srcType && srcType->readable() == dstType->readable();
		}
		else
		{
			// standard parameter - input must not be the
			// output of another shader.
			const Shader *inputShader = sourcePlug->ancestor<Shader>();
			return !inputShader || sourcePlug != inputShader->outPlug();
		}
	}
	
	return true;
}
开发者ID:AntiCG,项目名称:gaffer,代码行数:60,代码来源:RenderManShader.cpp

示例2: 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

示例3: acceptsInput

bool RenderManShader::acceptsInput( const Plug *plug, const Plug *inputPlug ) const
{
	if( !Shader::acceptsInput( plug, inputPlug ) )
	{
		return false;
	}
	
	if( parametersPlug()->isAncestorOf( plug ) )
	{
		const Plug *sourcePlug = inputPlug->source<Plug>();
		
		if( plug->typeId() == Plug::staticTypeId() )
		{
		
			const Node* sourceNode = inputPlug->node();
			if( runTimeCast<const Box>( sourceNode ) )
			{
				// looks like we're exposing this input via a box, or
				// connecting it to an unconnected output on a box. At
				// the moment, we're just accepting this and trusting
				// the user not to connect something nonsensical to inputPlug.
				// \todo: make it so we can't make illegal connections to inputPlug
				return true;
			}
			
			// coshader parameter - input must be another
			// renderman shader hosting a coshader.
			const RenderManShader *inputShader = sourcePlug->parent<RenderManShader>();
			if(
				!inputShader ||
				sourcePlug != inputShader->outPlug() ||
				inputShader->typePlug()->getValue() != "ri:shader"
			)
			{
				return false;
			}
			// so far all is good, but we also need to check that
			// the coshaderType annotations match if present.
			ConstCompoundDataPtr dstAnnotations = annotations();
			if( !dstAnnotations )
			{
				return true;
			}
			InternedString parameterName = plug->getName();
			if( plug->parent<GraphComponent>() != parametersPlug() )
			{
				// array parameter
				parameterName = plug->parent<GraphComponent>()->getName();
			}
			const StringData *dstType = dstAnnotations->member<StringData>( parameterName.string() + ".coshaderType" );
			if( !dstType )
			{
				return true;
			}
			ConstCompoundDataPtr srcAnnotations = inputShader->annotations();
			if( !srcAnnotations )
			{
				return false;
			}
			const StringData *srcType = srcAnnotations->member<StringData>( "coshaderType" );
			return srcType && srcType->readable() == dstType->readable();
		}
		else
		{
			// standard parameter - input must not be the
			// output of another shader.
			const Shader *inputShader = sourcePlug->ancestor<Shader>();
			return !inputShader || sourcePlug != inputShader->outPlug();
		}
	}
	
	return true;
}
开发者ID:danieldresser,项目名称:gaffer,代码行数:73,代码来源:RenderManShader.cpp

示例4: acceptsInput

bool RenderManShader::acceptsInput( const Plug *plug, const Plug *inputPlug ) const
{
	if( !Shader::acceptsInput( plug, inputPlug ) )
	{
		return false;
	}

	if( !inputPlug )
	{
		return true;
	}

	if( parametersPlug()->isAncestorOf( plug ) )
	{
		const Plug *sourcePlug = inputPlug->source<Plug>();

		if( plug->typeId() == Plug::staticTypeId() )
		{
			// coshader parameter - source must be another
			// renderman shader hosting a coshader, or a box,
			// shader switch or dot with a currently dangling connection.
			// in the latter cases, we will be called again when the
			// box or switch is connected to something, so we can check
			// that the indirect connection is to our liking.
			const Node* sourceNode = sourcePlug->node();

			if(
				runTimeCast<const Box>( sourceNode ) ||
				runTimeCast<const ShaderSwitch>( sourceNode ) ||
				runTimeCast<const Dot>( sourceNode )
			)
			{
				return true;
			}

			const RenderManShader *inputShader = sourcePlug->parent<RenderManShader>();
			if(
				!inputShader ||
				sourcePlug != inputShader->outPlug() ||
				inputShader->typePlug()->getValue() != "ri:shader"
			)
			{
				return false;
			}
			// so far all is good, but we also need to check that
			// the coshaderType annotations match if present.
			ConstCompoundDataPtr dstAnnotations = annotations();
			if( !dstAnnotations )
			{
				return true;
			}
			InternedString parameterName = plug->getName();
			if( plug->parent<GraphComponent>() != parametersPlug() )
			{
				// array parameter
				parameterName = plug->parent<GraphComponent>()->getName();
			}
			const StringData *dstType = dstAnnotations->member<StringData>( parameterName.string() + ".coshaderType" );
			if( !dstType )
			{
				return true;
			}
			ConstCompoundDataPtr srcAnnotations = inputShader->annotations();
			if( !srcAnnotations )
			{
				return false;
			}
			const StringData *srcType = srcAnnotations->member<StringData>( "coshaderType" );
			if( !srcType )
			{
				return false;
			}

			// we accept a space (or comma) separated list of source types, so that a coshader
			// can belong to multiple types.
			typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
			Tokenizer srcTypes( srcType->readable(), boost::char_separator<char>( " ," ) );
			return find( srcTypes.begin(), srcTypes.end(), dstType->readable() ) != srcTypes.end();
		}
		else
		{
			// standard parameter - input must not be the
			// output of another shader.
			const Shader *inputShader = sourcePlug->ancestor<Shader>();
			return !inputShader || sourcePlug != inputShader->outPlug();
		}
	}

	return true;
}
开发者ID:cwmartin,项目名称:gaffer,代码行数:90,代码来源:RenderManShader.cpp


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