本文整理汇总了C++中CShader::Parse方法的典型用法代码示例。如果您正苦于以下问题:C++ CShader::Parse方法的具体用法?C++ CShader::Parse怎么用?C++ CShader::Parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CShader
的用法示例。
在下文中一共展示了CShader::Parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QERApp_LoadShaderFile
void WINAPI QERApp_LoadShaderFile (const char* filename)
{
char* pBuff = NULL;
int nSize = LoadFile(filename, reinterpret_cast<void**>(&pBuff));
if (nSize == -1)
nSize = PakLoadAnyFile(filename, reinterpret_cast<void**>(&pBuff));
if (nSize > 0)
{
Sys_Printf("Parsing shaderfile %s\n", filename);
StartTokenParsing(pBuff);
while (GetToken(true))
{
// first token should be the path + name.. (from base)
CShader *pShader = new CShader();
// we want the relative filename only, it's easier for later lookup .. see QERApp_ReloadShaderFile
char cTmp[1024];
QE_ConvertDOSToUnixName( cTmp, filename );
pShader->setShaderFileName( filename + strlen(ValueForKey(g_qeglobals.d_project_entity, "basepath")) + 1);
if (pShader->Parse())
{
// do we already have this shader?
//++timo NOTE: this may a bit slow, we may need to use a map instead of a dumb list
if (g_Shaders.Shader_ForName( pShader->getName() ) != NULL)
{
Sys_Printf( "WARNING: shader %s is already in memory, definition in %s ignored.\n", pShader->getName(), filename );
delete pShader;
}
else
{
pShader->IncRef();
g_Shaders.Add( (LPVOID)pShader );
int n = g_PrefsDlg.m_nShader;
if ((g_PrefsDlg.m_nShader == CPrefsDlg::SHADER_ALL) || (g_PrefsDlg.m_nShader == CPrefsDlg::SHADER_COMMON && strstr(pShader->getName(), "common" )))
// load the qtexture and display in tex wnd
pShader->Activate();
}
}
else
{
Sys_Printf("Error parsing shader %s\n", pShader->getName());
delete pShader;
}
}
free (pBuff);
}
else
{
Sys_Printf("Unabled to read shaderfile %s\n", filename);
}
}
示例2: QERApp_LoadShaderFile
void WINAPI QERApp_LoadShaderFile (const char *filename)
{
char *pBuff;
int nSize = vfsLoadFile (filename, reinterpret_cast < void **>(&pBuff), 0);
if (nSize > 0)
{
Sys_Printf ("Parsing shaderfile %s\n", filename);
g_ScripLibTable.m_pfnStartTokenParsing (pBuff);
while (g_ScripLibTable.m_pfnGetToken (true))
{
// first token should be the path + name.. (from base)
CShader *pShader = new CShader ();
// we want the relative filename only, it's easier for later lookup .. see QERApp_ReloadShaderFile
char cTmp[1024];
g_FuncTable.m_pfnQE_ConvertDOSToUnixName (cTmp, filename);
// given the vfs, we should not store the full path
//pShader->setShaderFileName( filename + strlen(ValueForKey(g_qeglobals.d_project_entity, "basepath")));
pShader->setShaderFileName (filename);
if (pShader->Parse ())
{
// do we already have this shader?
//++timo NOTE: this may a bit slow, we may need to use a map instead of a dumb list
if (g_Shaders.Shader_ForName (pShader->getName ()) != NULL)
{
#ifdef _DEBUG
Sys_Printf ("WARNING: shader %s is already in memory, definition in %s ignored.\n",
pShader->getName (), filename);
#endif
delete pShader;
}
else
{
pShader->IncRef ();
g_Shaders.Add ((void *) pShader);
}
}
else
{
Sys_Printf ("Error parsing shader %s\n", pShader->getName ());
delete pShader;
}
}
vfsFreeFile (pBuff);
}
else
{
Sys_Printf ("Unable to read shaderfile %s\n", filename);
}
}