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

osg::SHLChunkBase Class Reference

SHLChunk Base Class.

#include <OSGSHLChunkBase.h>

Inheritance diagram for osg::SHLChunkBase:

osg::ShaderChunk osg::ShaderChunkBase osg::ShaderParameterChunk osg::ShaderParameterChunkBase osg::StateChunk osg::StateChunkBase osg::Attachment osg::FieldContainer osg::SHLChunk List of all members.

Public Types

typedef SHLChunkPtr Ptr
enum  { CgFrontEndFieldId = Inherited::NextFieldId, GLIdFieldId = CgFrontEndFieldId + 1, NextFieldId = GLIdFieldId + 1 }

Public Member Functions

Field Get
*SFStringgetSFVertexProgram (void)
 Get the ShaderChunk::_sfVertexProgram field.
SFStringgetSFFragmentProgram (void)
 Get the ShaderChunk::_sfFragmentProgram field.
std::string & getVertexProgram (void)
 Get the value of the ShaderChunk::_sfVertexProgram field.
const std::string & getVertexProgram (void) const
 Get the value of the ShaderChunk::_sfVertexProgram field.
std::string & getFragmentProgram (void)
 Get the value of the ShaderChunk::_sfFragmentProgram field.
const std::string & getFragmentProgram (void) const
 Get the value of the ShaderChunk::_sfFragmentProgram field.
Field Set
*void setVertexProgram (const std::string &value)
 Set the value of the ShaderChunk::_sfVertexProgram field.
void setFragmentProgram (const std::string &value)
 Set the value of the ShaderChunk::_sfFragmentProgram field.
ShaderParameterChunk Access
*bool setUniformParameter (const char *name, bool value)
bool setUniformParameter (const char *name, Int32 value)
bool setUniformParameter (const char *name, Real32 value)
bool setUniformParameter (const char *name, const Vec2f &value)
bool setUniformParameter (const char *name, const Vec3f &value)
bool setUniformParameter (const char *name, const Vec4f &value)
bool setUniformParameter (const char *name, const Matrix &value)
bool getUniformParameter (const char *name, bool &value)
bool getUniformParameter (const char *name, Int32 &value)
bool getUniformParameter (const char *name, Real32 &value)
bool getUniformParameter (const char *name, Vec2f &value)
bool getUniformParameter (const char *name, Vec3f &value)
bool getUniformParameter (const char *name, Vec4f &value)
bool getUniformParameter (const char *name, Matrix &value)
bool subUniformParameter (const char *name)
Field Get
*MFShaderParameterPtrgetMFParameters (void)
 Get the ShaderParameterChunk::_mfParameters field.
ShaderParameterPtrgetParameters (const UInt32 index)
 Get the value of the index element the ShaderParameterChunk::_mfParameters field.
MFShaderParameterPtrgetParameters (void)
 Get the ShaderParameterChunk::_mfParameters field.
const MFShaderParameterPtrgetParameters (void) const
 Get the ShaderParameterChunk::_mfParameters field.
Chunk Class Access
*UInt32 getClassId (void) const
virtual const StateChunkClassgetClass (void) const
State
*virtual void activate (DrawActionBase *action, UInt32 index=0)
virtual void changeFrom (DrawActionBase *action, StateChunk *old, UInt32 index=0)
virtual void deactivate (DrawActionBase *action, UInt32 index=0)
virtual bool isTransparent (void) const
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
Parents
*MFFieldContainerPtrgetParents (void)
const MFFieldContainerPtrgetParents (void) const
MFFieldContainerPtrgetMFParents (void)
void addParent (FieldContainerPtr parent)
void subParent (FieldContainerPtr parent)
Int32 findParent (FieldContainerPtr parent)
Parents
*SFBoolgetInternal (void)
const SFBoolgetInternal (void) const
SFBoolgetSFInternal (void)
void setInternal (bool bVal)
FieldContainer Get
*virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get
*SFBoolgetSFCgFrontEnd (void)
 Get the SHLChunk::_sfCgFrontEnd field.
