#include <OSGLightChunk.h>
Inheritance diagram for osg::LightChunk:

Public Types | |
| typedef LightChunkPtr | Ptr |
| enum | { DiffuseFieldId = Inherited::NextFieldId, AmbientFieldId = DiffuseFieldId + 1, SpecularFieldId = AmbientFieldId + 1, PositionFieldId = SpecularFieldId + 1, DirectionFieldId = PositionFieldId + 1, ExponentFieldId = DirectionFieldId + 1, CutoffFieldId = ExponentFieldId + 1, ConstantAttenuationFieldId = CutoffFieldId + 1, LinearAttenuationFieldId = ConstantAttenuationFieldId + 1, QuadraticAttenuationFieldId = LinearAttenuationFieldId + 1, NextFieldId = QuadraticAttenuationFieldId + 1 } |
Public Member Functions | |
Chunk Class Access | |
| *virtual const StateChunkClass * | getClass (void) const |
Sync | |
| *virtual void | changed (BitVector whichField, UInt32 origin) |
Output | |
| *virtual void | dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const |
State | |
| *virtual void | activate (DrawActionBase *action, UInt32 index) |
| virtual void | changeFrom (DrawActionBase *action, StateChunk *old, UInt32 index) |
| virtual void | deactivate (DrawActionBase *action, UInt32 index) |
Comparison | |
| *virtual Real32 | switchCost (StateChunk *chunk) |
| virtual bool | operator< (const StateChunk &other) const |
| virtual bool | operator== (const StateChunk &other) const |
| virtual bool | operator!= (const StateChunk &other) const |
FieldContainer Get | |
| *virtual FieldContainerType & | getType (void) |
| virtual const FieldContainerType & | getType (void) const |
| virtual UInt32 | getContainerSize (void) const |
Field Get | |
| *SFColor4f * | getSFDiffuse (void) |
| Get the LightChunk::_sfDiffuse field. | |
| SFColor4f * | getSFAmbient (void) |
| Get the LightChunk::_sfAmbient field. | |
| SFColor4f * | getSFSpecular (void) |
| Get the LightChunk::_sfSpecular field. | |
| SFVec4f * | getSFPosition (void) |
| Get the LightChunk::_sfPosition field. | |
| SFVec3f * | getSFDirection (void) |
| Get the LightChunk::_sfDirection field. | |
| SFReal32 * | getSFExponent (void) |
| Get the LightChunk::_sfExponent field. | |
| SFReal32 * | getSFCutoff (void) |
| Get the LightChunk::_sfCutoff field. | |
| SFReal32 * | getSFConstantAttenuation (void) |
| Get the LightChunk::_sfConstantAttenuation field. | |
| SFReal32 * | getSFLinearAttenuation (void) |
| Get the LightChunk::_sfLinearAttenuation field. | |
| SFReal32 * | getSFQuadraticAttenuation (void) |
| Get the LightChunk::_sfQuadraticAttenuation field. | |
| Color4f & | getDiffuse (void) |
| Get the value of the LightChunk::_sfDiffuse field. | |
| const Color4f & | getDiffuse (void) const |
| Get the value of the LightChunk::_sfDiffuse field. | |
| Color4f & | getAmbient (void) |
| Get the value of the LightChunk::_sfAmbient field. | |
| const Color4f & | getAmbient (void) const |
| Get the value of the LightChunk::_sfAmbient field. | |
| Color4f & | getSpecular (void) |
| Get the value of the LightChunk::_sfSpecular field. | |
| const Color4f & | getSpecular (void) const |
| Get the value of the LightChunk::_sfSpecular field. | |
| Vec4f & | getPosition (void) |
| Get the value of the LightChunk::_sfPosition field. | |
| const Vec4f & | getPosition (void) const |
| Get the value of the LightChunk::_sfPosition field. | |
| Vec3f & | getDirection (void) |
| Get the value of the LightChunk::_sfDirection field. | |
| const Vec3f & | getDirection (void) const |
| Get the value of the LightChunk::_sfDirection field. | |
| Real32 & | getExponent (void) |
| Get the value of the LightChunk::_sfExponent field. | |
| const Real32 & | getExponent (void) const |
| Get the value of the LightChunk::_sfExponent field. | |
| Real32 & | getCutoff (void) |
| Get the value of the LightChunk::_sfCutoff field. | |
| const Real32 & | getCutoff (void) const |
| Get the value of the LightChunk::_sfCutoff field. | |
| Real32 & | getConstantAttenuation (void) |
| Get the value of the LightChunk::_sfConstantAttenuation field. | |
| const Real32 & | getConstantAttenuation (void) const |
| Get the value of the LightChunk::_sfConstantAttenuation field. | |
| Real32 & | getLinearAttenuation (void) |
| Get the value of the LightChunk::_sfLinearAttenuation field. | |
| const Real32 & | getLinearAttenuation (void) const |
| Get the value of the LightChunk::_sfLinearAttenuation field. | |
| Real32 & | getQuadraticAttenuation (void) |
| Get the value of the LightChunk::_sfQuadraticAttenuation field. | |
| const Real32 & | getQuadraticAttenuation (void) const |
| Get the value of the LightChunk::_sfQuadraticAttenuation field. | |
Field Set | |
| *void | setDiffuse (const Color4f &value) |
| Set the value of the LightChunk::_sfDiffuse field. | |
| void | setAmbient (const Color4f &value) |
| Set the value of the LightChunk::_sfAmbient field. | |
| void | setSpecular (const Color4f &value) |
| Set the value of the LightChunk::_sfSpecular field. | |
| void | setPosition (const Vec4f &value) |
| Set the value of the LightChunk::_sfPosition field. | |
| void | setDirection (const Vec3f &value) |
| Set the value of the LightChunk::_sfDirection field. | |
| void | setExponent (const Real32 &value) |
| Set the value of the LightChunk::_sfExponent field. | |
| void | setCutoff (const Real32 &value) |
| Set the value of the LightChunk::_sfCutoff field. | |
| void | setConstantAttenuation (const Real32 &value) |
| Set the value of the LightChunk::_sfConstantAttenuation field. | |
| void | setLinearAttenuation (const Real32 &value) |
| Set the value of the LightChunk::_sfLinearAttenuation field. | |
| void | setQuadraticAttenuation (const Real32 &value) |
| Set the value of the LightChunk::_sfQuadraticAttenuation 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 | |
Static Chunk Class Access | |
| *static UInt32 | getStaticClassId (void) |
| static const StateChunkClass * | getStaticClass (void) |
Class Get | |
| *static FieldContainerType & | getClassType (void) |
| access the type of the class | |
| static UInt32 | getClassTypeId (void) |
| access the numerical type of the class | |
Construction | |
| *static LightChunkPtr | create (void) |
| create a new instance of the class | |
| static LightChunkPtr | createEmpty (void) |
| create an empty new instance of the class, do not copy the prototype | |
Static Public Attributes | |
| static const osg::BitVector | DiffuseFieldMask |
| static const osg::BitVector | AmbientFieldMask |
| static const osg::BitVector | SpecularFieldMask |
| static const osg::BitVector | PositionFieldMask |
| static const osg::BitVector | DirectionFieldMask |
| static const osg::BitVector | ExponentFieldMask |
| static const osg::BitVector | CutoffFieldMask |
| static const osg::BitVector | ConstantAttenuationFieldMask |
| static const osg::BitVector | LinearAttenuationFieldMask |
| static const osg::BitVector | QuadraticAttenuationFieldMask |
| static const osg::BitVector | MTInfluenceMask |
| static const BitVector | InternalFieldMask = (1 << Attachment::InternalFieldId) |
| static const BitVector | ParentsFieldMask = (1 << Attachment::ParentsFieldId) |
| static const BitVector | NextFieldMask |
Protected Member Functions | |
Constructors | |
| * | LightChunk (void) |
| LightChunk (const LightChunk &source) | |
Destructors | |
| *virtual | ~LightChunk (void) |
Sync | |
| *void | executeSyncImpl (LightChunkBase *pOther, const BitVector &whichField) |
| virtual void | executeSync (FieldContainer &other, const BitVector &whichField) |
Protected Attributes | |
Fields | |
| *SFColor4f | _sfDiffuse |
| SFColor4f | _sfAmbient |
| SFColor4f | _sfSpecular |
| SFVec4f | _sfPosition |
| SFVec3f | _sfDirection |
| SFReal32 | _sfExponent |
| SFReal32 | _sfCutoff |
| SFReal32 | _sfConstantAttenuation |
| SFReal32 | _sfLinearAttenuation |
| SFReal32 | _sfQuadraticAttenuation |
Private Types | |
| typedef LightChunkBase | Inherited |
Private Member Functions | |
| void | operator= (const LightChunk &source) |
Static Private Member Functions | |
| static void | initMethod (void) |
Static Private Attributes | |
| static char | cvsid [] |
| static StateChunkClass | _class |
Friends | |
| class | FieldContainer |
| class | LightChunkBase |
This chunk wraps glLight() (osg::LightChunk::_sfAmbient, osg::LightChunk::_sfDiffuse, osg::LightChunk::_sfSpecular, osg::LightChunk::_sfEmission, osg::LightChunk::_sfPosition, osg::LightChunk::_sfDirection, osg::LightChunk::_sfExponent, osg::LightChunk::_sfCutoff, osg::LightChunk::_sfConstantAttenuation, osg::LightChunk::_sfLinearAttenuation, osg::LightChunk::_sfQuadraticAttenuation).
Definition at line 55 of file OSGLightChunk.h.
|
|
Reimplemented from osg::LightChunkBase. Definition at line 138 of file OSGLightChunk.h. |
|
|
Reimplemented from osg::StateChunkBase. Definition at line 99 of file OSGLightChunkBase.h. |
|
|
Reimplemented from osg::Attachment. Definition at line 101 of file OSGLightChunkBase.h. 00102 { 00103 DiffuseFieldId = Inherited::NextFieldId, 00104 AmbientFieldId = DiffuseFieldId + 1, 00105 SpecularFieldId = AmbientFieldId + 1, 00106 PositionFieldId = SpecularFieldId + 1, 00107 DirectionFieldId = PositionFieldId + 1, 00108 ExponentFieldId = DirectionFieldId + 1, 00109 CutoffFieldId = ExponentFieldId + 1, 00110 ConstantAttenuationFieldId = CutoffFieldId + 1, 00111 LinearAttenuationFieldId = ConstantAttenuationFieldId + 1, 00112 QuadraticAttenuationFieldId = LinearAttenuationFieldId + 1, 00113 NextFieldId = QuadraticAttenuationFieldId + 1 00114 };
|
|
|
Definition at line 104 of file OSGLightChunk.cpp. 00104 : 00105 Inherited() 00106 { 00107 }
|
|
|
Definition at line 109 of file OSGLightChunk.cpp. 00109 : 00110 Inherited(source) 00111 { 00112 }
|
|
|
Definition at line 114 of file OSGLightChunk.cpp.
|
|
|
Reimplemented from osg::StateChunk. Definition at line 120 of file OSGLightChunk.cpp. References _class. 00121 { 00122 return &_class; 00123 }
|
|
|
Reimplemented from osg::StateChunk. Definition at line 46 of file OSGLightChunk.inl. References osg::StateChunkClass::getId(), and getStaticClass(). 00047 { 00048 return getStaticClass()->getId(); 00049 }
|
|
|
Reimplemented from osg::StateChunk. Definition at line 52 of file OSGLightChunk.inl. References _class. Referenced by getStaticClassId(). 00053 { 00054 return &LightChunk::_class; 00055 }
|
|
||||||||||||
|
Reimplemented from osg::StateChunk. Definition at line 127 of file OSGLightChunk.cpp. References osg::StateChunk::changed(). 00128 { 00129 Inherited::changed(whichField, origin); 00130 }
|
|
||||||||||||
|
Reimplemented from osg::StateChunk. Definition at line 134 of file OSGLightChunk.cpp. References SLOG. 00136 { 00137 SLOG << "Dump LightChunk NI" << std::endl; 00138 }
|
|
||||||||||||
|
Activate the chunk, i.e. set the OpenGl state covered by the chunk which is different from the default state to the given state. Reimplemented from osg::StateChunk. Definition at line 143 of file OSGLightChunk.cpp. References osg::LightChunkBase::_sfAmbient, osg::LightChunkBase::_sfConstantAttenuation, osg::LightChunkBase::_sfCutoff, osg::LightChunkBase::_sfDiffuse, osg::LightChunkBase::_sfDirection, osg::LightChunkBase::_sfExponent, osg::LightChunkBase::_sfLinearAttenuation, osg::LightChunkBase::_sfPosition, osg::LightChunkBase::_sfQuadraticAttenuation, osg::LightChunkBase::_sfSpecular, osg::SField< FieldTypeT, fieldNameSpace >::getValue(), and glErr. 00144 { 00145 glErr("light:activate:precheck"); 00146 00147 glLightfv(GL_LIGHT0 + index, GL_DIFFUSE, 00148 _sfDiffuse.getValue().getValuesRGBA()); 00149 glLightfv(GL_LIGHT0 + index, GL_AMBIENT, 00150 _sfAmbient.getValue().getValuesRGBA()); 00151 glLightfv(GL_LIGHT0 + index, GL_SPECULAR, 00152 _sfSpecular.getValue().getValuesRGBA()); 00153 glLightfv(GL_LIGHT0 + index, GL_POSITION, 00154 _sfPosition.getValue().getValues()); 00155 glLightf (GL_LIGHT0 + index, GL_CONSTANT_ATTENUATION, 00156 _sfConstantAttenuation.getValue()); 00157 glLightf (GL_LIGHT0 + index, GL_LINEAR_ATTENUATION, 00158 _sfLinearAttenuation.getValue()); 00159 glLightf (GL_LIGHT0 + index, GL_QUADRATIC_ATTENUATION, 00160 _sfQuadraticAttenuation.getValue()); 00161 00162 glLightf( GL_LIGHT0 + index, GL_SPOT_CUTOFF, _sfCutoff.getValue()); 00163 00164 if(_sfCutoff.getValue() < 180) 00165 { 00166 glLightfv(GL_LIGHT0 + index, GL_SPOT_DIRECTION, 00167 _sfDirection.getValue().getValues()); 00168 glLightf( GL_LIGHT0 + index, GL_SPOT_EXPONENT, _sfExponent.getValue()); 00169 } 00170 glEnable(GL_LIGHT0 + index); 00171 00172 glErr("light:activate:postcheck"); 00173 }
|
|
||||||||||||||||
|
Change from an old chunk of the same type to this chunk. Note that in general no type checking is done, make sure to use this on a legal combination of chunks! Reimplemented from osg::StateChunk. Definition at line 175 of file OSGLightChunk.cpp. References osg::LightChunkBase::_sfAmbient, osg::LightChunkBase::_sfConstantAttenuation, osg::LightChunkBase::_sfCutoff, osg::LightChunkBase::_sfDiffuse, osg::LightChunkBase::_sfDirection, osg::LightChunkBase::_sfExponent, osg::LightChunkBase::_sfLinearAttenuation, osg::LightChunkBase::_sfPosition, osg::LightChunkBase::_sfQuadraticAttenuation, osg::LightChunkBase::_sfSpecular, osg::SField< FieldTypeT, fieldNameSpace >::getValue(), and glErr. 00176 { 00177 glErr("light:changed:precheck"); 00178 00179 LightChunk const *old = dynamic_cast<LightChunk const*>(old_chunk); 00180 00181 // change from me to me? 00182 // this assumes I haven't changed in the meantime. is that a valid assumption? 00183 if(old == this) 00184 return; 00185 00186 // it could theoretically be more efficient to turn the light off before 00187 // changing its parameters, have to try that sometime 00188 glLightfv(GL_LIGHT0 + index, GL_DIFFUSE, 00189 _sfDiffuse.getValue().getValuesRGBA()); 00190 glLightfv(GL_LIGHT0 + index, GL_AMBIENT, 00191 _sfAmbient.getValue().getValuesRGBA()); 00192 glLightfv(GL_LIGHT0 + index, GL_SPECULAR, 00193 _sfSpecular.getValue().getValuesRGBA()); 00194 glLightfv(GL_LIGHT0 + index, GL_POSITION, 00195 _sfPosition.getValue().getValues()); 00196 glLightf (GL_LIGHT0 + index, GL_CONSTANT_ATTENUATION, 00197 _sfConstantAttenuation.getValue()); 00198 glLightf (GL_LIGHT0 + index, GL_LINEAR_ATTENUATION, 00199 _sfLinearAttenuation.getValue()); 00200 glLightf (GL_LIGHT0 + index, GL_QUADRATIC_ATTENUATION, 00201 _sfQuadraticAttenuation.getValue()); 00202 00203 glLightf( GL_LIGHT0 + index, GL_SPOT_CUTOFF, _sfCutoff.getValue()); 00204 if(_sfCutoff.getValue() < 180) 00205 { 00206 glLightfv(GL_LIGHT0 + index, GL_SPOT_DIRECTION, 00207 _sfDirection.getValue().getValues()); 00208 glLightf( GL_LIGHT0 + index, GL_SPOT_EXPONENT, _sfExponent.getValue()); 00209 } 00210 00211 glErr("light:changed:postcheck"); 00212 }
|
|
||||||||||||
|
Deactivate the chunk, i.e. set the OpenGl state covered by the chunk which is different from the default state to the default state. Reimplemented from osg::StateChunk. Definition at line 214 of file OSGLightChunk.cpp.
|
|
|
Calculate how expensive it is to switch from one instance of the chunk class to another. In most cases not implemented yet, will return 0. Reimplemented from osg::StateChunk. Definition at line 222 of file OSGLightChunk.cpp.
|
|
|
Calculate how expensive it is to switch from one instance of the chunk class to another. In most cases not implemented yet, will return 0. Reimplemented from osg::StateChunk. Definition at line 227 of file OSGLightChunk.cpp.
|
|
|
|
Calculate how expensive it is to switch from one instance of the chunk class to another. In most cases not implemented yet, will return 0. Reimplemented from osg::StateChunk. Definition at line 258 of file OSGLightChunk.cpp.
|
|
|
Reimplemented from osg::StateChunk. Definition at line 89 of file OSGLightChunk.cpp.
|
|
|
|
|
|
Reimplemented from osg::StateChunkBase. Definition at line 58 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_type. Referenced by osg::LightChunkBase::create(). 00059 { 00060 return _type; 00061 }
|
|
|
Reimplemented from osg::StateChunkBase. Definition at line 65 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_type, and osg::TypeBase::getId(). 00066 { 00067 return _type.getId(); 00068 }
|
|
|
Reimplemented from osg::StateChunkBase. Definition at line 205 of file OSGLightChunkBase.cpp. References osg::LightChunkBase::_type. 00206 { 00207 return _type; 00208 }
|
|
|
Reimplemented from osg::StateChunkBase. Definition at line 210 of file OSGLightChunkBase.cpp. References osg::LightChunkBase::_type. 00211 { 00212 return _type; 00213 }
|
|
|
Reimplemented from osg::StateChunkBase. Definition at line 225 of file OSGLightChunkBase.cpp. 00226 { 00227 return sizeof(LightChunk); 00228 }
|
|
|
Definition at line 101 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_sfDiffuse. 00102 { 00103 return &_sfDiffuse; 00104 }
|
|
|
Definition at line 108 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_sfAmbient. 00109 { 00110 return &_sfAmbient; 00111 }
|
|
|
Definition at line 115 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_sfSpecular. 00116 { 00117 return &_sfSpecular; 00118 }
|
|
|
Definition at line 122 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_sfPosition. 00123 { 00124 return &_sfPosition; 00125 }
|
|
|
Definition at line 129 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_sfDirection. 00130 { 00131 return &_sfDirection; 00132 }
|
|
|
Definition at line 136 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_sfExponent. 00137 { 00138 return &_sfExponent; 00139 }
|
|
|
Definition at line 143 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_sfCutoff. 00144 { 00145 return &_sfCutoff; 00146 }
|
|
|
Definition at line 150 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_sfConstantAttenuation. 00151 { 00152 return &_sfConstantAttenuation; 00153 }
|
|
|
Definition at line 157 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_sfLinearAttenuation. 00158 { 00159 return &_sfLinearAttenuation; 00160 }
|
|
|
Definition at line 164 of file OSGLightChunkBase.inl. References osg::LightChunkBase::_sfQuadraticAttenuation. 00165 { 00166 return &_sfQuadraticAttenuation; 00167 }
|
|
|
Definition at line 172 of file OSGLightChunkBase.inl. References |