This commit is contained in:
h4570
2020-12-07 22:11:21 +01:00
parent 6d9b93998a
commit 5787b6a920
6 changed files with 32 additions and 23 deletions
@@ -20,8 +20,9 @@
/** Calculate square spiral offsets and initialize floors
* @param floorAmount must be a number from square root table
*/
FloorManager::FloorManager(int t_floorAmount)
FloorManager::FloorManager(int t_floorAmount, TextureRepository *t_texRepo)
{
texRepo = t_texRepo;
floorAmount = t_floorAmount;
spirals = new Point[t_floorAmount];
int floorSpiralMaxOffset = (int)Math::sqrt(t_floorAmount);
@@ -84,8 +85,13 @@ void FloorManager::initFloors()
floors[0].mesh.loadObj("meshes/floor/", "floor", 3.0F, false);
floors[0].mesh.shouldBeFrustumCulled = true;
floors[0].mesh.shouldBeLighted = true;
texRepo->addByMesh("meshes/floor/", floors[0].mesh, BMP);
for (u16 i = 1; i < floorAmount; i++)
{
floors[i].init(floors[0].mesh, spirals[i], i);
texRepo->getByMesh(floors[0].mesh.getId(), floors[0].mesh.getMaterial(0).getId())
->addLink(floors[i].mesh.getId(), floors[i].mesh.getMaterial(0).getId());
}
PRINT_LOG("Floors initialized!");
}