int WINAPI QERApp_LoadShadersFromDir (const char* path) { int count = 0; // scan g_Shaders, and call QERApp_Shader_ForName for each in the given path // this will load the texture if needed and will set it in use.. int nSize = g_Shaders.GetSize(); for (int i = 0; i < nSize; i++) { CShader *pShader = reinterpret_cast<CShader*>(g_Shaders.ElementAt(i)); if (strstr(pShader->getShaderFileName(), path) || strstr(pShader->getName(), path)) { count++; // request the shader, this will load the texture if needed and set "inuse" //++timo FIXME: should we put an Activate member on CShader? // this QERApp_Shader_ForName call is a kind of hack IShader *pFoo = QERApp_Shader_ForName(pShader->getName()); #ifdef _DEBUG // check we activated the right shader // NOTE: if there was something else loaded, the size of g_Shaders may have changed and strange behaviours are to be expected if (pFoo != pShader) Sys_Printf("WARNING: unexpected pFoo != pShader in QERApp_LoadShadersFromDir\n"); #endif } } return count; }
int WINAPI QERApp_GetActiveShaderCount () { return g_ActiveShaders.GetSize(); }