本文整理汇总了C++中GpuProgramPtr::setParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ GpuProgramPtr::setParameter方法的具体用法?C++ GpuProgramPtr::setParameter怎么用?C++ GpuProgramPtr::setParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GpuProgramPtr
的用法示例。
在下文中一共展示了GpuProgramPtr::setParameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bindSubShaders
//-----------------------------------------------------------------------------
void GLSLProgramProcessor::bindSubShaders(Program* program, GpuProgramPtr pGpuProgram)
{
if (program->getDependencyCount() > 0)
{
// Get all attached shaders so we do not attach shaders twice.
// maybe GLSLProgram should take care of that ( prevent add duplicate shaders )
String attachedShaders = pGpuProgram->getParameter("attach");
String subShaderDef = "";
for (unsigned int i=0; i < program->getDependencyCount(); ++i)
{
// Here we append _VS and _FS to the library shaders (so max each lib shader
// is compiled twice once as vertex and once as fragment shader)
String subShaderName = program->getDependency(i);
if (program->getType() == GPT_VERTEX_PROGRAM)
{
subShaderName += "_VS";
}
else
{
subShaderName += "_FS";
}
// Check if the library shader already compiled
if(!HighLevelGpuProgramManager::getSingleton().resourceExists(subShaderName))
{
// Create the library shader
HighLevelGpuProgramPtr pSubGpuProgram = HighLevelGpuProgramManager::getSingleton().createProgram(subShaderName,
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TargetLanguage, program->getType());
// Set the source name
String sourceName = program->getDependency(i) + "." + TargetLanguage;
pSubGpuProgram->setSourceFile(sourceName);
pSubGpuProgram->load();
// Prepend the current GLSL version
String versionLine = "#version " + StringConverter::toString(Root::getSingleton().getRenderSystem()->getNativeShadingLanguageVersion()) + "\n";
pSubGpuProgram->setSource(versionLine + pSubGpuProgram->getSource());
// If we have compile errors than stop processing
if (pSubGpuProgram->hasCompileError())
{
OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR,
"Could not compile shader library from the source file: " + sourceName,
"GLSLProgramProcessor::bindSubShaders" );
}
mLibraryPrograms.push_back(subShaderName);
}
// Check if the lib shader already attached to this shader
if (attachedShaders.find(subShaderName) == String::npos)
{
// Append the shader name to subShaders
subShaderDef += subShaderName + " ";
}
}
// Check if we have something to attach
if (subShaderDef.length() > 0)
{
pGpuProgram->setParameter("attach", subShaderDef);
}
}
}