Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::DirectionalLightBase Class Reference

DirectionalLight Base Class.

#include <OSGDirectionalLightBase.h>

Inheritance diagram for osg::DirectionalLightBase:

osg::Light osg::LightBase osg::NodeCore osg::AttachmentContainer osg::FieldContainer osg::DirectionalLight List of all members.

Public Types

typedef DirectionalLightPtr Ptr
enum  { DirectionFieldId = Inherited::NextFieldId, NextFieldId = DirectionFieldId + 1 }

Public Member Functions

FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get
*SFVec3fgetSFDirection (void)
 Get the DirectionalLight::_sfDirection field.
Vec3fgetDirection (void)
 Get the value of the DirectionalLight::_sfDirection field.
const Vec3fgetDirection (void) const
 Get the value of the DirectionalLight::_sfDirection field.
Field Set
*void setDirection (const Vec3f &value)
 Set the value of the DirectionalLight::_sfDirection field.
Binary Access
*virtual UInt32 getBinSize (const BitVector &whichField)
virtual void copyToBin (BinaryDataHandler &pMem, const BitVector &whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField)
Copy
*virtual FieldContainerPtr shallowCopy (void) const

Static Public Member Functions

Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction
*static DirectionalLightPtr create (void)
 create a new instance of the class
static DirectionalLightPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype

Static Public Attributes

static const osg::BitVector DirectionFieldMask
static const osg::BitVector MTInfluenceMask
static const osg::BitVector AmbientFieldMask
static const osg::BitVector DiffuseFieldMask
static const osg::BitVector SpecularFieldMask
static const osg::BitVector BeaconFieldMask
static const osg::BitVector OnFieldMask
static const osg::BitVector ConstantAttenuationFieldMask
static const osg::BitVector LinearAttenuationFieldMask
static const osg::BitVector QuadraticAttenuationFieldMask
static const BitVector ParentsFieldMask = (1 << NodeCore::ParentsFieldId )
static const BitVector AttachmentsFieldMask
static const BitVector NextFieldMask

Protected Member Functions

Constructors
DirectionalLightBase (void)
 DirectionalLightBase (const DirectionalLightBase &source)
Destructors
*virtual ~DirectionalLightBase (void)
Sync
*void executeSyncImpl (DirectionalLightBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)

Protected Attributes

LightChunkPtr _pChunk
Fields
*SFVec3f _sfDirection

Private Types

typedef Light Inherited

Private Member Functions

void operator= (const DirectionalLightBase &source)

Static Private Attributes

static FieldDescription_desc []
 DirectionalLight description.
static FieldContainerType _type

Friends

class FieldContainer

Detailed Description

Definition at line 81 of file OSGDirectionalLightBase.h.


Member Typedef Documentation

typedef Light osg::DirectionalLightBase::Inherited [private]
 

Reimplemented from osg::Light.

Reimplemented in osg::DirectionalLight.

Definition at line 85 of file OSGDirectionalLightBase.h.

typedef DirectionalLightPtr osg::DirectionalLightBase::Ptr
 

Reimplemented from osg::LightBase.

Definition at line 90 of file OSGDirectionalLightBase.h.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
DirectionFieldId 
NextFieldId 

Reimplemented from osg::LightBase.

Definition at line 92 of file OSGDirectionalLightBase.h.


Constructor & Destructor Documentation

DirectionalLightBase::DirectionalLightBase void   )  [protected]
 

Definition at line 164 of file OSGDirectionalLightBase.cpp.

00164                                                :
00165     _sfDirection              (Vec3f(0,0,1)), 
00166     Inherited() 
00167 {
00168 }

DirectionalLightBase::DirectionalLightBase const DirectionalLightBase source  )  [protected]
 

Definition at line 174 of file OSGDirectionalLightBase.cpp.

00174                                                                              :
00175     _sfDirection              (source._sfDirection              ), 
00176     Inherited                 (source)
00177 {
00178 }

