MCPcopy Create free account
hub / github.com/axmolengine/axmol / createWithFilename

Method createWithFilename

core/3d/MeshMaterial.cpp:286–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286MeshMaterial* MeshMaterial::createWithFilename(std::string_view path)
287{
288 auto validfilename = FileUtils::getInstance()->fullPathForFilename(path);
289 if (!validfilename.empty())
290 {
291 auto it = _materials.find(validfilename);
292 if (it != _materials.end())
293 return (MeshMaterial*)it->second->clone();
294
295 auto material = new MeshMaterial();
296 if (material->initWithFile(path))
297 {
298 material->_type = MeshMaterial::MaterialType::CUSTOM;
299 _materials[validfilename] = material;
300
301 return (MeshMaterial*)material->clone();
302 }
303 AX_SAFE_DELETE(material);
304 }
305 return nullptr;
306}
307
308MeshMaterial* MeshMaterial::createWithProgramState(backend::ProgramState* programState)
309{

Callers

nothing calls this directly

Calls 7

getInstanceFunction · 0.85
fullPathForFilenameMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
cloneMethod · 0.45
initWithFileMethod · 0.45

Tested by

no test coverage detected