MCPcopy Create free account
hub / github.com/beefytech/Beef / LoadMaterial

Method LoadMaterial

BeefySysLib/gfx/glTF.cpp:483–516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481}
482
483ModelMaterialDef* GLTFReader::LoadMaterial(const StringImpl& relPath)
484{
485 String propsPath;
486 if (relPath.StartsWith('/'))
487 {
488 propsPath = mRootDir + relPath;
489 int dotPos = (int)propsPath.LastIndexOf('.');
490 if (dotPos > 0)
491 propsPath.RemoveToEnd(dotPos);
492 propsPath += ".props.txt";
493 }
494 else if (mBasePathName.Contains("staticmesh"))
495 propsPath = GetFileDir(mBasePathName) + "/" + relPath + ".props.txt";
496 else
497 propsPath = GetFileDir(mBasePathName) + "/materials/" + relPath + ".props.txt";
498
499 ModelMaterialDef* materialDef = ModelMaterialDef::CreateOrGet("GLTF", propsPath);
500
501 if (materialDef->mInitialized)
502 return materialDef;
503
504 materialDef->mInitialized = true;
505
506 String propText;
507 if (LoadTextData(propsPath, propText))
508 {
509 if (!ParseMaterialDef(materialDef, propText))
510 {
511 // Had error
512 }
513
514 }
515 return materialDef;
516}
517
518bool GLTFReader::LoadModelProps(const StringImpl& propsPath)
519{

Callers

nothing calls this directly

Calls 4

StartsWithMethod · 0.45
LastIndexOfMethod · 0.45
RemoveToEndMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected