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

osg::SpotLightBase Class Reference

SpotLight Base Class.

#include <OSGSpotLightBase.h>

Inheritance diagram for osg::SpotLightBase:

osg::PointLight osg::PointLightBase osg::Light osg::LightBase osg::NodeCore osg::AttachmentContainer osg::FieldContainer osg::SpotLight List of all members.

Public Types

typedef SpotLightPtr Ptr
enum  { DirectionFieldId = Inherited::NextFieldId, SpotExponentFieldId = DirectionFieldId + 1, SpotCutOffFieldId = SpotExponentFieldId + 1, NextFieldId = SpotCutOffFieldId + 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 SpotLight::_sfDirection field.
SFReal32getSFSpotExponent (void)
 Get the SpotLight::_sfSpotExponent field.
SFReal32getSFSpotCutOff (void)
 Get the SpotLight::_sfSpotCutOff field.
Vec3fgetDirection (void)
 Get the value of the SpotLight::_sfDirection field.
const Vec3fgetDirection (void) const
 Get the value of the SpotLight::_sfDirection field.
Real32getSpotExponent (void)
 Get the value of the SpotLight::_sfSpotExponent field.
const Real32getSpotExponent (void) const
 Get the value of the SpotLight::_sfSpotExponent field.
Real32getSpotCutOff (void)
 Get the value of the SpotLight::_sfSpotCutOff field.
const Real32getSpotCutOff (void) const
 Get the value of the SpotLight::_sfSpotCutOff field.
Field Set
*void setDirection (const Vec3f &value)
 Set the value of the SpotLight::_sfDirection field.
void setSpotExponent (const Real32 &value)
 Set the value of the SpotLight::_sfSpotExponent field.
void setSpotCutOff (const Real32 &value)
 Set the value of the SpotLight::_sfSpotCutOff 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
Access Fields
*void setPosition (Real32 rX, Real32 rY, Real32 rZ)
void setPosition (const Pnt3f &pos)
 Set the value of the PointLight::_sfPosition field.
void setAttenuation (Real32 rConstant, Real32 rLinear, Real32 rQuadratic)
Chunk
*virtual void makeChunk (void)
Sync
*virtual void changed (BitVector whichField, UInt32 origin)
Dump
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
Field Get
*SFPnt3fgetSFPosition (void)
 Get the PointLight::_sfPosition field.
Pnt3fgetPosition (void)
 Get the value of the PointLight::_sfPosition field.
const Pnt3fgetPosition (void) const
 Get the value of the PointLight::_sfPosition field.
Set
*void setAmbient (Real32 rRed, Real32 rGreen, Real32 rBlue, Real32 rAlpha)
void setAmbient (const Color4f &col)
 Set the value of the Light::_sfAmbient field.
void setDiffuse (Real32 rRed, Real32 rGreen, Real32 rBlue, Real32 rAlpha)
void setDiffuse (const Color4f &col)
 Set the value of the Light::_sfDiffuse field.
void setSpecular (Real32 rRed, Real32 rGreen, Real32 rBlue, Real32 rAlpha)
void setSpecular (const Color4f &col)
 Set the value of the Light::_sfSpecular field.
Chunk
*LightChunkPtr getChunk (void)
Field Get
*SFColor4fgetSFAmbient (void)
 Get the Light::_sfAmbient field.
SFColor4fgetSFDiffuse (void)
 Get the Light::_sfDiffuse field.
SFColor4fgetSFSpecular (void)
 Get the Light::_sfSpecular field.
SFNodePtrgetSFBeacon (void)
 Get the Light::_sfBeacon field.
SFBoolgetSFOn (void)
 Get the Light::_sfOn field.
SFReal32getSFConstantAttenuation (void)
 Get the Light::_sfConstantAttenuation field.
SFReal32getSFLinearAttenuation (void)
 Get the Light::_sfLinearAttenuation field.
SFReal32getSFQuadraticAttenuation (void)
 Get the Light::_sfQuadraticAttenuation field.
Color4fgetAmbient (void)
 Get the value of the Light::_sfAmbient field.
const Color4fgetAmbient (void) const
 Get the value of the Light::_sfAmbient field.
Color4fgetDiffuse (void)
 Get the value of the Light::_sfDiffuse field.
const Color4fgetDiffuse (void) const
 Get the value of the Light::_sfDiffuse field.
Color4fgetSpecular (void)
 Get the value of the Light::_sfSpecular field.
const Color4fgetSpecular (void) const
 Get the value of the Light::_sfSpecular field.
NodePtrgetBeacon (void)
 Get the value of the Light::_sfBeacon field.
const NodePtrgetBeacon (void) const
 Get the value of the Light::_sfBeacon field.
bool & getOn (void)
 Get the value of the Light::_sfOn field.
const bool & getOn (void) const
 Get the value of the Light::_sfOn field.
Real32getConstantAttenuation (void)
 Get the value of the Light::_sfConstantAttenuation field.
const Real32getConstantAttenuation (void) const
 Get the value of the Light::_sfConstantAttenuation field.
Real32getLinearAttenuation (void)
 Get the value of the Light::_sfLinearAttenuation field.
const Real32getLinearAttenuation (void) const
 Get the value of the Light::_sfLinearAttenuation field.
Real32getQuadraticAttenuation (void)
 Get the value of the Light::_sfQuadraticAttenuation field.
const Real32getQuadraticAttenuation (void) const
 Get the value of the Light::_sfQuadraticAttenuation field.
Field Set
void setBeacon (const NodePtr &value)
 Set the value of the Light::_sfBeacon field.
void setOn (const bool &value)
 Set the value of the Light::_sfOn field.
void setConstantAttenuation (const Real32 &value)
 Set the value of the Light::_sfConstantAttenuation field.
void setLinearAttenuation (const Real32 &value)
 Set the value of the Light::_sfLinearAttenuation field.
void setQuadraticAttenuation (const Real32 &value)
 Set the value of the Light::_sfQuadraticAttenuation field.
Parents
*MFNodePtrgetParents (void)
const MFNodePtrgetParents (void) const
MFNodePtrgetMFParents (void)
Volume
*virtual void invalidateVolume (void)

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 SpotLightPtr create (void)
 create a new instance of the class
static SpotLightPtr 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 SpotExponentFieldMask
static const osg::BitVector SpotCutOffFieldMask
static const osg::BitVector MTInfluenceMask
static const osg::BitVector PositionFieldMask
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
static stat elem
*static StatElemDesc< StatIntElemstatNPointLights
CoredNodePtr helper
*static const bool isNodeCore = true

Protected Member Functions

Constructors
SpotLightBase (void)
 SpotLightBase (const SpotLightBase &source)
Destructors
*virtual ~SpotLightBase (void)
Sync
*void executeSyncImpl (SpotLightBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)
Actions
*Action::ResultE drawEnter (Action *action)
Action::ResultE drawLeave (Action *action)
Action::ResultE renderEnter (Action *action)
Action::ResultE renderLeave (Action *action)
Sync
*void executeSyncImpl (PointLightBase *pOther, const BitVector &whichField)
Sync
*void executeSyncImpl (LightBase *pOther, const BitVector &whichField)
Sync
void executeSyncImpl (NodeCore *pOther, const BitVector &whichField)
MT Destruction
*virtual void onDestroy (void)
Set / Get Parents
*void addParent (const NodePtr &parent)
void subParent (const NodePtr &parent)
Pointer
*NodeCorePtr getPtr (void) const
Transformation
*virtual void accumulateMatrix (Matrix &result)
Volume
*virtual void adjustVolume (Volume &volume)

Protected Attributes

LightChunkPtr _pChunk
Fields
*SFVec3f _sfDirection
SFReal32 _sfSpotExponent
SFReal32 _sfSpotCutOff
Fields
*SFPnt3f _sfPosition
Fields
*SFColor4f _sfAmbient
SFColor4f _sfDiffuse
SFColor4f _sfSpecular
SFNodePtr _sfBeacon
SFBool _sfOn
SFReal32 _sfConstantAttenuation
SFReal32 _sfLinearAttenuation
SFReal32 _sfQuadraticAttenuation
Fields
*MFNodePtr _parents

Private Types

typedef PointLight Inherited

Private Member Functions

void operator= (const SpotLightBase &source)

Static Private Attributes

static FieldDescription_desc []
 SpotLight description.
static FieldContainerType _type

Friends

class FieldContainer

Detailed Description

Definition at line 83 of file OSGSpotLightBase.h.


Member Typedef Documentation

typedef PointLight osg::SpotLightBase::Inherited [private]
 

Reimplemented from osg::PointLight.

Reimplemented in osg::SpotLight.

Definition at line 87 of file OSGSpotLightBase.h.

typedef SpotLightPtr osg::SpotLightBase::Ptr
 

Reimplemented from osg::PointLightBase.

Definition at line 92 of file OSGSpotLightBase.h.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
DirectionFieldId 
SpotExponentFieldId 
SpotCutOffFieldId 
NextFieldId 

Reimplemented from osg::PointLightBase.

Definition at line 94 of file OSGSpotLightBase.h.

00095     {
00096         DirectionFieldId    = Inherited::NextFieldId,
00097         SpotExponentFieldId = DirectionFieldId    + 1,
00098         SpotCutOffFieldId   = SpotExponentFieldId + 1,
00099         NextFieldId         = SpotCutOffFieldId   + 1
00100     };


Constructor & Destructor Documentation

SpotLightBase::SpotLightBase void   )  [protected]
 