DirectionalLightBase::~DirectionalLightBase void   )  [protected, virtual]
 

Definition at line 182 of file OSGDirectionalLightBase.cpp.

00183 {
00184 }


Member Function Documentation

osg::FieldContainerType & osg::DirectionalLightBase::getClassType void   )  [inline, static]
 

Reimplemented from osg::LightBase.

Definition at line 58 of file OSGDirectionalLightBase.inl.

References _type.

Referenced by create(), and osg::DirectionalLight::initMethod().

00059 {
00060     return _type; 
00061 } 

osg::UInt32 osg::DirectionalLightBase::getClassTypeId void   )  [inline, static]
 

Reimplemented from osg::LightBase.

Definition at line 65 of file OSGDirectionalLightBase.inl.

References _type, and osg::TypeBase::getId().

00066 {
00067     return _type.getId(); 
00068 } 

FieldContainerType & DirectionalLightBase::getType void   )  [virtual]
 

Reimplemented from osg::LightBase.

Definition at line 106 of file OSGDirectionalLightBase.cpp.

References _type.

00107 {
00108     return _type; 
00109 } 

const FieldContainerType & DirectionalLightBase::getType void   )  const [virtual]
 

Reimplemented from osg::LightBase.

Definition at line 111 of file OSGDirectionalLightBase.cpp.

References _type.

00112 {
00113     return _type;
00114 } 

UInt32 DirectionalLightBase::getContainerSize void   )  const [virtual]
 

Reimplemented from osg::LightBase.

Definition at line 126 of file OSGDirectionalLightBase.cpp.

00127 { 
00128     return sizeof(DirectionalLight); 
00129 }

SFVec3f * osg::DirectionalLightBase::getSFDirection void   )  [inline]
 

Definition at line 101 of file OSGDirectionalLightBase.inl.

References _sfDirection.

00102 {
00103     return &_sfDirection;
00104 }

Vec3f & osg::DirectionalLightBase::getDirection void   )  [inline]
 

Definition at line 109 of file OSGDirectionalLightBase.inl.

References _sfDirection, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00110 {
00111     return _sfDirection.getValue();
00112 }

const Vec3f & osg::DirectionalLightBase::getDirection void   )  const [inline]
 

Definition at line 116 of file OSGDirectionalLightBase.inl.

References _sfDirection, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00117 {
00118     return _sfDirection.getValue();
00119 }

void osg::DirectionalLightBase::setDirection const Vec3f value  )  [inline]
 

Reimplemented in osg::DirectionalLight.

Definition at line 123 of file OSGDirectionalLightBase.inl.

References _sfDirection, and osg::SField< FieldTypeT, fieldNameSpace >::setValue().

Referenced by osg::DirectionalLight::setDirection().

00124 {
00125     _sfDirection.setValue(value);
00126 }

UInt32 DirectionalLightBase::getBinSize const BitVector whichField  )  [virtual]
 

Reimplemented from osg::LightBase.

Definition at line 188 of file OSGDirectionalLightBase.cpp.

References _sfDirection, DirectionFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::LightBase::getBinSize(), and osg::FieldBits::NoField.

00189 {
00190     UInt32 returnValue = Inherited::getBinSize(whichField);
00191 
00192     if(FieldBits::NoField != (DirectionFieldMask & whichField))
00193     {
00194         returnValue += _sfDirection.getBinSize();
00195     }
00196 
00197 
00198     return returnValue;
00199 }

void DirectionalLightBase::copyToBin BinaryDataHandler pMem,
const BitVector whichField
[virtual]
 

Reimplemented from osg::LightBase.

Definition at line 201 of file OSGDirectionalLightBase.cpp.

References _sfDirection, osg::SField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::LightBase::copyToBin(), DirectionFieldMask, and osg::FieldBits::NoField.

00203 {
00204     Inherited::copyToBin(pMem, whichField);
00205 
00206     if(FieldBits::NoField != (DirectionFieldMask & whichField))
00207     {
00208         _sfDirection.copyToBin(pMem);
00209     }
00210 
00211 
00212 }

