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

Namestd::stringDisplay name (taken from Assimp material name).
AssetPathstd::stringPath to a .tmaterial file. Empty = default white.
Instancestd::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

Slotsstd::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

Namestd::stringNazwa wyświetlana (z nazwy materiału w Assimp).
AssetPathstd::stringŚcieżka do pliku .tmaterial. Pusta = domyślny biały.
Instancestd::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

Slotsstd::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));