Definition at line 186 of file OSGSpotLightBase.cpp.

00186                                  :
00187     _sfDirection              (Vec3f(0,0,1)), 
00188     _sfSpotExponent           (), 
00189     _sfSpotCutOff             (), 
00190     Inherited() 
00191 {
00192 }

SpotLightBase::SpotLightBase const SpotLightBase source  )  [protected]
 

Definition at line 198 of file OSGSpotLightBase.cpp.

00198                                                         :
00199     _sfDirection              (source._sfDirection              ), 
00200     _sfSpotExponent           (source._sfSpotExponent           ), 
00201     _sfSpotCutOff             (source._sfSpotCutOff             ), 
00202     Inherited                 (source)
00203 {
00204 }

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

Definition at line 208 of file OSGSpotLightBase.cpp.

00209 {
00210 }


Member Function Documentation

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

Reimplemented from osg::PointLightBase.

Definition at line 58 of file OSGSpotLightBase.inl.

References _type.

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

00059 {
00060     return _type; 
00061 } 

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

Reimplemented from osg::PointLightBase.

Definition at line 65 of file OSGSpotLightBase.inl.

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

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

FieldContainerType & SpotLightBase::getType void   )  [virtual]
 

Reimplemented from osg::PointLightBase.

Definition at line 128 of file OSGSpotLightBase.cpp.

