Fix fog wrt LOD nodes
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8633 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
773acfac41
commit
0a41c5fff8
@ -1274,9 +1274,11 @@ void Track::loadTrackModel(World* parent, unsigned int mode_id)
|
||||
{
|
||||
const unsigned int count = m_all_nodes.size();
|
||||
for(unsigned int i=0; i<count; i++)
|
||||
m_all_nodes[i]->setMaterialFlag(video::EMF_FOG_ENABLE, true);
|
||||
{
|
||||
adjustForFog(m_all_nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
m_track_object_manager->enableFog(m_use_fog);
|
||||
|
||||
// Sky dome and boxes support
|
||||
// --------------------------
|
||||
@ -1365,6 +1367,15 @@ void Track::loadTrackModel(World* parent, unsigned int mode_id)
|
||||
void Track::adjustForFog(scene::ISceneNode *node)
|
||||
{
|
||||
node->setMaterialFlag(video::EMF_FOG_ENABLE, m_use_fog);
|
||||
|
||||
if (node->getType() == scene::ESNT_LOD_NODE)
|
||||
{
|
||||
std::vector<scene::ISceneNode*>& subnodes = ((LODNode*)node)->getAllNodes();
|
||||
for (unsigned int n=0; n<subnodes.size(); n++)
|
||||
{
|
||||
subnodes[n]->setMaterialFlag(video::EMF_FOG_ENABLE, true);
|
||||
}
|
||||
}
|
||||
} // adjustForFog
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -86,6 +86,8 @@ public:
|
||||
* e.g. be overwritten by physical objects etc. */
|
||||
virtual void handleExplosion(const Vec3& pos, bool directHit) {};
|
||||
void setEnable(bool mode);
|
||||
|
||||
scene::ISceneNode* getNode() { return m_node; }
|
||||
}; // TrackObject
|
||||
|
||||
#endif
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "config/user_config.hpp"
|
||||
#include "animations/billboard_animation.hpp"
|
||||
#include "animations/three_d_animation.hpp"
|
||||
#include "graphics/lod_node.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
#include "physics/physical_object.hpp"
|
||||
#include "tracks/track_object.hpp"
|
||||
@ -120,3 +121,21 @@ void TrackObjectManager::update(float dt)
|
||||
} // update
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void TrackObjectManager::enableFog(bool enable)
|
||||
{
|
||||
const unsigned int count = m_all_objects.size();
|
||||
for(unsigned int i=0; i<count; i++)
|
||||
{
|
||||
m_all_objects[i]->getNode()->setMaterialFlag(video::EMF_FOG_ENABLE, true);
|
||||
|
||||
if (m_all_objects[i]->getNode()->getType() == scene::ESNT_LOD_NODE)
|
||||
{
|
||||
std::vector<scene::ISceneNode*>& nodes = ((LODNode*)m_all_objects[i]->getNode())->getAllNodes();
|
||||
for (unsigned int n=0; n<nodes.size(); n++)
|
||||
{
|
||||
nodes[n]->setMaterialFlag(video::EMF_FOG_ENABLE, enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,10 @@ public:
|
||||
void handleExplosion(const Vec3 &pos, const PhysicalObject *mp) const;
|
||||
void reset();
|
||||
void init();
|
||||
|
||||
/** Enable or disable fog on objects */
|
||||
void enableFog(bool enable);
|
||||
|
||||
}; // class TrackObjectManager
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user