diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index eee7c1efc..d93b38c6a 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -1008,12 +1008,14 @@ IrrDriver::RTTProvider::~RTTProvider() */ void IrrDriver::RTTProvider::setupRTTScene(ptr_vector& mesh, std::vector& mesh_location, + std::vector& mesh_scale, const std::vector& model_frames) { if (model_frames[0] == -1) { scene::ISceneNode* node = irr_driver->getSceneManager()->addMeshSceneNode(mesh.get(0), NULL); node->setPosition( mesh_location[0].toIrrVector() ); + node->setScale( mesh_scale[0].toIrrVector() ); m_rtt_main_node = node; } else @@ -1022,11 +1024,11 @@ void IrrDriver::RTTProvider::setupRTTScene(ptr_vector& mesh, node->setPosition( mesh_location[0].toIrrVector() ); node->setFrameLoop(model_frames[0], model_frames[0]); node->setAnimationSpeed(0); + node->setScale( mesh_scale[0].toIrrVector() ); m_rtt_main_node = node; - //std::cout << "(((( set frame " << model_frames[0] << " ))))\n"; } - + assert(m_rtt_main_node != NULL); assert(mesh.size() == (int)mesh_location.size()); assert(mesh.size() == (int)model_frames.size()); @@ -1039,6 +1041,7 @@ void IrrDriver::RTTProvider::setupRTTScene(ptr_vector& mesh, scene::ISceneNode* node = irr_driver->getSceneManager()->addMeshSceneNode(mesh.get(n), m_rtt_main_node); node->setPosition( mesh_location[n].toIrrVector() ); node->updateAbsolutePosition(); + node->setScale( mesh_scale[n].toIrrVector() ); } else { @@ -1047,15 +1050,11 @@ void IrrDriver::RTTProvider::setupRTTScene(ptr_vector& mesh, node->setFrameLoop(model_frames[n], model_frames[n]); node->setAnimationSpeed(0); node->updateAbsolutePosition(); + node->setScale( mesh_scale[n].toIrrVector() ); //std::cout << "(((( set frame " << model_frames[n] << " ))))\n"; } } - - m_rtt_main_node->setScale( core::vector3df(35.0f, 35.0f, 35.0f) ); - - //vector3d< f32 > modelsize = mesh->getBoundingBox().getExtent(); - //std::cout << "box size " << modelsize.X*50.0 << ", " << modelsize.Y*50.0 << ", " << modelsize.Z*50.0 << std::endl; - + irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 120, 120, 120)); const core::vector3df &sun_pos = core::vector3df( 0, 200, 100.0f ); diff --git a/src/graphics/irr_driver.hpp b/src/graphics/irr_driver.hpp index 36769be89..473239e90 100644 --- a/src/graphics/irr_driver.hpp +++ b/src/graphics/irr_driver.hpp @@ -205,6 +205,7 @@ public: */ void setupRTTScene(ptr_vector& mesh, std::vector& mesh_location, + std::vector& mesh_scale, const std::vector& model_frames); /** Optional 'angle' parameter will rotate the object added *through setupRTTScene* */ diff --git a/src/guiengine/widgets/model_view_widget.cpp b/src/guiengine/widgets/model_view_widget.cpp index 77a8f9d62..5aa321e4a 100644 --- a/src/guiengine/widgets/model_view_widget.cpp +++ b/src/guiengine/widgets/model_view_widget.cpp @@ -67,18 +67,21 @@ void ModelViewWidget::clearModels() { m_models.clearWithoutDeleting(); m_model_location.clear(); + m_model_scale.clear(); m_model_frames.clear(); delete m_rtt_provider; m_rtt_provider = NULL; } // ----------------------------------------------------------------------------- -void ModelViewWidget::addModel(irr::scene::IMesh* mesh, const Vec3& location, const int frame) +void ModelViewWidget::addModel(irr::scene::IMesh* mesh, const Vec3& location, + const Vec3& scale, const int frame) { if(!mesh) return; - + m_models.push_back(mesh); m_model_location.push_back(location); + m_model_scale.push_back(scale); m_model_frames.push_back(frame); /* @@ -148,7 +151,7 @@ void ModelViewWidget::update(float delta) std::string name = "model view "; name += m_properties[PROP_ID].c_str(); m_rtt_provider = new IrrDriver::RTTProvider(core::dimension2d< u32 >(512, 512), name ); - m_rtt_provider->setupRTTScene(m_models, m_model_location, m_model_frames); + m_rtt_provider->setupRTTScene(m_models, m_model_location, m_model_scale, m_model_frames); } m_texture = m_rtt_provider->renderToTexture(angle); diff --git a/src/guiengine/widgets/model_view_widget.hpp b/src/guiengine/widgets/model_view_widget.hpp index 4557879f1..211f7061d 100644 --- a/src/guiengine/widgets/model_view_widget.hpp +++ b/src/guiengine/widgets/model_view_widget.hpp @@ -45,6 +45,7 @@ namespace GUIEngine ptr_vector m_models; std::vector m_model_location; + std::vector m_model_scale; std::vector m_model_frames; video::ITexture* m_texture; @@ -62,7 +63,11 @@ namespace GUIEngine void add(); void clearModels(); - void addModel(irr::scene::IMesh* mesh, const Vec3& location = Vec3(0,0,0), const int frame=-1); + void addModel(irr::scene::IMesh* mesh, + const Vec3& location = Vec3(0,0,0), + const Vec3& scale = Vec3(1,1,1), + const int frame=-1); + void update(float delta); /** Disables any model rotation */ diff --git a/src/states_screens/kart_selection.cpp b/src/states_screens/kart_selection.cpp index 8a558964d..f020e77b2 100644 --- a/src/states_screens/kart_selection.cpp +++ b/src/states_screens/kart_selection.cpp @@ -786,10 +786,19 @@ public: // Random kart scene::IMesh* model = item_manager->getItemModel(Item::ITEM_BONUS_BOX); w3->clearModels(); - w3->addModel( model, Vec3(0.0f, -12.0f, 0.0f) ); + w3->addModel( model, Vec3(0.0f, -12.0f, 0.0f), Vec3(35.0f, 35.0f, 35.0f) ); w3->update(0); m_parent->m_kart_widgets[playerID].m_kart_name->setText( _("Random Kart") ); } + else if (selectionID == "locked") + { + w3->clearModels(); + w3->addModel(irr_driver->getAnimatedMesh( file_manager->getDataDir() + "/models/chest.b3d" )->getMesh(20), + Vec3(0,0,0), Vec3(15.0f, 15.0f, 15.0f) ); + w3->update(0); + + m_parent->m_kart_widgets[playerID].m_kart_name->setText( _("Locked : solve active challenges to gain access to more!") ); + } else { //printf("%s\n", selectionID.c_str()); @@ -799,7 +808,7 @@ public: const KartModel &kart_model = kp->getMasterKartModel(); w3->clearModels(); - w3->addModel( kart_model.getModel(), Vec3(0,0,0), + w3->addModel( kart_model.getModel(), Vec3(0,0,0), Vec3(35.0f, 35.0f, 35.0f), kart_model.getBaseFrame() ); w3->addModel( kart_model.getWheelModel(0), kart_model.getWheelGraphicsPosition(0) );