void DirectionalLightBase::copyFromBin BinaryDataHandler pMem,
const BitVector whichField
[virtual]
 

Reimplemented from osg::LightBase.

Definition at line 214 of file OSGDirectionalLightBase.cpp.

References _sfDirection, osg::SField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::LightBase::copyFromBin(), DirectionFieldMask, and osg::FieldBits::NoField.

00216 {
00217     Inherited::copyFromBin(pMem, whichField);
00218 
00219     if(FieldBits::NoField != (DirectionFieldMask & whichField))
00220     {
00221         _sfDirection.copyFromBin(pMem);
00222     }
00223 
00224 
00225 }

DirectionalLightPtr osg::DirectionalLightBase::create void   )  [inline, static]
 

Definition at line 72 of file OSGDirectionalLightBase.inl.

References osg::AttachmentContainerPtr::dcast(), getClassType(), osg::FieldContainerType::getPrototype(), osg::NullFC, and shallowCopy().

Referenced by osg::SimpleSceneManager::initialize().

00073 {
00074     DirectionalLightPtr fc; 
00075 
00076     if(getClassType().getPrototype() != OSG::NullFC) 
00077     {
00078         fc = DirectionalLightPtr::dcast(
00079             getClassType().getPrototype()-> shallowCopy()); 
00080     }
00081     
00082     return fc; 
00083 }

DirectionalLightPtr osg::DirectionalLightBase::createEmpty void   )  [inline, static]
 

Definition at line 87 of file OSGDirectionalLightBase.inl.

References osg::FieldContainer::newPtr().

00088 { 
00089     DirectionalLightPtr returnValue; 
00090     
00091     newPtr(returnValue); 
00092 
00093     return returnValue; 
00094 }

FieldContainerPtr DirectionalLightBase::shallowCopy void   )  const [virtual]
 

Implements osg::FieldContainer.

Definition at line 117 of file OSGDirectionalLightBase.cpp.

References osg::FieldContainer::newPtr().

Referenced by create().

00118 { 
00119     DirectionalLightPtr returnValue; 
00120 
00121     newPtr(returnValue, dynamic_cast<const DirectionalLight *>(this)); 
00122 
00123     return returnValue; 
00124 }

void DirectionalLightBase::executeSyncImpl DirectionalLightBase pOther,
const BitVector whichField
[protected]
 

Definition at line 228 of file OSGDirectionalLightBase.cpp.

References _sfDirection, DirectionFieldMask, osg::LightBase::executeSyncImpl(), osg::FieldBits::NoField, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by executeSync().

00230 {
00231 
00232     Inherited::executeSyncImpl(pOther, whichField);
00233 
00234     if(FieldBits::NoField != (DirectionFieldMask & whichField))
00235         _sfDirection.syncWith(pOther->_sfDirection);
00236 
00237 
00238 }

void DirectionalLightBase::executeSync FieldContainer other,
const BitVector whichField
[protected, virtual]
 

Reimplemented from osg::LightBase.

Definition at line 133 of file OSGDirectionalLightBase.cpp.

References executeSyncImpl().

00135 {
00136     this->executeSyncImpl((DirectionalLightBase *) &other, whichField);
00137 }

void osg::DirectionalLightBase::operator= const DirectionalLightBase source  )  [private]
 

void Light::setAmbient Real32  rRed,
Real32  rGreen,
Real32  rBlue,
Real32  rAlpha
[inherited]
 

Definition at line 66 of file OSGLight.cpp.

References osg::LightBase::_sfAmbient, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00070 {
00071     _sfAmbient.getValue().setValuesRGBA(rRed, rGreen, rBlue, rAlpha);
00072 }

void osg::Light::setAmbient const Color4f col  )  [inline, inherited]
 

Reimplemented from osg::LightBase.

Definition at line 46 of file OSGLight.inl.

References osg::LightBase::setAmbient().

