Use light absolute position for culling, the relative position was incorrectly used

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14957 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2014-01-07 02:12:17 +00:00
parent 1265abd4a0
commit bbcc2afa61
3 changed files with 20 additions and 1 deletions

View File

@ -42,6 +42,10 @@ LightNode::LightNode(scene::ISceneManager* mgr, scene::ISceneNode* parent, float
m_color[0] = r; m_color[0] = r;
m_color[1] = g; m_color[1] = g;
m_color[2] = b; m_color[2] = b;
#ifdef __LIGHT_NODE_VISUALISATION__
m_viz_added = false;
#endif
} }
LightNode::~LightNode() LightNode::~LightNode()
@ -94,4 +98,13 @@ void LightNode::renderLightSet(const std::vector<float> &positions, const std::v
void LightNode::OnRegisterSceneNode() void LightNode::OnRegisterSceneNode()
{ // This node is only drawn manually. { // This node is only drawn manually.
#ifdef __LIGHT_NODE_VISUALISATION__
if (!m_viz_added)
{
scene::IMeshSceneNode* viz = irr_driver->addSphere(0.5f, video::SColor(255, m_color[0]*255, m_color[1]*255, m_color[2]*255));
viz->setPosition(this->getAbsolutePosition());
m_viz_added = true;
}
#endif
} }

View File

@ -30,9 +30,15 @@ namespace irr
namespace scene { class IMesh; } namespace scene { class IMesh; }
} }
//#define __LIGHT_NODE_VISUALISATION__
// The actual node // The actual node
class LightNode: public scene::ISceneNode class LightNode: public scene::ISceneNode
{ {
#ifdef __LIGHT_NODE_VISUALISATION__
bool m_viz_added;
#endif
public: public:
LightNode(scene::ISceneManager* mgr, scene::ISceneNode* parent, float energy, float r, float g, float b); LightNode(scene::ISceneManager* mgr, scene::ISceneNode* parent, float energy, float r, float g, float b);
virtual ~LightNode(); virtual ~LightNode();

View File

@ -706,7 +706,7 @@ void IrrDriver::renderLights(const core::aabbox3df& cambox,
m_lights[i]->render(); m_lights[i]->render();
continue; continue;
} }
const core::vector3df &lightpos = (m_lights[i]->getPosition() - campos); const core::vector3df &lightpos = (m_lights[i]->getAbsolutePosition() - campos);
unsigned idx = (unsigned)(lightpos.getLength() / 10); unsigned idx = (unsigned)(lightpos.getLength() / 10);
if (idx > 14) if (idx > 14)
continue; continue;