Added support for ReferenceFrame into osg::LightSource, modified the .osg

plugin and cull visitor to account for this change.
This commit is contained in:
Robert Osfield
2003-01-16 16:37:24 +00:00
parent a0e5b9b007
commit 4dd273de70
7 changed files with 118 additions and 31 deletions

View File

@@ -3,7 +3,8 @@
using namespace osg;
LightSource::LightSource():
_value(StateAttribute::ON)
_value(StateAttribute::ON),
_referenceFrame(RELATIVE_TO_PARENTS)
{
// switch off culling of light source nodes by default.
setCullingActive(false);
@@ -17,6 +18,11 @@ LightSource::~LightSource()
// ref_ptr<> automactially decrements the reference count of attached lights.
}
void LightSource::setReferenceFrame(ReferenceFrame rf)
{
_referenceFrame = rf;
setCullingActive(_referenceFrame==RELATIVE_TO_PARENTS);
}
void LightSource::setLight(StateAttribute* light)
{
@@ -44,7 +50,7 @@ bool LightSource::computeBound() const
{
Group::computeBound();
if (_light.valid())
if (_light.valid() && _referenceFrame==RELATIVE_TO_PARENTS)
{
const Light* light = dynamic_cast<const Light*>(_light.get());
if (light)