00047 {
00048     Inherited::setAmbient(col);
00049 }

void Light::setDiffuse Real32  rRed,
Real32  rGreen,
Real32  rBlue,
Real32  rAlpha
[inherited]
 

Definition at line 74 of file OSGLight.cpp.

References osg::LightBase::_sfDiffuse, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00078 {
00079     _sfDiffuse.getValue().setValuesRGBA(rRed, rGreen, rBlue, rAlpha);
00080 }

void osg::Light::setDiffuse const Color4f col  )  [inline, inherited]
 

Reimplemented from osg::LightBase.

Definition at line 52 of file OSGLight.inl.

References osg::LightBase::setDiffuse().

00053 {
00054     Inherited::setDiffuse(col);
00055 }

void Light::setSpecular Real32  rRed,
Real32  rGreen,
Real32  rBlue,
Real32  rAlpha
[inherited]
 

Definition at line 82 of file OSGLight.cpp.

References osg::LightBase::_sfSpecular, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00086 {
00087     _sfSpecular.getValue().setValuesRGBA(rRed, rGreen, rBlue, rAlpha);
00088 }

void osg::Light::setSpecular const Color4f col  )  [inline, inherited]
 

Reimplemented from osg::LightBase.

Definition at line 58 of file OSGLight.inl.

References osg::LightBase::setSpecular().

00059 {
00060     Inherited::setSpecular(col);
00061 }

LightChunkPtr Light::getChunk void   )  [inherited]
 

Definition at line 93 of file OSGLight.cpp.

References osg::Light::_pChunk.

Referenced by osg::RenderAction::dropLight().

00094 {
00095     return _pChunk;
00096 }

void Light::makeChunk void   )  [virtual, inherited]
 

Reimplemented in osg::DirectionalLight, osg::PointLight, and osg::SpotLight.

Definition at line 98 of file OSGLight.cpp.

References osg::Light::_pChunk, osg::LightChunkBase::create(), osg::LightBase::getAmbient(), osg::LightBase::getDiffuse(), osg::LightBase::getSpecular(), and osg::NullFC.

Referenced by osg::RenderAction::dropLight(), osg::PointLight::makeChunk(), and osg::DirectionalLight::makeChunk().

00099 {
00100     if(_pChunk == NullFC)
00101     {
00102         _pChunk = LightChunk::create();
00103     }
00104 
00105     _pChunk->setAmbient (getAmbient ());
00106     _pChunk->setDiffuse (getDiffuse ());
00107     _pChunk->setSpecular(getSpecular());
00108 }

void Light::changed BitVector  whichField,
UInt32  origin
[virtual, inherited]
 

Reimplemented from osg::AttachmentContainer.

Reimplemented in osg::DirectionalLight, osg::PointLight, and osg::SpotLight.

Definition at line 113 of file OSGLight.cpp.

References osg::AttachmentContainer::changed().

Referenced by osg::PointLight::changed(), and osg::DirectionalLight::changed().

00114 {
00115     Inherited::changed(whichField, origin);
00116 }

void Light::dump UInt32  uiIndent = 0,
const BitVector  bvFlags = 0
const [virtual, inherited]
 

Reimplemented from osg::NodeCore.

Reimplemented in osg::DirectionalLight, osg::PointLight, and osg::SpotLight.

Definition at line 122 of file OSGLight.cpp.

References osg::NodeCore::dump().

Referenced by osg::PointLight::dump(), and osg::DirectionalLight::dump().

00124 {
00125    Inherited::dump(uiIndent, bvFlags);
00126 }

Action::ResultE Light::drawEnter Action action  )  [protected, inherited]
 

Reimplemented in osg::DirectionalLight, osg::PointLight, and osg::SpotLight.

Definition at line 155 of file OSGLight.cpp.

