refactored texturelink, loadFrom(), mesh color
This commit is contained in:
@@ -88,8 +88,7 @@ void Dolphin::onInit()
|
||||
water[i].shouldBeFrustumCulled = true;
|
||||
water[i].shouldBeBackfaceCulled = false;
|
||||
water[i].position.set(WATER_TILE_SCALE * 2.0F * spirals[i].x, WATER_LEVEL, WATER_TILE_SCALE * 2.0F * spirals[i].y);
|
||||
texRepo->getByMesh(water[0].getId(), water[0].getMaterial(0).getId())
|
||||
->addLink(water[i].getId(), water[i].getMaterial(0).getId());
|
||||
texRepo->getBySpriteOrMesh(water[0].getMaterial(0).getId())->addLink(water[i].getMaterial(0).getId());
|
||||
waterDrawList[i] = &water[i];
|
||||
}
|
||||
|
||||
@@ -123,8 +122,7 @@ void Dolphin::onInit()
|
||||
oysters[i].mesh.loadFrom(oysters[0].mesh);
|
||||
oysters[i].mesh.shouldBeBackfaceCulled = false;
|
||||
oysters[i].mesh.shouldBeFrustumCulled = false;
|
||||
texRepo->getByMesh(oysters[0].mesh.getId(), oysters[0].mesh.getMaterial(0).getId())
|
||||
->addLink(oysters[i].mesh.getId(), oysters[i].mesh.getMaterial(0).getId());
|
||||
texRepo->getBySpriteOrMesh(oysters[0].mesh.getMaterial(0).getId())->addLink(oysters[i].mesh.getMaterial(0).getId());
|
||||
oysters[i].mesh.position.set(i * -100, 5.0F, i * -100);
|
||||
}
|
||||
|
||||
@@ -141,8 +139,7 @@ void Dolphin::onInit()
|
||||
mines[i].mesh.loadFrom(mines[0].mesh);
|
||||
mines[i].mesh.shouldBeBackfaceCulled = false;
|
||||
mines[i].mesh.shouldBeFrustumCulled = false;
|
||||
texRepo->getByMesh(mines[0].mesh.getId(), mines[0].mesh.getMaterial(0).getId())
|
||||
->addLink(mines[i].mesh.getId(), mines[i].mesh.getMaterial(0).getId());
|
||||
texRepo->getBySpriteOrMesh(mines[0].mesh.getMaterial(0).getId())->addLink(mines[i].mesh.getMaterial(0).getId());
|
||||
mines[i].mesh.position.set(i * -10, 0.0F, i * -68);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,8 +91,7 @@ void FloorManager::initFloors()
|
||||
{
|
||||
floors[i].mesh.shouldBeFrustumCulled = true;
|
||||
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());
|
||||
texRepo->getBySpriteOrMesh(floors[0].mesh.getMaterial(0).getId())->addLink(floors[i].mesh.getMaterial(0).getId());
|
||||
meshes[i] = &floors[i].mesh;
|
||||
}
|
||||
PRINT_LOG("Floors initialized!");
|
||||
@@ -123,18 +122,18 @@ void FloorManager::update(Player &t_player)
|
||||
for (u16 i = 0; i < floorAmount; i++)
|
||||
{
|
||||
floors[i].animate(t_player);
|
||||
|
||||
MeshMaterial *material = &floors[i].mesh.getMaterial(0);
|
||||
if (floors[i].isByAudioTriggered)
|
||||
{
|
||||
floors[i].mesh.color.r = trigColor.r;
|
||||
floors[i].mesh.color.g = trigColor.g;
|
||||
floors[i].mesh.color.b = trigColor.b;
|
||||
material->color.r = trigColor.r;
|
||||
material->color.g = trigColor.g;
|
||||
material->color.b = trigColor.b;
|
||||
}
|
||||
else
|
||||
{
|
||||
floors[i].mesh.color.r = defaultColor.r;
|
||||
floors[i].mesh.color.g = defaultColor.g;
|
||||
floors[i].mesh.color.b = defaultColor.b;
|
||||
material->color.r = defaultColor.r;
|
||||
material->color.g = defaultColor.g;
|
||||
material->color.b = defaultColor.b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,13 +66,13 @@ void Ui::update(const Player &player)
|
||||
if (!isTask1Done && player.getJumpCount() >= 10)
|
||||
{
|
||||
isTask1Done = true;
|
||||
grayCheckboxTex->removeLinkBySprite(task1Checkbox.getId());
|
||||
grayCheckboxTex->removeLinkById(task1Checkbox.getId());
|
||||
blueCheckboxTex->addLink(task1Checkbox.getId());
|
||||
}
|
||||
if (!isTask2Done && player.getKilledEnemiesCount() >= 10)
|
||||
{
|
||||
isTask2Done = true;
|
||||
grayCheckboxTex->removeLinkBySprite(task2Checkbox.getId());
|
||||
grayCheckboxTex->removeLinkById(task2Checkbox.getId());
|
||||
blueCheckboxTex->addLink(task2Checkbox.getId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user