MaterialComponent struct in Thread
Per-entity material binding. Holds one entry per submesh material slot on
the associated MeshComponent — slot index matches
aiMesh::mMaterialIndex from the source FBX.
MaterialSlot fields
| Name | std::string | Display name (taken from Assimp material name). |
| AssetPath | std::string | Path to a .tmaterial file. Empty = default white. |
| Instance | std::shared_ptr<Material> | Loaded material with Albedo / TextureData / Tiling. |
MaterialComponent methods
| GetInstance(slotIdx) | std::shared_ptr<Material> | Material for the given submesh slot. Falls back to slot 0 when out of range. |
Properties
| Slots | std::vector<MaterialSlot> | Auto-padded by the inspector to match Mesh::GetMaterialSlotCount(). |
Example
auto& mc = e.AddComponent<Thread::MaterialComponent>();
Thread::MaterialSlot slot;
slot.AssetPath = "assets/materials/wood.tmaterial";
slot.Instance = std::make_shared<Thread::Material>();
slot.Instance->Load(slot.AssetPath);
mc.Slots.push_back(std::move(slot));
MaterialComponent struct w Thread
Przypisanie materiałów do encji. Ma jeden wpis na slot materiału podsiatki w powiązanym
MeshComponent — indeks slotu odpowiada
aiMesh::mMaterialIndex z pliku źródłowego FBX.
Pola MaterialSlot
| Name | std::string | Nazwa wyświetlana (z nazwy materiału w Assimp). |
| AssetPath | std::string | Ścieżka do pliku .tmaterial. Pusta = domyślny biały. |
| Instance | std::shared_ptr<Material> | Wczytany materiał z Albedo / TextureData / Tiling. |
Metody MaterialComponent
| GetInstance(slotIdx) | std::shared_ptr<Material> | Materiał dla danego slotu podsiatki. Poza zakresem zwraca slot 0. |
Właściwości
| Slots | std::vector<MaterialSlot> | Inspektor sam uzupełnia do Mesh::GetMaterialSlotCount(). |
Przykład
auto& mc = e.AddComponent<Thread::MaterialComponent>();
Thread::MaterialSlot slot;
slot.AssetPath = "assets/materials/wood.tmaterial";
slot.Instance = std::make_shared<Thread::Material>();
slot.Instance->Load(slot.AssetPath);
mc.Slots.push_back(std::move(slot));