本文整理汇总了C++中ParameterPtr::isArray方法的典型用法代码示例。如果您正苦于以下问题:C++ ParameterPtr::isArray方法的具体用法?C++ ParameterPtr::isArray怎么用?C++ ParameterPtr::isArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterPtr
的用法示例。
在下文中一共展示了ParameterPtr::isArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: writeOutParameters
//-----------------------------------------------------------------------
void GLSLProgramWriter::writeOutParameters(std::ostream& os, Function* function, GpuProgramType gpuType)
{
const ShaderParameterList& outParams = function->getOutputParameters();
ShaderParameterConstIterator itParam = outParams.begin();
ShaderParameterConstIterator itParamEnd = outParams.end();
for ( ; itParam != itParamEnd; ++itParam)
{
ParameterPtr pParam = *itParam;
if(gpuType == GPT_VERTEX_PROGRAM)
{
// GLSL vertex program has to write always gl_Position (but this is also deprecated after version 130)
if(pParam->getContent() == Parameter::SPC_POSITION_PROJECTIVE_SPACE)
{
mInputToGLStatesMap[pParam->getName()] = "gl_Position";
}
else
{
// After GLSL 1.20 varying is deprecated
if(mGLSLVersion <= 120)
{
os << "varying\t";
}
else
{
os << "out\t";
}
os << mGpuConstTypeMap[pParam->getType()];
os << "\t";
os << pParam->getName();
if (pParam->isArray() == true)
{
os << "[" << pParam->getSize() << "]";
}
os << ";" << std::endl;
}
}
else if(gpuType == GPT_FRAGMENT_PROGRAM &&
pParam->getSemantic() == Parameter::SPS_COLOR)
{
// GLSL fragment program has to write always gl_FragColor (but this is also deprecated after version 130)
// Always add gl_FragColor as an output. The name is for compatibility.
if(mGLSLVersion <= 130)
{
mInputToGLStatesMap[pParam->getName()] = "gl_FragColor";
}
else
{
os << "out vec4 fragColour;" << std::endl;
mInputToGLStatesMap[pParam->getName()] = "fragColour";
}
}
}
}
示例3: writeLocalParameter
//-----------------------------------------------------------------------
void CGProgramWriter::writeLocalParameter(std::ostream& os, ParameterPtr parameter)
{
os << mGpuConstTypeMap[parameter->getType()];
os << "\t";
os << parameter->getName();
if (parameter->isArray() == true)
{
os << "[" << parameter->getSize() << "]";
}
}
示例4: writeSourceCode
//-----------------------------------------------------------------------
void GLSLProgramWriter::writeSourceCode(std::ostream& os, Program* program)
{
GpuProgramType gpuType = program->getType();
if(gpuType == GPT_GEOMETRY_PROGRAM)
{
OGRE_EXCEPT( Exception::ERR_NOT_IMPLEMENTED,
"Geometry Program not supported in GLSL writer ",
"GLSLProgramWriter::writeSourceCode" );
}
// Clear out old input params
mFragInputParams.clear();
const ShaderFunctionList& functionList = program->getFunctions();
ShaderFunctionConstIterator itFunction;
const UniformParameterList& parameterList = program->getParameters();
UniformParameterConstIterator itUniformParam = parameterList.begin();
// Write the current version (this force the driver to more fulfill the glsl standard)
os << "#version "<< mGLSLVersion << std::endl;
// Generate source code header.
writeProgramTitle(os, program);
os<< std::endl;
// Write forward declarations
writeForwardDeclarations(os, program);
os<< std::endl;
// Generate global variable code.
writeUniformParametersTitle(os, program);
os << std::endl;
// Write the uniforms
for (itUniformParam = parameterList.begin(); itUniformParam != parameterList.end(); ++itUniformParam)
{
ParameterPtr pUniformParam = *itUniformParam;
os << "uniform\t";
os << mGpuConstTypeMap[pUniformParam->getType()];
os << "\t";
os << pUniformParam->getName();
if (pUniformParam->isArray() == true)
{
os << "[" << pUniformParam->getSize() << "]";
}
os << ";" << std::endl;
}
os << std::endl;
// Write program function(s).
for (itFunction=functionList.begin(); itFunction != functionList.end(); ++itFunction)
{
Function* curFunction = *itFunction;
writeFunctionTitle(os, curFunction);
// Clear output mapping this map is used when we use
// glsl built in types like gl_Color for example
mInputToGLStatesMap.clear();
// Write inout params and fill mInputToGLStatesMap
writeInputParameters(os, curFunction, gpuType);
writeOutParameters(os, curFunction, gpuType);
// The function name must always main.
os << "void main(void) {" << std::endl;
// Write local parameters.
const ShaderParameterList& localParams = curFunction->getLocalParameters();
ShaderParameterConstIterator itParam = localParams.begin();
ShaderParameterConstIterator itParamEnd = localParams.end();
for (; itParam != itParamEnd; ++itParam)
{
os << "\t";
writeLocalParameter(os, *itParam);
os << ";" << std::endl;
}
os << std::endl;
// Sort function atoms.
curFunction->sortAtomInstances();
const FunctionAtomInstanceList& atomInstances = curFunction->getAtomInstances();
FunctionAtomInstanceConstIterator itAtom = atomInstances.begin();
FunctionAtomInstanceConstIterator itAtomEnd = atomInstances.end();
for (; itAtom != itAtomEnd; ++itAtom)
{
FunctionInvocation* pFuncInvoc = (FunctionInvocation*)*itAtom;
FunctionInvocation::OperandVector::iterator itOperand = pFuncInvoc->getOperandList().begin();
FunctionInvocation::OperandVector::iterator itOperandEnd = pFuncInvoc->getOperandList().end();
// Local string stream
StringStream localOs;
// Write function name
//.........这里部分代码省略.........
示例5: writeOutParameters
//-----------------------------------------------------------------------
void GLSLProgramWriter::writeOutParameters(std::ostream& os, Function* function, GpuProgramType gpuType)
{
const ShaderParameterList& outParams = function->getOutputParameters();
ShaderParameterConstIterator itParam = outParams.begin();
ShaderParameterConstIterator itParamEnd = outParams.end();
for ( ; itParam != itParamEnd; ++itParam)
{
ParameterPtr pParam = *itParam;
if(gpuType == GPT_VERTEX_PROGRAM)
{
// GLSL vertex program has to write always gl_Position (but this is also deprecated after version 130)
if(pParam->getContent() == Parameter::SPC_POSITION_PROJECTIVE_SPACE)
{
mInputToGLStatesMap[pParam->getName()] = "gl_Position";
}
else
{
// After GLSL 1.20 varying is deprecated
if(mGLSLVersion <= 120)
{
os << "varying\t";
}
else
{
os << "out\t";
}
os << mGpuConstTypeMap[pParam->getType()];
os << "\t";
os << pParam->getName();
if (pParam->isArray() == true)
{
os << "[" << pParam->getSize() << "]";
}
os << ";" << std::endl;
}
}
else if(gpuType == GPT_FRAGMENT_PROGRAM &&
pParam->getSemantic() == Parameter::SPS_COLOR)
{
// GLSL fragment program has to write always gl_FragColor (but this is also deprecated after version 130)
// Always add gl_FragColor as an output. The name is for compatibility.
if(mGLSLVersion <= 130)
{
mInputToGLStatesMap[pParam->getName()] = "gl_FragColor";
}
else
{
os << "out vec4 fragColour;" << std::endl;
mInputToGLStatesMap[pParam->getName()] = "fragColour";
}
}
}
if(gpuType == GPT_VERTEX_PROGRAM)
{
// Special case where gl_Position needs to be redeclared
if(Root::getSingleton().getRenderSystem()->getCapabilities()->hasCapability(RSC_SEPARATE_SHADER_OBJECTS) &&
mGLSLVersion >= 150)
{
os << "out gl_PerVertex\n{\nvec4 gl_Position;\nfloat gl_PointSize;\nfloat gl_ClipDistance[];\n};\n" << std::endl;
}
}
}