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


C++ ParameterPtr::getIndex方法代码示例

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


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

示例1: writeFunctionParameter

//-----------------------------------------------------------------------
void CGProgramWriter::writeFunctionParameter(std::ostream& os, ParameterPtr parameter)
{
	os << mGpuConstTypeMap[parameter->getType()];

	os << "\t";	
	os << parameter->getName();	
	if (parameter->isArray() == true)
	{
		os << "[" << parameter->getSize() << "]";	
	}
	
	if (parameter->getSemantic() != Parameter::SPS_UNKNOWN)
	{
		os << " : ";
		os << mParamSemanticMap[parameter->getSemantic()];

		if (parameter->getSemantic() != Parameter::SPS_POSITION && 
			parameter->getSemantic() != Parameter::SPS_NORMAL &&
			parameter->getSemantic() != Parameter::SPS_TANGENT &&
			parameter->getSemantic() != Parameter::SPS_BLEND_INDICES &&
			parameter->getSemantic() != Parameter::SPS_BLEND_WEIGHTS &&
			(!(parameter->getSemantic() == Parameter::SPS_COLOR && parameter->getIndex() == 0)) &&
			parameter->getIndex() >= 0)
		{			
			os << StringConverter::toString(parameter->getIndex()).c_str();
		}
	}
}
开发者ID:changsin,项目名称:ogre,代码行数:29,代码来源:OgreShaderCGProgramWriter.cpp

示例2: resolveLocalParameter

//-----------------------------------------------------------------------------
ParameterPtr Function::resolveLocalParameter(Parameter::Semantic semantic, int index,
										   const String& name,
										   GpuConstantType type)
{
	ParameterPtr param;

	param = getParameterByName(mLocalParameters, name);
	if (param.get() != NULL)
	{
		if (param->getType() == type &&
			param->getSemantic() == semantic &&
			param->getIndex() == index)
		{
			return param;
		}
		else 
		{
			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, 
				"Can not resolve local parameter due to type mismatch. Function <" + getName() + ">", 			
				"Function::resolveLocalParameter" );
		}		
	}
		
	param = ParameterPtr(OGRE_NEW Parameter(type, name, semantic, index, Parameter::SPC_UNKNOWN));
	addParameter(mLocalParameters, param);
			
	return param;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:29,代码来源:OgreShaderFunction.cpp

示例3: addOutputParameter

//-----------------------------------------------------------------------------
void Function::addOutputParameter(ParameterPtr parameter)
{
	// Check that parameter with the same semantic and index in output parameters list.
	if (getParameterBySemantic(mOutputParameters, parameter->getSemantic(), parameter->getIndex()).get() != NULL)
	{
		OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS, 
			"Parameter <" + parameter->getName() + "> has equal sematic parameter in function <" + getName() + ">", 			
			"Function::addOutputParameter" );
	}

	addParameter(mOutputParameters, parameter);
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:13,代码来源:OgreShaderFunction.cpp

示例4: writeFunctionParameter

//-----------------------------------------------------------------------
void HLSLProgramWriter::writeFunctionParameter(std::ostream& os, ParameterPtr parameter)
{

	os << mGpuConstTypeMap[parameter->getType()];
	
	os << "\t";	
	os << parameter->getName();	

	if (parameter->getSemantic() != Parameter::SPS_UNKNOWN)
	{
		os << " : ";
		
		os << mParamSemanticMap[parameter->getSemantic()];

		if (parameter->getSemantic() != Parameter::SPS_POSITION && 
			parameter->getSemantic() != Parameter::SPS_NORMAL &&
			(!(parameter->getSemantic() == Parameter::SPS_COLOR && parameter->getIndex() == 0)) &&
			parameter->getIndex() >= 0)
		{			
			os << StringConverter::toString(parameter->getIndex()).c_str();
		}
	}
}
开发者ID:dodong471520,项目名称:pap,代码行数:24,代码来源:OgreShaderHLSLProgramWriter.cpp

示例5: synchronizePixelnToBeVertexOut

