| 441 | } |
| 442 | |
| 443 | bool ImportTexture(ModelData& result, AssimpImporterData& data, aiString& aFilename, int32& textureIndex, TextureEntry::TypeHint type) |
| 444 | { |
| 445 | // Find texture file path |
| 446 | const String filename = String(aFilename.C_Str()).TrimTrailing(); |
| 447 | String path; |
| 448 | if (ModelTool::FindTexture(data.Path, filename, path)) |
| 449 | return true; |
| 450 | |
| 451 | // Check if already used |
| 452 | textureIndex = 0; |
| 453 | while (textureIndex < result.Textures.Count()) |
| 454 | { |
| 455 | if (result.Textures[textureIndex].FilePath == path) |
| 456 | return true; |
| 457 | textureIndex++; |
| 458 | } |
| 459 | |
| 460 | // Import texture |
| 461 | auto& texture = result.Textures.AddOne(); |
| 462 | texture.FilePath = path; |
| 463 | texture.Type = type; |
| 464 | texture.AssetID = Guid::Empty; |
| 465 | return true; |
| 466 | } |
| 467 | |
| 468 | bool ImportMaterialTexture(ModelData& result, AssimpImporterData& data, const aiMaterial* aMaterial, aiTextureType aTextureType, int32& textureIndex, TextureEntry::TypeHint type, bool sRGB = false) |
| 469 | { |