| 176 | } |
| 177 | |
| 178 | void 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 | |
| 198 | bool SortMeshGroups(IGrouping<StringView, MeshData*> const& i1, IGrouping<StringView, MeshData*> const& i2) |
| 199 | { |
no test coverage detected