References osg::LightBase::_sfAmbient, osg::LightBase::_sfConstantAttenuation, osg::LightBase::_sfDiffuse, osg::LightBase::_sfLinearAttenuation, osg::LightBase::_sfQuadraticAttenuation, osg::LightBase::_sfSpecular, osg::Action::Continue, osg::Action::getActNode(), osg::LightBase::getBeacon(), osg::DrawAction::getLightCount(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), osg::TransformationMatrix< ValueTypeT >::getValues(), GLenum, osg::DrawAction::incLightCount(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::TransformationMatrix< ValueTypeT >::mult(), osg::NullFC, osg::DrawActionBase::selectVisibles(), and SINFO.

Referenced by osg::SpotLight::drawEnter(), osg::PointLight::drawEnter(), and osg::DirectionalLight::drawEnter().

00156 {
00157     DrawAction *da    = dynamic_cast<DrawAction *>(action);
00158     GLenum      light = GL_LIGHT0 + da->getLightCount();
00159     
00160     da->incLightCount();
00161     
00162     glEnable (light);
00163     
00164     glLightfv(light, GL_DIFFUSE , _sfDiffuse. getValue().getValuesRGBA());
00165     glLightfv(light, GL_AMBIENT , _sfAmbient. getValue().getValuesRGBA());
00166     glLightfv(light, GL_SPECULAR, _sfSpecular.getValue().getValuesRGBA());
00167 
00168     glLightf( light, 
00169               GL_CONSTANT_ATTENUATION, 
00170              _sfConstantAttenuation.getValue() );
00171     glLightf( light,
00172               GL_LINEAR_ATTENUATION,   
00173              _sfLinearAttenuation.getValue()   );
00174     glLightf( light,
00175               GL_QUADRATIC_ATTENUATION,   
00176              _sfQuadraticAttenuation.getValue());
00177 
00178     // add the matrix to get into the beacon's coordinate system onto the stack
00179 
00180     Matrix fromworld;
00181     Matrix tobeacon;
00182 
00183     action->getActNode()->getToWorld(fromworld);
00184     fromworld.invert();
00185 
00186     NodePtr beacon = getBeacon();
00187 
00188     if(beacon == NullFC)
00189     {
00190         SINFO << "draw: no beacon set!" << std::endl;
00191 
00192         glPushMatrix();
00193     }
00194     else
00195     {
00196         getBeacon()->getToWorld(tobeacon);
00197     
00198         tobeacon.mult(fromworld);
00199     
00200         glPushMatrix();
00201         glMultMatrixf(tobeacon.getValues());
00202     }
00203     
00204     da->selectVisibles();
00205     
00206     return Action::Continue;
00207 }

Action::ResultE Light::drawLeave Action action  )  [protected, inherited]
 

Reimplemented in osg::DirectionalLight, osg::PointLight, and osg::SpotLight.

Definition at line 209 of file OSGLight.cpp.

References osg::Action::Continue, osg::DrawAction::decLightCount(), osg::DrawAction::getLightCount(), and GLenum.

Referenced by osg::SpotLight::drawLeave(), osg::PointLight::drawLeave(), and osg::DirectionalLight::drawLeave().

00210 {
00211     DrawAction *da = dynamic_cast<DrawAction *>(action);
00212      
00213     da->decLightCount();
00214 
00215     GLenum light = GL_LIGHT0 + da->getLightCount();
00216    
00217     glDisable(light);
00218    
00219     return Action::Continue;
00220 }

Action::ResultE Light::renderEnter Action action  )  [protected, inherited]
 

Reimplemented in osg::DirectionalLight, osg::PointLight, and osg::SpotLight.

Definition at line 225 of file OSGLight.cpp.

References osg::Action::Continue, and osg::RenderAction::dropLight().

Referenced by osg::PointLight::renderEnter(), and osg::DirectionalLight::renderEnter().

00226 {
00227     RenderAction *pAction = dynamic_cast<RenderAction *>(action);
00228 
00229     pAction->dropLight(this);
00230 
00231     return Action::Continue;
00232 }

Action::ResultE Light::renderLeave Action action  )  [protected, inherited]
 

