本文整理汇总了C++中CShader::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ CShader::SetName方法的具体用法?C++ CShader::SetName怎么用?C++ CShader::SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CShader
的用法示例。
在下文中一共展示了CShader::SetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse
//.........这里部分代码省略.........
{
LOG.Write("\nCShader::Parse(): Error initializing parser for shader %s.", strShaderName.data());
return NULL;
}
parser.ResetPos();
bool bFound = false;
std::string strName, strType, strShaderText;
// Search for the requested shader.
LOG.Write("\n Searching for shader.");
while(!bFound)
{
// Find a shader
if(parser.Find("#Shader", CParser::SEARCH_FROMCURPOS) == -1)
{
LOG.Write("\nCShader::Parse(): Shader %s not found.", strShaderName.data());
return NULL;
}
// Read its name
if(!parser.ReadKeyString("#Name", '=', &strName, CParser::SEARCH_INCURLINE))
{
LOG.Write("\nWARNING - CShader::Parse(): Name field not found parsing a shader. Name must be in the same line.");
continue;
}
if(strName == strShaderName)
{
if(!parser.ReadKeyRaw("#Type", '=', &strType, CParser::SEARCH_INCURLINE))
{
LOG.Write("\nCShader::Parse(): Error reading shader %s'type (was searching for %s). Type before name?", strName.data(), strShaderName.data());
return NULL;
}
// Read shader content
if(!parser.ReadStringBetweenChars('{', '}', &strShaderText, CParser::SEARCH_FROMCURPOS, true))
{
LOG.Write("\nCShader::Parse(): Error reading shader %s's content (was searching for %s).", strName.data(), strShaderName.data());
return NULL;
}
bFound = true;
}
}
if(bFound)
{
LOG.Write("\n Found, parsing.");
// Instance correct shader class based on strType.
CInputMemory inputMemory;
if(!inputMemory.Open((void *)strShaderText.data(), strShaderText.length()))
{
LOG.Write("\nCShader::Parse(): Error on CInputMemory::Open() to parse shader text.");
return NULL;
}
// Switch-case like:
CShader* pShader = NULL;
if(!stricmp(strType.data(), "Standard"))
{
pShader = new CShaderStandard;
}
else
{
LOG.Write("\nCShader::Parse(): Unknown shader type (%s) reading shader %s", strType.data(), strShaderName.data());
return NULL;
}
assert(pShader);
pShader->SetName(strName);
if(!pShader->ParseShader(&inputMemory))
{
LOG.Write(" Error!");
delete pShader;
return NULL;
}
LOG.Write("\nShader loaded.");
return pShader;
}
LOG.Write("\nShader not found!");
return NULL;
}