1) Fixed fog - all track nodes are now with fog.

2) Some code cleanup.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5054 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-03-24 10:25:08 +00:00
parent f3f29b9aec
commit 6eecefdec6

View File

@ -471,7 +471,6 @@ bool Track::loadMainTrack(const XMLNode &root)
// This will (at this stage) only convert the main track model. // This will (at this stage) only convert the main track model.
for(unsigned int i=0; i<m_all_meshes.size(); i++) for(unsigned int i=0; i<m_all_meshes.size(); i++)
//for(unsigned int i=0; i<1; i++)
{ {
convertTrackToBullet(m_all_meshes[i], m_all_nodes[i]); convertTrackToBullet(m_all_meshes[i], m_all_nodes[i]);
} }
@ -666,31 +665,6 @@ void Track::loadTrackModel(unsigned int mode_id)
{ {
createWater(*node); createWater(*node);
} }
else if(name=="model")
{
std::string model_name;
node->get("model", &model_name);
std::string full_path = m_root+"/"+model_name;
scene::IMesh *mesh = irr_driver->getAnimatedMesh(full_path);
if(!mesh)
{
fprintf(stderr, "Warning: model '%s' in '%s' not found, aborting.\n",
node->getName().c_str(), model_name.c_str());
exit(-1);
}
mesh->setHardwareMappingHint(scene::EHM_STATIC);
m_all_meshes.push_back(mesh);
scene::ISceneNode *scene_node = irr_driver->addMesh(mesh);
core::vector3df xyz(0,0,0);
node->getXYZ(&xyz);
core::vector3df hpr(0,0,0);
node->getHPR(&hpr);
scene_node->setPosition(xyz);
scene_node->setRotation(hpr);
handleAnimatedTextures(scene_node, *node);
m_all_nodes.push_back(scene_node);
scene_node->setMaterialFlag(video::EMF_LIGHTING, true);
}
else if(name=="banana" || name=="item" || else if(name=="banana" || name=="item" ||
name=="small-nitro" || name=="big-nitro") name=="small-nitro" || name=="big-nitro")
{ {
@ -822,9 +796,13 @@ void Track::loadTrackModel(unsigned int mode_id)
irr_driver->getVideoDriver()->setFog(m_fog_color, video::EFT_FOG_LINEAR, m_fog_start, m_fog_end, m_fog_density); irr_driver->getVideoDriver()->setFog(m_fog_color, video::EFT_FOG_LINEAR, m_fog_start, m_fog_end, m_fog_density);
} }
// Note: the physics world for irrlicht is created in loadMainTrack
createPhysicsModel(main_track_count); createPhysicsModel(main_track_count);
if (UserConfigParams::m_track_debug) m_quad_graph->createDebugMesh(); if (UserConfigParams::m_track_debug) m_quad_graph->createDebugMesh();
// Enable for for all track nodes if fog is used
if(m_use_fog)
for(unsigned int i=0; i<m_all_nodes.size(); i++)
m_all_nodes[i]->setMaterialFlag(video::EMF_FOG_ENABLE, true);
} // loadTrackModel } // loadTrackModel
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------