References _type.

00129 {
00130     return _type; 
00131 } 

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

Reimplemented from osg::PointLightBase.

Definition at line 133 of file OSGSpotLightBase.cpp.

References _type.

00134 {
00135     return _type;
00136 } 

UInt32 SpotLightBase::getContainerSize void   )  const [virtual]
 

Reimplemented from osg::PointLightBase.

Definition at line 148 of file OSGSpotLightBase.cpp.

00149 { 
00150     return sizeof(SpotLight); 
00151 }

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

Definition at line 101 of file OSGSpotLightBase.inl.

References _sfDirection.

00102 {
00103     return &_sfDirection;
00104 }

SFReal32 * osg::SpotLightBase::getSFSpotExponent void   )  [inline]
 

Definition at line 108 of file OSGSpotLightBase.inl.

References _sfSpotExponent.

00109 {
00110     return &_sfSpotExponent;
00111 }

SFReal32 * osg::SpotLightBase::getSFSpotCutOff void   )  [inline]
 

Definition at line 115 of file OSGSpotLightBase.inl.

References _sfSpotCutOff.

00116 {
00117     return &_sfSpotCutOff;
00118 }

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

Definition at line 123 of file OSGSpotLightBase.inl.

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

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

00124 {
00125     return _sfDirection.getValue();
00126 }

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

Definition at line 130 of file OSGSpotLightBase.inl.

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

00131 {
00132     return _sfDirection.getValue();
00133 }

Real32 & osg::SpotLightBase::getSpotExponent void   )  [inline]
 

Definition at line 144 of file OSGSpotLightBase.inl.

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

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

00145 {
00146     return _sfSpotExponent.getValue();
00147 }

const Real32 & osg::SpotLightBase::getSpotExponent void   )  const [inline]
 

Definition at line 151 of file OSGSpotLightBase.inl.

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

00152 {
00153     return _sfSpotExponent.getValue();
00154 }

Real32 & osg::SpotLightBase::getSpotCutOff void   )  [inline]
 

Definition at line 165 of file OSGSpotLightBase.inl.

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

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

00166 {
00167     return _sfSpotCutOff.getValue();
00168 }

const Real32 & osg::SpotLightBase::getSpotCutOff void   )  const [inline]
 

Definition at line 172 of file OSGSpotLightBase.inl.

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

00173 {
00174     return _sfSpotCutOff.getValue();
00175 }

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

Definition at line 137 of file OSGSpotLightBase.inl.

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

00138 {
00139     _sfDirection.setValue(value);
00140 }

void osg::SpotLightBase::setSpotExponent const Real32 value  )  [inline]
 

Definition at line 158 of file OSGSpotLightBase.inl.

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

00159 {
00160     _sfSpotExponent.setValue(value);
00161 }

void osg::SpotLightBase::setSpotCutOff const Real32 value  )  [inline]
 

Definition at line 179 of file OSGSpotLightBase.inl.

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

00180 {
00181     _sfSpotCutOff.setValue(value);
00182 }

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

Reimplemented from osg::PointLightBase.

Definition at line 214 of file OSGSpotLightBase.cpp.

References _sfDirection, _sfSpotCutOff, _sfSpotExponent, DirectionFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::PointLightBase::getBinSize(), osg::FieldBits::NoField, SpotCutOffFieldMask, and SpotExponentFieldMask.