//-----------------------------------------------------------------------
void ProgramManager::synchronizePixelnToBeVertexOut( ProgramSet* programSet )
{
	Program* vsProgram = programSet->getCpuVertexProgram();
	Program* psProgram = programSet->getCpuFragmentProgram();

	// first find the vertex shader
	ShaderFunctionConstIterator itFunction ;
	Function* vertexMain = NULL;
	Function* pixelMain = NULL;

	// find vertex shader main
	{
		const ShaderFunctionList& functionList = vsProgram->getFunctions();
		for (itFunction=functionList.begin(); itFunction != functionList.end(); ++itFunction)
		{
			Function* curFunction = *itFunction;
			if (curFunction->getFunctionType() == Function::FFT_VS_MAIN)
			{
				vertexMain = curFunction;
				break;
			}
		}
	}

	// find pixel shader main
	{
		const ShaderFunctionList& functionList = psProgram->getFunctions();
		for (itFunction=functionList.begin(); itFunction != functionList.end(); ++itFunction)
		{
			Function* curFunction = *itFunction;
			if (curFunction->getFunctionType() == Function::FFT_PS_MAIN)
			{
				pixelMain = curFunction;
				break;
			}
		}
	}

	// save the pixel program original input parameters
	const ShaderParameterList pixelOriginalInParams = pixelMain->getInputParameters();

	// set the pixel Input to be the same as the vertex prog output
	pixelMain->deleteAllInputParameters();

	// Loop the vertex shader output parameters and make sure that
	//   all of them exist in the pixel shader input.
	// If the parameter type exist in the original output - use it
	// If the parameter doesn't exist - use the parameter from the 
	//   vertex shader input.
	// The order will be based on the vertex shader parameters order 
	// Write output parameters.
	ShaderParameterConstIterator it;
	const ShaderParameterList& outParams = vertexMain->getOutputParameters();
	for (it=outParams.begin(); it != outParams.end(); ++it)
	{
		ParameterPtr curOutParemter = *it;
		ParameterPtr paramToAdd = Function::getParameterBySemantic(
			pixelOriginalInParams, 
			curOutParemter->getSemantic(), 
			curOutParemter->getIndex());

		if (paramToAdd.isNull())
		{
			// param not found - we will add the one from the vertex shader
			paramToAdd = curOutParemter; 
		}

		pixelMain->addInputParameter(paramToAdd);

	}
}
开发者ID:terminus510,项目名称:OgreBulletTest,代码行数:72,代码来源:OgreShaderProgramManager.cpp

示例6: generateLocalSplitParameters

//-----------------------------------------------------------------------------
void ProgramProcessor::generateLocalSplitParameters(Function* func, GpuProgramType progType,
												   MergeParameterList& mergedParams, 
												   ShaderParameterList& splitParams, LocalParameterMap& localParamsMap)
{
	// No split params created.
	if (splitParams.size() == 0)	
		return;	

	// Create the local parameters + map from source to local.
	for (unsigned int i=0; i < splitParams.size(); ++i)
	{
		ParameterPtr srcParameter   = splitParams[i];
		ParameterPtr localParameter = func->resolveLocalParameter(srcParameter->getSemantic(), srcParameter->getIndex(), "lsplit_" + srcParameter->getName(), srcParameter->getType());

		localParamsMap[srcParameter.get()] = localParameter;		
	}	

	int invocationCounter = 0;

	// Establish link between the local parameter to the merged parameter.
	for (unsigned int i=0; i < mergedParams.size(); ++i)
	{
		MergeParameter& curMergeParameter = mergedParams[i];

		for (unsigned int p=0; p < curMergeParameter.getSourceParameterCount(); ++p)
		{
			ParameterPtr srcMergedParameter    = curMergeParameter.getSourceParameter(p);
			LocalParameterMap::iterator itFind = localParamsMap.find(srcMergedParameter.get());

			// Case the source parameter is split parameter.
			if (itFind != localParamsMap.end())
			{
				// Case it is the vertex shader -> assign the local parameter to the output merged parameter.
				if (progType == GPT_VERTEX_PROGRAM)
				{
					FunctionInvocation* curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_ASSIGN, FFP_VS_POST_PROCESS, invocationCounter++);
					
					curFuncInvocation->pushOperand(itFind->second, Operand::OPS_IN, curMergeParameter.getSourceParameterMask(p));
					curFuncInvocation->pushOperand(curMergeParameter.getDestinationParameter(Operand::OPS_OUT, i), Operand::OPS_OUT, curMergeParameter.getDestinationParameterMask(p));		
					func->addAtomInstance(curFuncInvocation);		
				}
				else if (progType == GPT_FRAGMENT_PROGRAM)
				{
					FunctionInvocation* curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_ASSIGN, FFP_PS_PRE_PROCESS, invocationCounter++);
					
					curFuncInvocation->pushOperand(curMergeParameter.getDestinationParameter(Operand::OPS_IN, i), Operand::OPS_IN, curMergeParameter.getDestinationParameterMask(p));		
					curFuncInvocation->pushOperand(itFind->second, Operand::OPS_OUT, curMergeParameter.getSourceParameterMask(p));
					func->addAtomInstance(curFuncInvocation);		
				}
			}
		}
	}				
}
开发者ID:changsin,项目名称:ogre,代码行数:54,代码来源:OgreShaderProgramProcessor.cpp


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