| 15 | namespace |
| 16 | { |
| 17 | void LoadMaterials(Model* model, const ModelParameters& parameters) |
| 18 | { |
| 19 | unsigned int matCount = model->GetMaterialCount(); |
| 20 | |
| 21 | for (unsigned int i = 0; i < matCount; ++i) |
| 22 | { |
| 23 | const ParameterList& matData = model->GetMesh()->GetMaterialData(i); |
| 24 | |
| 25 | String filePath; |
| 26 | if (matData.GetStringParameter(MaterialData::FilePath, &filePath)) |
| 27 | { |
| 28 | if (!File::Exists(filePath)) |
| 29 | { |
| 30 | NazaraWarning("Shader name does not refer to an existing file, \".tga\" is used by default"); |
| 31 | filePath += ".tga"; |
| 32 | } |
| 33 | |
| 34 | MaterialRef material = Material::New(); |
| 35 | if (material->LoadFromFile(filePath, parameters.material)) |
| 36 | model->SetMaterial(i, std::move(material)); |
| 37 | else |
| 38 | NazaraWarning("Failed to load material from file " + String::Number(i)); |
| 39 | } |
| 40 | else |
| 41 | { |
| 42 | MaterialRef material = Material::New(); |
| 43 | material->BuildFromParameters(matData, parameters.material); |
| 44 | |
| 45 | model->SetMaterial(i, std::move(material)); |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | Ternary CheckStatic(Stream& stream, const ModelParameters& parameters) |
| 51 | { |
no test coverage detected