Reimplemented in osg::DirectionalLight, osg::PointLight, and osg::SpotLight.

Definition at line 234 of file OSGLight.cpp.

References osg::Action::Continue, and osg::RenderAction::undropLight().

Referenced by osg::SpotLight::renderLeave(), osg::PointLight::renderLeave(), and osg::DirectionalLight::renderLeave().

00235 {
00236     RenderAction *pAction = dynamic_cast<RenderAction *>(action);
00237 
00238     pAction->undropLight(this);
00239 
00240     return Action::Continue;
00241 }

SFColor4f * osg::LightBase::getSFAmbient void   )  [inline, inherited]
 

Definition at line 75 of file OSGLightBase.inl.

References osg::LightBase::_sfAmbient.

00076 {
00077     return &_sfAmbient;
00078 }

SFColor4f * osg::LightBase::getSFDiffuse void   )  [inline, inherited]
 

Definition at line 82 of file OSGLightBase.inl.

References osg::LightBase::_sfDiffuse.

00083 {
00084     return &_sfDiffuse;
00085 }

SFColor4f * osg::LightBase::getSFSpecular void   )  [inline, inherited]
 

Definition at line 89 of file OSGLightBase.inl.

References osg::LightBase::_sfSpecular.

00090 {
00091     return &_sfSpecular;
00092 }

SFNodePtr * osg::LightBase::getSFBeacon void   )  [inline, inherited]
 

Definition at line 96 of file OSGLightBase.inl.

References osg::LightBase::_sfBeacon.

00097 {
00098     return &_sfBeacon;
00099 }

SFBool * osg::LightBase::getSFOn void   )  [inline, inherited]
 

Definition at line 103 of file OSGLightBase.inl.

References osg::LightBase::_sfOn.

00104 {
00105     return &_sfOn;
00106 }

SFReal32 * osg::LightBase::getSFConstantAttenuation void   )  [inline, inherited]
 

Definition at line 110 of file OSGLightBase.inl.

References osg::LightBase::_sfConstantAttenuation.

00111 {
00112     return &_sfConstantAttenuation;
00113 }

SFReal32 * osg::LightBase::getSFLinearAttenuation void   )  [inline, inherited]
 

Definition at line 117 of file OSGLightBase.inl.

References osg::LightBase::_sfLinearAttenuation.

00118 {
00119     return &_sfLinearAttenuation;
00120 }

SFReal32 * osg::LightBase::getSFQuadraticAttenuation void   )  [inline, inherited]
 

Definition at line 124 of file OSGLightBase.inl.

References osg::LightBase::_sfQuadraticAttenuation.

00125 {
00126     return &_sfQuadraticAttenuation;
00127 }

Color4f & osg::LightBase::getAmbient void   )  [inline, inherited]
 

Definition at line 132 of file OSGLightBase.inl.

References osg::LightBase::_sfAmbient, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::Light::makeChunk().

00133 {
00134     return _sfAmbient.getValue();
00135 }

const Color4f & osg::LightBase::getAmbient void   )  const [inline, inherited]
 

Definition at line 139 of file OSGLightBase.inl.

References osg::LightBase::_sfAmbient, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00140 {
00141     return _sfAmbient.getValue();
00142 }

Color4f & osg::LightBase::getDiffuse void   )  [inline, inherited]
 

Definition at line 153 of file OSGLightBase.inl.

References osg::LightBase::_sfDiffuse, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by osg::Light::makeChunk().

00154 {
00155     return _sfDiffuse.getValue();
00156 }

const Color4f & osg::LightBase::getDiffuse void   )  const [inline, inherited]
 

Definition at line 160 of file OSGLightBase.inl.

References osg::LightBase::_sfDiffuse, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00161 {
00162     return _sfDiffuse.getValue();
00163 }

Color4f & osg::LightBase::getSpecular void   )  [inline, inherited]
 

Definition at line 174 of file OSGLightBase.inl.

References osg::LightBase::_sfSpecular, and osg::SField< Fiel