SFUInt32getSFGLId (void)
 Get the SHLChunk::_sfGLId field.
bool & getCgFrontEnd (void)
 Get the value of the SHLChunk::_sfCgFrontEnd field.
const bool & getCgFrontEnd (void) const
 Get the value of the SHLChunk::_sfCgFrontEnd field.
UInt32getGLId (void)
 Get the value of the SHLChunk::_sfGLId field.
const UInt32getGLId (void) const
 Get the value of the SHLChunk::_sfGLId field.
Field Set
*void setCgFrontEnd (const bool &value)
 Set the value of the SHLChunk::_sfCgFrontEnd field.
void setGLId (const UInt32 &value)
 Set the value of the SHLChunk::_sfGLId 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
Sync
*virtual void changed (BitVector whichField, UInt32 origin)
Output
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
ShaderChunk Access
*bool readVertexProgram (const char *file)
bool readVertexProgram (std::istream &stream)
bool readFragmentProgram (const char *file)
bool readFragmentProgram (std::istream &stream)
Field Get
*SFStringgetSFVertexProgram (void)
 Get the ShaderChunk::_sfVertexProgram field.
SFStringgetSFFragmentProgram (void)
 Get the ShaderChunk::_sfFragmentProgram field.
std::string & getVertexProgram (void)
 Get the value of the ShaderChunk::_sfVertexProgram field.
const std::string & getVertexProgram (void) const
 Get the value of the ShaderChunk::_sfVertexProgram field.
std::string & getFragmentProgram (void)
 Get the value of the ShaderChunk::_sfFragmentProgram field.
const std::string & getFragmentProgram (void) const
 Get the value of the ShaderChunk::_sfFragmentProgram field.
Field Set
*void setVertexProgram (const std::string &value)
 Set the value of the ShaderChunk::_sfVertexProgram field.
void setFragmentProgram (const std::string &value)
 Set the value of the ShaderChunk::_sfFragmentProgram field.
ShaderParameterChunk Access
*bool setUniformParameter (const char *name, bool value)
bool setUniformParameter (const char *name, Int32 value)
bool setUniformParameter (const char *name, Real32 value)
bool setUniformParameter (const char *name, const Vec2f &value)
bool setUniformParameter (const char *name, const Vec3f &value)
bool setUniformParameter (const char *name, const Vec4f &value)
bool setUniformParameter (const char *name, const Matrix &value)
bool getUniformParameter (const char *name, bool &value)
bool getUniformParameter (const char *name, Int32 &value)
bool getUniformParameter (const char *name, Real32 &value)
bool getUniformParameter (const char *name, Vec2f &value)
bool getUniformParameter (const char *name, Vec3f &value)
bool getUniformParameter (const char *name, Vec4f &value)
bool getUniformParameter (const char *name, Matrix &value)
bool subUniformParameter (const char *name)
Field Get
*MFShaderParameterPtrgetMFParameters (void)
 Get the ShaderParameterChunk::_mfParameters field.
ShaderParameterPtrgetParameters (const UInt32 index)
 Get the value of the index element the ShaderParameterChunk::_mfParameters field.
MFShaderParameterPtrgetParameters (void)
 Get the ShaderParameterChunk::_mfParameters field.
const MFShaderParameterPtrgetParameters (void) const
 Get the ShaderParameterChunk::_mfParameters field.
Chunk Class Access
*UInt32 getClassId (void) const
virtual const StateChunkClassgetClass (void) const
State
*virtual void activate (DrawActionBase *action, UInt32 index=0)
virtual void changeFrom (DrawActionBase *action, StateChunk *old, UInt32 index=0)
virtual void deactivate (DrawActionBase *action, UInt32 index=0)
virtual bool isTransparent (void) const
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
Parents
*MFFieldContainerPtrgetParents (void)
const MFFieldContainerPtrgetParents (void) const
MFFieldContainerPtrgetMFParents (void)
void addParent (FieldContainerPtr parent)
void subParent (FieldContainerPtr parent)
Int32 findParent (FieldContainerPtr parent)
Parents
*SFBoolgetInternal (void)
const SFBoolgetInternal (void) const
SFBoolgetSFInternal (void)
void setInternal (bool bVal)

Static Public Member Functions

Static Chunk Class Access
*static UInt32 getStaticClassId (void)
static const StateChunkClassgetStaticClass (void)
Class Get
*static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction
*static SHLChunkPtr create (void)
 create a new instance of the class
static SHLChunkPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype
Static Chunk Class Access
*static UInt32 getStaticClassId (void)
static const StateChunkClassgetStaticClass (void)

Static Public Attributes

static const osg::BitVector CgFrontEndFieldMask
static const osg::BitVector GLIdFieldMask
static const osg::BitVector MTInfluenceMask
static const osg::BitVector VertexProgramFieldMask
static const osg::BitVector FragmentProgramFieldMask
static const osg::BitVector ParametersFieldMask
static const BitVector InternalFieldMask = (1 << Attachment::InternalFieldId)
static const BitVector ParentsFieldMask = (1 << Attachment::ParentsFieldId)
static const BitVector NextFieldMask

Protected Member Functions

void onCreate (const ShaderParameterChunk *source=NULL)
void onDestroy (void)
Sync
*void executeSyncImpl (ShaderParameterChunkBase *pOther, const BitVector &whichField)
Sync
*void executeSyncImpl (StateChunkBase *pOther, const BitVector &whichField)
Sync
void executeSyncImpl (Attachment *pOther, const BitVector &whichField)
Constructors
SHLChunkBase (void)
 SHLChunkBase (const SHLChunkBase &source)
Destructors
*virtual ~SHLChunkBase (void)
Sync
*void executeSyncImpl (SHLChunkBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)
Sync
*void executeSyncImpl (ShaderChunkBase *pOther, const BitVector &whichField)
Sync
*void executeSyncImpl (ShaderParameterChunkBase *pOther, const BitVector &whichField)
Sync
*void executeSyncImpl (StateChunkBase *pOther, const BitVector &whichField)
Sync
void executeSyncImpl (Attachment *pOther, const BitVector &whichField)

Protected Attributes

Fields
*SFString _sfVertexProgram
SFString _sfFragmentProgram
Parameter Access
*ShaderParameterAccess_parameter_access
Fields
*MFShaderParameterPtr _mfParameters
Fields
*SFBool _sfInternal
MFFieldContainerPtr _parents
Fields
*SFBool _sfCgFrontEnd
SFUInt32 _sfGLId
Fields
*SFString _sfVertexProgram
SFString _sfFragmentProgram
Parameter Access
*ShaderParameterAccess_parameter_access
Fields
*MFShaderParameterPtr _mfParameters
Fields
*SFBool _sfInternal
MFFieldContainerPtr _parents

Private Types

typedef ShaderChunk Inherited

Private Member Functions

void operator= (const SHLChunkBase &source)

Static Private Attributes

static FieldDescription_desc []
 SHLChunk description.
static FieldContainerType _type

Friends

class FieldContainer

Detailed Description

Definition at line 82 of file OSGSHLChunkBase.h.


Member Typedef Documentation

typedef ShaderChunk osg::SHLChunkBase::Inherited [private]
 

Reimplemented from osg::ShaderChunk.

Reimplemented in osg::SHLChunk.

Definition at line 86 of file OSGSHLChunkBase.h.

typedef SHLChunkPtr osg::SHLChunkBase::Ptr
 

Reimplemented from osg::ShaderChunkBase.

Definition at line 91 of file OSGSHLChunkBase.h.


Member Enumeration Documentation

anonymous enum
 

Enumerator:
CgFrontEndFieldId 
GLIdFieldId 
NextFieldId 

Reimplemented from osg::ShaderChunkBase.

Definition at line 93 of file OSGSHLChunkBase.h.

00094     {
00095         CgFrontEndFieldId = Inherited::NextFieldId,
00096         GLIdFieldId       = CgFrontEndFieldId + 1,
00097         NextFieldId       = GLIdFieldId       + 1
00098     };


