本文整理汇总了C++中FunctionInvocation类的典型用法代码示例。如果您正苦于以下问题:C++ FunctionInvocation类的具体用法?C++ FunctionInvocation怎么用?C++ FunctionInvocation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FunctionInvocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OGRE_EXCEPT
//-----------------------------------------------------------------------
bool FFPTransform::createCpuSubPrograms(ProgramSet* programSet)
{
//! [param_resolve]
Program* vsProgram = programSet->getCpuVertexProgram();
Function* vsEntry = vsProgram->getEntryPointFunction();
// Resolve World View Projection Matrix.
UniformParameterPtr wvpMatrix = vsProgram->resolveAutoParameterInt(GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX, 0);
// Resolve input position parameter.
ParameterPtr positionIn = vsEntry->resolveInputParameter(Parameter::SPS_POSITION, 0, Parameter::SPC_POSITION_OBJECT_SPACE, GCT_FLOAT4);
// Resolve output position parameter.
ParameterPtr positionOut = vsEntry->resolveOutputParameter(Parameter::SPS_POSITION, 0, Parameter::SPC_POSITION_PROJECTIVE_SPACE, GCT_FLOAT4);
if (!wvpMatrix || !positionIn || !positionOut)
{
OGRE_EXCEPT( Exception::ERR_INTERNAL_ERROR,
"Not all parameters could be constructed for the sub-render state.",
"FFPTransform::createCpuSubPrograms" );
}
//! [param_resolve]
// Add dependency.
vsProgram->addDependency(FFP_LIB_TRANSFORM);
FunctionInvocation* transformFunc = OGRE_NEW FunctionInvocation(FFP_FUNC_TRANSFORM, FFP_VS_TRANSFORM, 0);
transformFunc->pushOperand(wvpMatrix, Operand::OPS_IN);
transformFunc->pushOperand(positionIn, Operand::OPS_IN);
transformFunc->pushOperand(positionOut, Operand::OPS_OUT);
vsEntry->addAtomInstance(transformFunc);
return true;
}
示例2:
bool FunctionInvocation::FunctionInvocationLessThan::operator ()(FunctionInvocation const& lhs, FunctionInvocation const& rhs) const
{
// Check the function names first
if (lhs.getFunctionName() < rhs.getFunctionName())
return true;
// Next check the return type
if (lhs.getReturnType() < rhs.getReturnType())
return true;
// Check the number of operands
if (lhs.mOperands.size() < rhs.mOperands.size())
return true;
// Now that we've gotten past the two quick tests, iterate over operands
// Check the semantic and type. The operands must be in the same order as well.
OperandVector::const_iterator itLHSOps = lhs.mOperands.begin();
OperandVector::const_iterator itRHSOps = rhs.mOperands.begin();
for ( ; itLHSOps != lhs.mOperands.end(), itRHSOps != rhs.mOperands.end(); ++itLHSOps, ++itRHSOps)
{
if (itLHSOps->getSemantic() < itRHSOps->getSemantic())
return true;
if (itLHSOps->getParameter()->getType() < itRHSOps->getParameter()->getType())
return true;
}
return false;
}
示例3: buildParameterReferenceMap
//-----------------------------------------------------------------------------
void ProgramProcessor::buildParameterReferenceMap(FunctionAtomInstanceList& funcAtomList, ParameterOperandMap& paramsRefMap)
{
FunctionAtomInstanceIterator it = funcAtomList.begin();
FunctionAtomInstanceIterator itEnd = funcAtomList.end();
for (; it != itEnd; ++it)
{
FunctionAtom* curAtom = *it;
// Deal only with function invocations.
if (curAtom->getFunctionAtomType() == FunctionInvocation::Type)
{
FunctionInvocation* curFuncInvocation = static_cast<FunctionInvocation*>(curAtom);
FunctionInvocation::OperandVector& funcOperands = curFuncInvocation->getOperandList();
for (unsigned int op=0; op < funcOperands.size(); ++op)
{
Operand& curOperand = funcOperands[op];
paramsRefMap[curOperand.getParameter().get()].push_back(&curOperand);
}
}
}
}
示例4:
bool FunctionInvocation::FunctionInvocationCompare::operator ()(FunctionInvocation const& lhs, FunctionInvocation const& rhs) const
{
// Check the function names first
if (lhs.getFunctionName() != rhs.getFunctionName())
return false;
// Next check the return type
if (lhs.getReturnType() != rhs.getReturnType())
return false;
// Check the number of operands
if (lhs.mOperands.size() != rhs.mOperands.size())
return false;
// Now that we've gotten past the two quick tests, iterate over operands
// Check the semantic and type. The operands must be in the same order as well.
OperandVector::const_iterator itLHSOps = lhs.mOperands.begin();
OperandVector::const_iterator itRHSOps = rhs.mOperands.begin();
for ( ; ((itLHSOps != lhs.mOperands.end()) && (itRHSOps != rhs.mOperands.end())); ++itLHSOps, ++itRHSOps)
{
if (itLHSOps->getSemantic() != itRHSOps->getSemantic())
return false;
GpuConstantType leftType = itLHSOps->getParameter()->getType();
GpuConstantType rightType = itRHSOps->getParameter()->getType();
if (Ogre::Root::getSingletonPtr()->getRenderSystem()->getName().find("OpenGL ES 2") != String::npos)
{
if (leftType == GCT_SAMPLER1D)
leftType = GCT_SAMPLER2D;
if (rightType == GCT_SAMPLER1D)
rightType = GCT_SAMPLER2D;
}
// If a swizzle mask is being applied to the parameter, generate the GpuConstantType to
// perform the parameter type comparison the way that the compiler will see it.
if ((itLHSOps->getFloatCount(itLHSOps->getMask()) > 0) ||
(itRHSOps->getFloatCount(itRHSOps->getMask()) > 0))
{
if (itLHSOps->getFloatCount(itLHSOps->getMask()) > 0)
{
leftType = (GpuConstantType)((itLHSOps->getParameter()->getType() - itLHSOps->getParameter()->getType()) +
itLHSOps->getFloatCount(itLHSOps->getMask()));
}
if (itRHSOps->getFloatCount(itRHSOps->getMask()) > 0)
{
rightType = (GpuConstantType)((itRHSOps->getParameter()->getType() - itRHSOps->getParameter()->getType()) +
itRHSOps->getFloatCount(itRHSOps->getMask()));
}
}
if (leftType != rightType)
return false;
}
// Passed all tests, they are the same
return true;
}
示例5: indexToMask
//-----------------------------------------------------------------------
void DualQuaternionSkinning::addIndexedPositionWeight(Function* vsMain, int index,
ParameterPtr& pWorldMatrix, ParameterPtr& pPositionTempParameter,
ParameterPtr& pPositionRelatedOutputParam, int& funcCounter)
{
Operand::OpMask indexMask = indexToMask(index);
FunctionInvocation* curFuncInvocation;
//multiply position with world matrix and put into temporary param
curFuncInvocation = OGRE_NEW FunctionInvocation(SGX_FUNC_BLEND_WEIGHT, FFP_VS_TRANSFORM, funcCounter++);
curFuncInvocation->pushOperand(mParamInWeights, Operand::OPS_IN, indexMask);
curFuncInvocation->pushOperand(pWorldMatrix, Operand::OPS_IN);
curFuncInvocation->pushOperand(pPositionTempParameter, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
//check if on first iteration
if (index == 0)
{
//set the local param as the value of the world param
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_ASSIGN, FFP_VS_TRANSFORM, funcCounter++);
curFuncInvocation->pushOperand(pPositionTempParameter, Operand::OPS_IN);
curFuncInvocation->pushOperand(pPositionRelatedOutputParam, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
}
else
{
//add the local param as the value of the world param
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_ADD, FFP_VS_TRANSFORM, funcCounter++);
curFuncInvocation->pushOperand(pPositionTempParameter, Operand::OPS_IN);
curFuncInvocation->pushOperand(pPositionRelatedOutputParam, Operand::OPS_IN);
curFuncInvocation->pushOperand(pPositionRelatedOutputParam, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
}
}
示例6:
bool FunctionInvocation::FunctionInvocationLessThan::operator ()(FunctionInvocation const& lhs, FunctionInvocation const& rhs) const
{
// Check the function names first
// Adding an exception to std::string sorting. I feel that functions beginning with an underscore should be placed before
// functions beginning with an alphanumeric character. By default strings are sorted based on the ASCII value of each character.
// Underscores have an ASCII value in between capital and lowercase characters. This is why the exception is needed.
if (lhs.getFunctionName() < rhs.getFunctionName())
{
if(rhs.getFunctionName().at(0) == '_')
return false;
else
return true;
}
if (lhs.getFunctionName() > rhs.getFunctionName())
{
if(lhs.getFunctionName().at(0) == '_')
return true;
else
return false;
}
// Next check the return type
if (lhs.getReturnType() < rhs.getReturnType())
return true;
if (lhs.getReturnType() > rhs.getReturnType())
return false;
// Check the number of operands
if (lhs.mOperands.size() < rhs.mOperands.size())
return true;
if (lhs.mOperands.size() > rhs.mOperands.size())
return false;
// Now that we've gotten past the two quick tests, iterate over operands
// Check the semantic and type. The operands must be in the same order as well.
OperandVector::const_iterator itLHSOps = lhs.mOperands.begin();
OperandVector::const_iterator itRHSOps = rhs.mOperands.begin();
for ( ; itLHSOps != lhs.mOperands.end(), itRHSOps != rhs.mOperands.end(); ++itLHSOps, ++itRHSOps)
{
if (itLHSOps->getSemantic() < itRHSOps->getSemantic())
return true;
if (itLHSOps->getSemantic() > itRHSOps->getSemantic())
return false;
if (itLHSOps->getParameter()->getType() < itRHSOps->getParameter()->getType())
return true;
if (itLHSOps->getParameter()->getType() > itRHSOps->getParameter()->getType())
return false;
}
return true;
}
示例7: addPSModifierInvocation
//-----------------------------------------------------------------------
void LayeredBlending::addPSBlendInvocations(Function* psMain,
ParameterPtr arg1,
ParameterPtr arg2,
ParameterPtr texel,
int samplerIndex,
const LayerBlendModeEx& blendMode,
const int groupOrder,
int& internalCounter,
int targetChannels)
{
//
// Add the modifier invocation
//
addPSModifierInvocation(psMain, samplerIndex, arg1, arg2, groupOrder, internalCounter, targetChannels);
//
// Add the blending function invocations
//
BlendMode mode = getBlendMode(samplerIndex);
if ((LB_FFPBlend == mode) || (LB_Invalid == mode))
{
FFPTexturing::addPSBlendInvocations(psMain, arg1, arg2, texel, samplerIndex, blendMode, groupOrder, internalCounter, targetChannels);
}
else
{
//find the function name for the blend mode
String funcName;
for(int i = 0 ; i < (int)LayeredBlending::LB_MaxBlendModes ; ++i)
{
if (_blendModes[i].type == mode)
{
funcName = _blendModes[i].funcName;
break;
}
}
//add the function of the blend mode
if (funcName.empty() == false)
{
FunctionInvocation* curFuncInvocation = OGRE_NEW FunctionInvocation(funcName, groupOrder, internalCounter++);
curFuncInvocation->pushOperand(arg1, Operand::OPS_IN, targetChannels);
curFuncInvocation->pushOperand(arg2, Operand::OPS_IN, targetChannels);
curFuncInvocation->pushOperand(mPSOutDiffuse, Operand::OPS_OUT, targetChannels);
psMain->addAtomInstance(curFuncInvocation);
}
}
}
示例8: FunctionInvocation
//-----------------------------------------------------------------------
bool ShaderExInstancedViewports::addPSInvocations( Function* psMain, const int groupOrder )
{
FunctionInvocation* funcInvocation = NULL;
int internalCounter = 0;
funcInvocation = OGRE_NEW FunctionInvocation(SGX_FUNC_INSTANCED_VIEWPORTS_DISCARD_OUT_OF_BOUNDS, groupOrder, internalCounter++);
funcInvocation->pushOperand(mPSInMonitorsCount, Operand::OPS_IN);
funcInvocation->pushOperand(mPSInMonitorIndex, Operand::OPS_IN);
funcInvocation->pushOperand(mPSInPositionProjectiveSpace, Operand::OPS_IN);
psMain->addAtomInstance(funcInvocation);
return true;
}
示例9: switch
//-----------------------------------------------------------------------
void LayeredBlending::addPSModifierInvocation(Function* psMain,
int samplerIndex,
ParameterPtr arg1,
ParameterPtr arg2,
const int groupOrder,
int& internalCounter,
int targetChannels)
{
SourceModifier modType;
int customNum;
if (getSourceModifier(samplerIndex, modType, customNum) == true)
{
ParameterPtr modifiedParam;
String funcName;
switch (modType)
{
case SM_Source1Modulate:
funcName = "SGX_src_mod_modulate";
modifiedParam = arg1;
break;
case SM_Source2Modulate:
funcName = "SGX_src_mod_modulate";
modifiedParam = arg2;
break;
case SM_Source1InvModulate:
funcName = "SGX_src_mod_inv_modulate";
modifiedParam = arg1;
break;
case SM_Source2InvModulate:
funcName = "SGX_src_mod_inv_modulate";
modifiedParam = arg2;
break;
default:
break;
}
//add the function of the blend mode
if (funcName.empty() == false)
{
ParameterPtr& controlParam = mTextureBlends[samplerIndex].modControlParam;
FunctionInvocation* curFuncInvocation = OGRE_NEW FunctionInvocation(funcName, groupOrder, internalCounter++);
curFuncInvocation->pushOperand(modifiedParam, Operand::OPS_IN, targetChannels);
curFuncInvocation->pushOperand(controlParam, Operand::OPS_IN, targetChannels);
curFuncInvocation->pushOperand(modifiedParam, Operand::OPS_OUT, targetChannels);
psMain->addAtomInstance(curFuncInvocation);
}
}
}
示例10: FunctionInvocation
//-----------------------------------------------------------------------
void FFPTexturing::addPSSampleTexelInvocation(TextureUnitParams* textureUnitParams, Function* psMain,
const ParameterPtr& texel, int groupOrder, int& internalCounter)
{
FunctionInvocation* curFuncInvocation = NULL;
if (textureUnitParams->mTexCoordCalcMethod == TEXCALC_PROJECTIVE_TEXTURE)
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_SAMPLE_TEXTURE_PROJ, groupOrder, internalCounter++);
else
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_SAMPLE_TEXTURE, groupOrder, internalCounter++);
curFuncInvocation->pushOperand(textureUnitParams->mTextureSampler, Operand::OPS_IN);
curFuncInvocation->pushOperand(textureUnitParams->mPSInputTexCoord, Operand::OPS_IN);
curFuncInvocation->pushOperand(texel, Operand::OPS_OUT);
psMain->addAtomInstance(curFuncInvocation);
}
示例11: FunctionInvocation
bool FFPAlphaTest::addFunctionInvocations( ProgramSet* programSet )
{
Program* psProgram = programSet->getCpuFragmentProgram();
Function* psMain = psProgram->getEntryPointFunction();
FunctionInvocation *curFuncInvocation;
//Fragment shader invocations
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_ALPHA_TEST, FFP_PS_ALPHA_TEST, 0);
curFuncInvocation->pushOperand(mPSAlphaFunc, Operand::OPS_IN);
curFuncInvocation->pushOperand(mPSAlphaRef, Operand::OPS_IN);
curFuncInvocation->pushOperand(mPSOutDiffuse, Operand::OPS_IN);
psMain->addAtomInstance(curFuncInvocation);
return true;
}
示例12: FunctionInvocation
//-----------------------------------------------------------------------
bool RTShaderSRSSegmentedLights::addVSInvocation(Function* vsMain, const int groupOrder, int& internalCounter)
{
FunctionInvocation* curFuncInvocation = NULL;
if (mVSInNormal.get() != NULL)
{
// Transform normal in world space.
curFuncInvocation = OGRE_NEW FunctionInvocation(SL_FUNC_TRANSFORMNORMAL, groupOrder, internalCounter++);
curFuncInvocation->pushOperand(mWorldITMatrix, Operand::OPS_IN);
curFuncInvocation->pushOperand(mVSInNormal, Operand::OPS_IN);
curFuncInvocation->pushOperand(mVSOutNormal, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
}
// Transform world space position if need to.
if (mVSOutWorldPos.get() != NULL)
{
curFuncInvocation = OGRE_NEW FunctionInvocation(SL_FUNC_TRANSFORMPOSITION, groupOrder, internalCounter++);
curFuncInvocation->pushOperand(mWorldMatrix, Operand::OPS_IN);
curFuncInvocation->pushOperand(mVSInPosition, Operand::OPS_IN);
curFuncInvocation->pushOperand(mVSOutWorldPos, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
}
return true;
}
示例13: FunctionInvocation
//-----------------------------------------------------------------------
bool IntegratedPSSM3::addVSInvocation(Function* vsMain, const int groupOrder, int& internalCounter)
{
FunctionInvocation* curFuncInvocation;
// Output the vertex depth in camera space.
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_ASSIGN, groupOrder, internalCounter++);
curFuncInvocation->pushOperand(mVSOutPos, Operand::OPS_IN, Operand::OPM_Z);
curFuncInvocation->pushOperand(mVSOutDepth, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
// Compute world space position.
ShadowTextureParamsIterator it = mShadowTextureParamsList.begin();
while(it != mShadowTextureParamsList.end())
{
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_TRANSFORM, groupOrder, internalCounter++);
curFuncInvocation->pushOperand(it->mWorldViewProjMatrix, Operand::OPS_IN);
curFuncInvocation->pushOperand(mVSInPos, Operand::OPS_IN);
curFuncInvocation->pushOperand(it->mVSOutLightPosition, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
++it;
}
return true;
}
示例14: addIndexedNormalRelatedWeight
//-----------------------------------------------------------------------
void HardwareSkinning::addNormalRelatedCalculations(Function* vsMain,
ParameterPtr& pNormalRelatedParam,
ParameterPtr& pNormalWorldRelatedParam,
int& funcCounter)
{
FunctionInvocation* curFuncInvocation;
if (mDoBoneCalculations == true)
{
//set functions to calculate world normal
for(int i = 0 ; i < getWeightCount() ; ++i)
{
addIndexedNormalRelatedWeight(vsMain, pNormalRelatedParam, pNormalWorldRelatedParam, i, funcCounter);
}
//update back the original position relative to the object
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_TRANSFORM, FFP_VS_TRANSFORM, funcCounter++);
curFuncInvocation->pushOperand(mParamInInvWorldMatrix, Operand::OPS_IN);
curFuncInvocation->pushOperand(pNormalWorldRelatedParam, Operand::OPS_IN);
curFuncInvocation->pushOperand(pNormalRelatedParam, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
}
else
{
//update from object to world space
curFuncInvocation = OGRE_NEW FunctionInvocation(FFP_FUNC_TRANSFORM, FFP_VS_TRANSFORM, funcCounter++);
curFuncInvocation->pushOperand(mParamInWorldMatrix, Operand::OPS_IN);
curFuncInvocation->pushOperand(pNormalRelatedParam, Operand::OPS_IN);
curFuncInvocation->pushOperand(pNormalWorldRelatedParam, Operand::OPS_OUT);
vsMain->addAtomInstance(curFuncInvocation);
}
}
示例15: assert
//-----------------------------------------------------------------------
bool FFPTransform::createCpuSubPrograms(ProgramSet* programSet)
{
Program* vsProgram = programSet->getCpuVertexProgram();
// Resolve World View Projection Matrix.
UniformParameterPtr wvpMatrix = vsProgram->resolveAutoParameterInt(GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX, 0);
if (wvpMatrix.get() == NULL)
return false;
Function* vsEntry = vsProgram->getEntryPointFunction();
assert(vsEntry != NULL);
// Resolve input position parameter.
ParameterPtr positionIn = vsEntry->resolveInputParameter(Parameter::SPS_POSITION, 0, Parameter::SPC_POSITION_OBJECT_SPACE, GCT_FLOAT4);
if (positionIn.get() == NULL)
return false;
// Resolve output position parameter.
ParameterPtr positionOut = vsEntry->resolveOutputParameter(Parameter::SPS_POSITION, 0, Parameter::SPC_POSITION_PROJECTIVE_SPACE, GCT_FLOAT4);
if (positionOut.get() == NULL)
return false;
// Add dependency.
vsProgram->addDependency(FFP_LIB_TRANSFORM);
FunctionInvocation* transformFunc = OGRE_NEW FunctionInvocation(FFP_FUNC_TRANSFORM, FFP_VS_TRANSFORM, 0);
transformFunc->pushOperand(wvpMatrix, Operand::OPS_IN);
transformFunc->pushOperand(positionIn, Operand::OPS_IN);
transformFunc->pushOperand(positionOut, Operand::OPS_OUT);
vsEntry->addAtomInstace(transformFunc);
return true;
}