From 6a4e46af5cdea27abb1fe06851f65402dcbc042c Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Tue, 17 Jun 2014 18:13:40 -0400 Subject: [PATCH] Fix more issues on feature unlocked screen --- src/states_screens/feature_unlocked.cpp | 32 +++++++++++++++++++++---- src/states_screens/feature_unlocked.hpp | 3 +++ 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/states_screens/feature_unlocked.cpp b/src/states_screens/feature_unlocked.cpp index ab7c2df9f..2fc48313d 100644 --- a/src/states_screens/feature_unlocked.cpp +++ b/src/states_screens/feature_unlocked.cpp @@ -319,7 +319,7 @@ void FeatureUnlockedCutScene::init() else if (!m_unlocked_stuff[n].m_pictures.empty()) { video::SMaterial m; - m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; + //m.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL; m.BackfaceCulling = false; m.setTexture(0, m_unlocked_stuff[n].m_pictures[0]); m.AmbientColor = video::SColor(255, 255, 255, 255); @@ -335,8 +335,16 @@ void FeatureUnlockedCutScene::init() irr_driver->createTexturedQuadMesh(&m, m_unlocked_stuff[n].m_w, m_unlocked_stuff[n].m_h); - m_unlocked_stuff[n].m_root_gift_node = irr_driver->addMesh(mesh); - mesh->drop(); + m_unlocked_stuff[n].m_root_gift_node = irr_driver->getSceneManager()->addEmptySceneNode(); + m_unlocked_stuff[n].m_side_1 = irr_driver->addMesh(mesh, m_unlocked_stuff[n].m_root_gift_node); + //mesh->drop(); + + mesh = irr_driver->createTexturedQuadMesh(&m, + m_unlocked_stuff[n].m_w, + m_unlocked_stuff[n].m_h); + m_unlocked_stuff[n].m_side_2 = irr_driver->addMesh(mesh, m_unlocked_stuff[n].m_root_gift_node); + m_unlocked_stuff[n].m_side_2->setRotation(core::vector3df(0.0f, 180.0f, 0.0f)); + //mesh->drop(); #ifdef DEBUG m_unlocked_stuff[n].m_root_gift_node->setName("unlocked track picture"); #endif @@ -432,7 +440,7 @@ void FeatureUnlockedCutScene::onUpdate(float dt) if (textureID != previousTextureID) { scene::IMeshSceneNode* node = (scene::IMeshSceneNode*)m_unlocked_stuff[n].m_root_gift_node; - scene::IMesh* mesh = node->getMesh(); + scene::IMesh* mesh = m_unlocked_stuff[n].m_side_1->getMesh(); assert(mesh->getMeshBufferCount() == 1); @@ -443,7 +451,21 @@ void FeatureUnlockedCutScene::onUpdate(float dt) // FIXME: this mesh is already associated with this node. I'm calling this // to force irrLicht to refresh the display, now that Material has changed. - node->setMesh(mesh); + m_unlocked_stuff[n].m_side_1->setMesh(mesh); + + m_unlocked_stuff[n].m_curr_image = textureID; + + + mesh = m_unlocked_stuff[n].m_side_2->getMesh(); + assert(mesh->getMeshBufferCount() == 1); + mb = mesh->getMeshBuffer(0); + + SMaterial& m2 = mb->getMaterial(); + m2.setTexture(0, m_unlocked_stuff[n].m_pictures[textureID]); + + // FIXME: this mesh is already associated with this node. I'm calling this + // to force irrLicht to refresh the display, now that Material has changed. + m_unlocked_stuff[n].m_side_2->setMesh(mesh); m_unlocked_stuff[n].m_curr_image = textureID; } // textureID != previousTextureID diff --git a/src/states_screens/feature_unlocked.hpp b/src/states_screens/feature_unlocked.hpp index 5ac512e53..70589ab05 100644 --- a/src/states_screens/feature_unlocked.hpp +++ b/src/states_screens/feature_unlocked.hpp @@ -60,6 +60,9 @@ class FeatureUnlockedCutScene : public GUIEngine::CutsceneScreen, public GUIEngi /** Contains whatever is in the chest */ scene::ISceneNode* m_root_gift_node; + scene::IMeshSceneNode* m_side_1; + scene::IMeshSceneNode* m_side_2; + float m_scale; irr::core::stringw m_unlock_message;