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:
parent
1265abd4a0
commit
bbcc2afa61
@ -42,6 +42,10 @@ LightNode::LightNode(scene::ISceneManager* mgr, scene::ISceneNode* parent, float
|
||||
m_color[0] = r;
|
||||
m_color[1] = g;
|
||||
m_color[2] = b;
|
||||
|
||||
#ifdef __LIGHT_NODE_VISUALISATION__
|
||||
m_viz_added = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
LightNode::~LightNode()
|
||||
@ -94,4 +98,13 @@ void LightNode::renderLightSet(const std::vector<float> &positions, const std::v
|
||||
|
||||
void LightNode::OnRegisterSceneNode()
|
||||
{ // 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
|
||||
}
|
||||
|
@ -30,9 +30,15 @@ namespace irr
|
||||
namespace scene { class IMesh; }
|
||||
}
|
||||
|
||||
//#define __LIGHT_NODE_VISUALISATION__
|
||||
|
||||
// The actual node
|
||||
class LightNode: public scene::ISceneNode
|
||||
{
|
||||
#ifdef __LIGHT_NODE_VISUALISATION__
|
||||
bool m_viz_added;
|
||||
#endif
|
||||
|
||||
public:
|
||||
LightNode(scene::ISceneManager* mgr, scene::ISceneNode* parent, float energy, float r, float g, float b);
|
||||
virtual ~LightNode();
|
||||
|
@ -706,7 +706,7 @@ void IrrDriver::renderLights(const core::aabbox3df& cambox,
|
||||
m_lights[i]->render();
|
||||
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);
|
||||
if (idx > 14)
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user