Do not let OSG cull lights away

This commit is contained in:
Fernando García Liñán
2020-12-23 12:44:06 +01:00
parent a84133e945
commit 0f482c14dd
2 changed files with 6 additions and 7 deletions

View File

@@ -55,14 +55,10 @@ CullVisitor* EffectCullVisitor::clone() const
void EffectCullVisitor::apply(osg::Node &node)
{
// TODO: Properly cull lights outside the viewport (override computeBounds())
// if (isCulled(node))
// return;
CullVisitor::apply(node);
SGLight *light = dynamic_cast<SGLight *>(&node);
if (!light) {
CullVisitor::apply(node);
return;
}
_lightList.push_back(light);
if (light)
_lightList.push_back(light);
}
void EffectCullVisitor::apply(osg::Geode& node)

View File

@@ -165,6 +165,9 @@ SGLight::SGLight() :
_quadratic_attenuation = 0.0f;
_spot_exponent = 0.0f;
_spot_cutoff = 180.0f;
// Do not let OSG cull lights by default, we usually leave that job to
// other algorithms, like clustered shading.
setCullingActive(false);
}
SGLight::~SGLight()