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

Function SetupMaterialSlots

Source/Engine/ContentImporters/ImportModel.cpp:178–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void SetupMaterialSlots(ModelData& data, const Array<MaterialSlotEntry>& materials)
179{
180 Array<int32> materialSlotsTable;
181 materialSlotsTable.Resize(materials.Count());
182 materialSlotsTable.SetAll(-1);
183 for (auto& lod : data.LODs)
184 {
185 for (MeshData* mesh : lod.Meshes)
186 {
187 int32 newSlotIndex = materialSlotsTable[mesh->MaterialSlotIndex];
188 if (newSlotIndex == -1)
189 {
190 newSlotIndex = data.Materials.Count();
191 data.Materials.AddOne() = materials[mesh->MaterialSlotIndex];
192 }
193 mesh->MaterialSlotIndex = newSlotIndex;
194 }
195 }
196}
197
198bool SortMeshGroups(IGrouping<StringView, MeshData*> const& i1, IGrouping<StringView, MeshData*> const& i2)
199{

Callers 3

ImportMethod · 0.85
SetupMaterialSlotsMethod · 0.85
SetupMaterialSlotsMethod · 0.85

Calls 4

AddOneMethod · 0.80
ResizeMethod · 0.45
CountMethod · 0.45
SetAllMethod · 0.45

Tested by

no test coverage detected