Extend RTTI provider to not hardcode scaling of meshes + fix warnings when hovering locked karts + when hovering locked kart, display locked feature chest
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7463 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
e7f5badbd1
commit
cf751ab11a
@ -1008,12 +1008,14 @@ IrrDriver::RTTProvider::~RTTProvider()
|
||||
*/
|
||||
void IrrDriver::RTTProvider::setupRTTScene(ptr_vector<scene::IMesh, REF>& mesh,
|
||||
std::vector<Vec3>& mesh_location,
|
||||
std::vector<Vec3>& mesh_scale,
|
||||
const std::vector<int>& 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<scene::IMesh, REF>& 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<scene::IMesh, REF>& 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<scene::IMesh, REF>& 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 );
|
||||
|
@ -205,6 +205,7 @@ public:
|
||||
*/
|
||||
void setupRTTScene(ptr_vector<scene::IMesh, REF>& mesh,
|
||||
std::vector<Vec3>& mesh_location,
|
||||
std::vector<Vec3>& mesh_scale,
|
||||
const std::vector<int>& model_frames);
|
||||
|
||||
/** Optional 'angle' parameter will rotate the object added *through setupRTTScene* */
|
||||
|
@ -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);
|
||||
|
@ -45,6 +45,7 @@ namespace GUIEngine
|
||||
|
||||
ptr_vector<scene::IMesh, REF> m_models;
|
||||
std::vector<Vec3> m_model_location;
|
||||
std::vector<Vec3> m_model_scale;
|
||||
std::vector<int> 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 */
|
||||
|
@ -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) );
|
||||
|
Loading…
Reference in New Issue
Block a user