Constructor & Destructor Documentation

SHLChunkBase::SHLChunkBase void   )  [protected]
 

Definition at line 175 of file OSGSHLChunkBase.cpp.

00175                                :
00176     _sfCgFrontEnd             (bool(false)), 
00177     _sfGLId                   (), 
00178     Inherited() 
00179 {
00180 }

SHLChunkBase::SHLChunkBase const SHLChunkBase source  )  [protected]
 

Definition at line 186 of file OSGSHLChunkBase.cpp.

00186                                                      :
00187     _sfCgFrontEnd             (source._sfCgFrontEnd             ), 
00188     _sfGLId                   (source._sfGLId                   ), 
00189     Inherited                 (source)
00190 {
00191 }

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

Definition at line 195 of file OSGSHLChunkBase.cpp.

00196 {
00197 }


Member Function Documentation

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

Reimplemented from osg::ShaderChunkBase.

Definition at line 58 of file OSGSHLChunkBase.inl.

References _type.

Referenced by create(), and osg::SHLChunk::onCreate().

00059 {
00060     return _type; 
00061 } 

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

Reimplemented from osg::ShaderChunkBase.

Definition at line 65 of file OSGSHLChunkBase.inl.

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

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

FieldContainerType & SHLChunkBase::getType void   )  [virtual]
 

Reimplemented from osg::ShaderChunkBase.

Definition at line 117 of file OSGSHLChunkBase.cpp.

References _type.

00118 {
00119     return _type; 
00120 } 

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

Reimplemented from osg::ShaderChunkBase.

Definition at line 122 of file OSGSHLChunkBase.cpp.

References _type.

00123 {
00124     return _type;
00125 } 

UInt32 SHLChunkBase::getContainerSize void   )  const [virtual]
 

Reimplemented from osg::ShaderChunkBase.

Definition at line 137 of file OSGSHLChunkBase.cpp.

00138 { 
00139     return sizeof(SHLChunk); 
00140 }

SFBool * osg::SHLChunkBase::getSFCgFrontEnd void   )  [inline]
 

Definition at line 101 of file OSGSHLChunkBase.inl.

References _sfCgFrontEnd.

00102 {
00103     return &_sfCgFrontEnd;
00104 }

SFUInt32 * osg::SHLChunkBase::getSFGLId void   )  [inline]
 

Definition at line 108 of file OSGSHLChunkBase.inl.

References _sfGLId.

00109 {
00110     return &_sfGLId;
00111 }

bool & osg::SHLChunkBase::getCgFrontEnd void   )  [inline]
 

Definition at line 116 of file OSGSHLChunkBase.inl.

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

Referenced by osg::SHLChunk::updateProgram().

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

const bool & osg::SHLChunkBase::getCgFrontEnd void   )  const [inline]
 

Definition at line 123 of file OSGSHLChunkBase.inl.

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

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

UInt32 & osg::SHLChunkBase::getGLId void   )  [inline]
 

Definition at line 137 of file OSGSHLChunkBase.inl.

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

Referenced by osg::SHLChunk::activate(), osg::SHLChunk::changed(), osg::SHLChunk::changeFrom(), osg::SHLChunk::deactivate(), osg::SHLChunk::onDestroy(), osg::SHLChunk::updateParameters(), and osg::SHLChunk::updateProgram().

00138 {
00139     return _sfGLId.getValue();
00140 }

const UInt32 & osg::SHLChunkBase::getGLId void   )  const [inline]
 

Definition at line 144 of file OSGSHLChunkBase.inl.

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

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

void osg::SHLChunkBase::setCgFrontEnd const bool &  value  )  [inline]
 

Definition at line 130 of file OSGSHLChunkBase.inl.

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

00131 {
00132     _sfCgFrontEnd.setValue(value);
00133 }

void osg::SHLChunkBase::setGLId const UInt32 value  )  [inline]
 

Definition at line 151 of file OSGSHLChunkBase.inl.

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

Referenced by osg::SHLChunk::onCreate().

00152 {
00153     _sfGLId.setValue(value);
00154 }

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

