MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ImportTexture

Function ImportTexture

Source/Engine/Tools/ModelTool/ModelTool.Assimp.cpp:443–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

441}
442
443bool 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
468bool ImportMaterialTexture(ModelData& result, AssimpImporterData& data, const aiMaterial* aMaterial, aiTextureType aTextureType, int32& textureIndex, TextureEntry::TypeHint type, bool sRGB = false)
469{

Callers 1

HasAlphaMethod · 0.50

Calls 5

TrimTrailingMethod · 0.80
C_StrMethod · 0.80
AddOneMethod · 0.80
StringClass · 0.50
CountMethod · 0.45

Tested by

no test coverage detected