本文整理汇总了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();
}
}
}
示例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;
}
示例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);
}
示例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();
}
}
}
示例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);
}
}
示例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);
}
}
}
}
}