Reimplemented from osg::ShaderChunkBase.

Definition at line 201 of file OSGSHLChunkBase.cpp.

References _sfCgFrontEnd, _sfGLId, CgFrontEndFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::ShaderChunkBase::getBinSize(), GLIdFieldMask, and osg::FieldBits::NoField.

00202 {
00203     UInt32 returnValue = Inherited::getBinSize(whichField);
00204 
00205     if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00206     {
00207         returnValue += _sfCgFrontEnd.getBinSize();
00208     }
00209 
00210     if(FieldBits::NoField != (GLIdFieldMask & whichField))
00211     {
00212         returnValue += _sfGLId.getBinSize();
00213     }
00214 
00215 
00216     return returnValue;
00217 }

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

Reimplemented from osg::ShaderChunkBase.

Definition at line 219 of file OSGSHLChunkBase.cpp.

References _sfCgFrontEnd, _sfGLId, CgFrontEndFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::ShaderChunkBase::copyToBin(), GLIdFieldMask, and osg::FieldBits::NoField.

00221 {
00222     Inherited::copyToBin(pMem, whichField);
00223 
00224     if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00225     {
00226         _sfCgFrontEnd.copyToBin(pMem);
00227     }
00228 
00229     if(FieldBits::NoField != (GLIdFieldMask & whichField))
00230     {
00231         _sfGLId.copyToBin(pMem);
00232     }
00233 
00234 
00235 }

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

Reimplemented from osg::ShaderChunkBase.

Definition at line 237 of file OSGSHLChunkBase.cpp.

References _sfCgFrontEnd, _sfGLId, CgFrontEndFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::ShaderChunkBase::copyFromBin(), GLIdFieldMask, and osg::FieldBits::NoField.

00239 {
00240     Inherited::copyFromBin(pMem, whichField);
00241 
00242     if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00243     {
00244         _sfCgFrontEnd.copyFromBin(pMem);
00245     }
00246 
00247     if(FieldBits::NoField != (GLIdFieldMask & whichField))
00248     {
00249         _sfGLId.copyFromBin(pMem);
00250     }
00251 
00252 
00253 }

SHLChunkPtr osg::SHLChunkBase::create void   )  [inline, static]
 

Reimplemented from osg::Attachment.

Definition at line 72 of file OSGSHLChunkBase.inl.

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

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

SHLChunkPtr osg::SHLChunkBase::createEmpty void   )  [inline, static]
 

Reimplemented from osg::Attachment.

Definition at line 87 of file OSGSHLChunkBase.inl.

References osg::FieldContainer::newPtr().

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

FieldContainerPtr SHLChunkBase::shallowCopy void   )  const [virtual]
 

Reimplemented from osg::Attachment.

Definition at line 128 of file OSGSHLChunkBase.cpp.

References osg::FieldContainer::newPtr().

Referenced by create().

00129 { 
00130     SHLChunkPtr returnValue; 
00131 
00132     newPtr(returnValue, dynamic_cast<const SHLChunk *>(this)); 
00133 
00134     return returnValue; 
00135 }

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

Definition at line 256 of file OSGSHLChunkBase.cpp.

References _sfCgFrontEnd, _sfGLId, CgFrontEndFieldMask, osg::ShaderChunkBase::executeSyncImpl(), GLIdFieldMask, osg::FieldBits::NoField, and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by executeSync().

00258 {
00259 
00260     Inherited::executeSyncImpl(pOther, whichField);
00261 
00262     if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00263         _sfCgFrontEnd.syncWith(pOther->_sfCgFrontEnd);
00264 
00265     if(FieldBits::NoField != (GLIdFieldMask & whichField))
00266         _sfGLId.syncWith(pOther->_sfGLId);
00267 
00268 
00269 }

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

Reimplemented from osg::ShaderChunkBase.

Definition at line 144 of file OSGSHLChunkBase.cpp.

References executeSyncImpl().

00146 {
00147     this->executeSyncImpl((SHLChunkBase *) &other, whichField);
00148 }

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

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

Reimplemented from