IShader* WINAPI QERApp_Shader_ForName(const char* name) { //++timo FIXME: do we allow NULL and "" calling? // how does it deal with notexture? can we simply replace by "textures/radiant/notex"? if (name == NULL || strlen(name) == 0) { Sys_Printf("FIXME: name == NULL || strlen(name) == 0 in QERApp_Shader_ForName\n"); return QERApp_Shader_ForName("radiant/notex"); //++timo ??? } // entities that should be represented with plain colors instead of textures // request a texture name with (r g b) (it's stored in their class_t) if (name[0]=='(') { return QERApp_ColorShader_ForName(name); } CShader* pShader = static_cast<CShader*>(QERApp_Try_Shader_ForName( name )); if (pShader) { pShader->SetDisplayed( true ); return pShader; } // we don't know this shader, maybe it's a straight texture pShader = new CShader; pShader->CreateDefault( name ); // hook it into the shader list g_Shaders.Add( (LPVOID)pShader ); pShader->IncRef(); // if it can't find the texture, "textures/radiant/notex" will be used pShader->Activate(); pShader->SetDisplayed( true ); return pShader; }
IShader *WINAPI QERApp_Shader_ForName (const char *name) { if (name == NULL || strlen (name) == 0) { // Hydra: This error can occur if the user loaded a map with/dropped an entity that // did not set a texture name "(r g b)" - check the entity definition loader g_FuncTable.m_pfnSysFPrintf (SYS_ERR, "FIXME: name == NULL || strlen(name) == 0 in QERApp_Shader_ForName\n"); return QERApp_Shader_ForName (SHADER_NOT_FOUND); } // entities that should be represented with plain colors instead of textures // request a texture name with (r g b) (it's stored in their class_t) if (name[0] == '(') { return QERApp_ColorShader_ForName (name); } CShader *pShader = static_cast < CShader * >(QERApp_Try_Shader_ForName (name)); if (pShader) { pShader->SetDisplayed (true); return pShader; } return QERApp_CreateShader_ForTextureName (name); }