Fix more issues on feature unlocked screen

This commit is contained in:
Marianne Gagnon 2014-06-17 18:13:40 -04:00
parent bc83bb1339
commit 6a4e46af5c
2 changed files with 30 additions and 5 deletions

View File

@ -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

View File

@ -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;