//----------------------------------------------------------------------------- // Purpose: Factory. Creates a material by name. // Input : pszMaterialName - Name of material, ie "brick/brickfloor01". // Output : Returns a pointer to the new material object, NULL if the given // material did not exist. //----------------------------------------------------------------------------- CMaterial *CMaterial::CreateMaterial(const char *pszMaterialName, bool bLoadImmediately, bool* pFound) { Assert (pszMaterialName); CMaterial *pMaterial = new CMaterial; Assert( pMaterial ); // Store off the material name so we can load it later if we need to Q_snprintf( pMaterial->m_szFileName, MAX_PATH, pszMaterialName ); Q_snprintf( pMaterial->m_szName, MAX_PATH, pszMaterialName ); // // Find the material by name and load it. // if (bLoadImmediately) { bool bFound = pMaterial->LoadMaterial(); // Returns if the material was found or not if (pFound) *pFound = bFound; } return pMaterial; }