00215 {
00216     UInt32 returnValue = Inherited::getBinSize(whichField);
00217 
00218     if(FieldBits::NoField != (DirectionFieldMask & whichField))
00219     {
00220         returnValue += _sfDirection.getBinSize();
00221     }
00222 
00223     if(FieldBits::NoField != (SpotExponentFieldMask & whichField))
00224     {
00225         returnValue += _sfSpotExponent.getBinSize();
00226     }
00227 
00228     if(FieldBits::NoField != (SpotCutOffFieldMask & whichField))
00229     {
00230         returnValue += _sfSpotCutOff.getBinSize();
00231     }
00232 
00233 
00234     return returnValue;
00235 }

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

Reimplemented from osg::PointLightBase.

Definition at line 237 of file OSGSpotLightBase.cpp.

References _sfDirection, _sfSpotCutOff, _sfSpotExponent, osg::SField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::PointLightBase::copyToBin(), DirectionFieldMask, osg::FieldBits::NoField, SpotCutOffFieldMask, and SpotExponentFieldMask.

00239 {
00240     Inherited::copyToBin(pMem, whichField);
00241 
00242     if(FieldBits::NoField != (DirectionFieldMask & whichField))
00243     {
00244         _sfDirection.copyToBin(pMem);
00245     }
00246 
00247     if(FieldBits::NoField != (SpotExponentFieldMask & whichField))
00248     {
00249         _sfSpotExponent.copyToBin(pMem);
00250     }
00251 
00252     if(FieldBits::NoField != (SpotCutOffFieldMask & whichField))
00253     {
00254         _sfSpotCutOff.copyToBin(pMem);
00255     }
00256 
00257 
00258 }

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

Reimplemented from osg::PointLightBase.

Definition at line 260 of file OSGSpotLightBase.cpp.

References _sfDirection, _sfSpotCutOff, _sfSpotExponent, osg::SField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::PointLightBase::copyFromBin(), DirectionFieldMask, osg::FieldBits::NoField, SpotCutOffFieldMask, and SpotExponentFieldMask.

00262 {
00263     Inherited::copyFromBin(pMem, whichField);
00264 
00265     if(FieldBits::NoField != (DirectionFieldMask & whichField))
00266     {
00267         _sfDirection.copyFromBin(pMem);
00268     }
00269 
00270     if(FieldBits::NoField != (SpotExponentFieldMask & whichField))
00271     {
00272         _sfSpotExponent.copyFromBin(pMem);
00273     }
00274 
00275     if(FieldBits::NoField != (SpotCutOffFieldMask & whichField))
00276     {
00277         _sfSpotCutOff.copyFromBin(pMem);
00278     }
00279 
00280 
00281 }

SpotLightPtr osg::SpotLightBase::create void   )  [inline, static]
 

Reimplemented from osg::PointLightBase.

Definition at line 72 of file OSGSpotLightBase.inl.

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

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

SpotLightPtr osg::SpotLightBase::createEmpty void   )  [inline, static]
 

Reimplemented from osg::PointLightBase.

Definition at line 87 of file OSGSpotLightBase.inl.

References osg::FieldContainer::newPtr().

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

FieldContainerPtr SpotLightBase::shallowCopy void   )  const [virtual]
 

Reimplemented from osg::PointLightBase.

Definition at line 139 of file OSGSpotLightBase.cpp.

References osg::FieldContainer::newPtr().

Referenced by create().

00140 { 
00141     SpotLightPtr returnValue; 
00142 
00143     newPtr(returnValue, dynamic_cast<const SpotLight *>(this)); 
00144 
00145     return returnValue; 
00146 }

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

Definition at line 284 of file OSGSpotLightBase.cpp.

References _sfDirection, _sfSpotCutOff, _sfSpotExponent, DirectionFieldMask, osg::PointLightBase::executeSyncImpl(), osg::FieldBits::NoField, SpotCutOffFieldMask, SpotExponentFieldMask, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by executeSync().

00286 {
00287 
00288     Inherited::executeSyncImpl(pOther, whichField);
00289 
00290     if(FieldBits::NoField != (DirectionFieldMask & whichField))
00291         _sfDirection.syncWith(pOther->_sfDirection);
00292 
00293     if(FieldBits::NoField != (SpotExponentFieldMask & whichField))
00294         _sfSpotExponent.syncWith(pOther->_sfSpotExponent);
00295 
00296     if(FieldBits::NoField != (SpotCutOffFieldMask & whichField))
00297         _sfSpotCutOff.syncWith(pOther->_sfSpotCutOff);
00298 
00299 
00300 }

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

Reimplemented from osg::PointLightBase.

Definition at line 155 of file OSGSpotLightBase.cpp.

References executeSyncImpl().

00157 {
00158     this->executeSyncImpl((SpotLightBase *) &other, whichField);
00159 }

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

void PointLight::setPosition Real32  rX,
Real32  rY,
Real32  rZ
[inherited]
 

Definition at line 68 of file OSGPointLight.cpp.

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