#include <OSGShaderChunk.h>
Inheritance diagram for osg::ShaderChunk:

Chunk Class Access | |
| *UInt32 | getClassId (void) const |
| virtual const StateChunkClass * | getClass (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 |
General Fieldcontainer Declaration | |
| virtual osg::FieldContainerPtr | shallowCopy (void) const |
| static AttachmentPtr | create (void) |
| static AttachmentPtr | createEmpty (void) |
Public Types | |
| typedef ShaderChunkPtr | Ptr |
| enum | { VertexProgramFieldId = Inherited::NextFieldId, FragmentProgramFieldId = VertexProgramFieldId + 1, NextFieldId = FragmentProgramFieldId + 1 } |
Public Member Functions | |
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) |
FieldContainer Get | |
| *virtual FieldContainerType & | getType (void) |
| virtual const FieldContainerType & | getType (void) const |
| virtual UInt32 | getContainerSize (void) const |
Field Get | |
| *SFString * | getSFVertexProgram (void) |
| Get the ShaderChunk::_sfVertexProgram field. | |
| SFString * | getSFFragmentProgram (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. | |
Binary Access | |
| *virtual UInt32 | getBinSize (const BitVector &whichField) |
| virtual void | copyToBin (BinaryDataHandler &pMem, const BitVector &whichField) |
| virtual void | copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField) |
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 | |
| *MFShaderParameterPtr * | getMFParameters (void) |
| Get the ShaderParameterChunk::_mfParameters field. | |
| ShaderParameterPtr & | getParameters (const UInt32 index) |
| Get the value of the index element the ShaderParameterChunk::_mfParameters field. | |
| MFShaderParameterPtr & | getParameters (void) |
| Get the ShaderParameterChunk::_mfParameters field. | |
| const MFShaderParameterPtr & | getParameters (void) const |
| Get the ShaderParameterChunk::_mfParameters field. | |
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 |
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 | |
| *MFShaderParameterPtr * | getMFParameters (void) |
| Get the ShaderParameterChunk::_mfParameters field. | |
| ShaderParameterPtr & | getParameters (const UInt32 index) |
| Get the value of the index element the ShaderParameterChunk::_mfParameters field. | |
| MFShaderParameterPtr & | getParameters (void) |
| Get the ShaderParameterChunk::_mfParameters field. | |
| const MFShaderParameterPtr & | getParameters (void) const |
| Get the ShaderParameterChunk::_mfParameters field. | |
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 |
Static Public Member Functions | |
Class Get | |
| *static FieldContainerType & | getClassType (void) |
| access the type of the class | |
| static UInt32 | getClassTypeId (void) |
| access the numerical type of the class | |
Static Chunk Class Access | |
| *static UInt32 | getStaticClassId (void) |
| static const StateChunkClass * | getStaticClass (void) |
Static Chunk Class Access | |
| *static UInt32 | getStaticClassId (void) |
| static const StateChunkClass * | getStaticClass (void) |
Static Public Attributes | |
| static const osg::BitVector | VertexProgramFieldMask |
| static const osg::BitVector | FragmentProgramFieldMask |
| static const osg::BitVector | MTInfluenceMask |
| 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) |
Constructors | |
| * | ShaderChunk (void) |
| ShaderChunk (const ShaderChunk &source) | |
Destructors | |
| *virtual | ~ShaderChunk (void) |
Sync | |
| *void | executeSyncImpl (ShaderChunkBase *pOther, const BitVector &whichField) |
| virtual void | executeSync (FieldContainer &other, const BitVector &whichField) |
Sync | |
| *void | executeSyncImpl (ShaderParameterChunkBase *pOther, const BitVector &whichField) |
Protected Attributes | |
Fields | |
| *SFString | _sfVertexProgram |
| SFString | _sfFragmentProgram |
Parameter Access | |
| *ShaderParameterAccess * | _parameter_access |
Fields | |
| *MFShaderParameterPtr | _mfParameters |
Parameter Access | |
| *ShaderParameterAccess * | _parameter_access |
Fields | |
| *MFShaderParameterPtr | _mfParameters |
Private Types | |
| typedef ShaderChunkBase | Inherited |
Private Member Functions | |
| void | operator= (const ShaderChunk &source) |
Static Private Member Functions | |
| static void | initMethod (void) |
Friends | |
| class | FieldContainer |
| class | ShaderChunkBase |
Definition at line 56 of file OSGShaderChunk.h.
|
|
Reimplemented from osg::ShaderChunkBase. Reimplemented in osg::SHLChunk, and osg::SHLChunkBase. Definition at line 60 of file OSGShaderChunk.h. |
|
|
Reimplemented from osg::ShaderParameterChunkBase. Reimplemented in osg::SHLChunkBase. Definition at line 91 of file OSGShaderChunkBase.h. |
|
|
Reimplemented from osg::ShaderParameterChunkBase. Definition at line 93 of file OSGShaderChunkBase.h. 00094 { 00095 VertexProgramFieldId = Inherited::NextFieldId, 00096 FragmentProgramFieldId = VertexProgramFieldId + 1, 00097 NextFieldId = FragmentProgramFieldId + 1 00098 };
|
|
|
Definition at line 83 of file OSGShaderChunk.cpp. 00083 : 00084 Inherited() 00085 { 00086 }
|
|
|
Definition at line 88 of file OSGShaderChunk.cpp. 00088 : 00089 Inherited(source) 00090 { 00091 }
|
|
|
Definition at line 93 of file OSGShaderChunk.cpp.
|
|
||||||||||||
|
Reimplemented from osg::ShaderParameterChunk. Reimplemented in osg::SHLChunk. Definition at line 99 of file OSGShaderChunk.cpp. References osg::ShaderParameterChunk::changed(). Referenced by osg::SHLChunk::changed(). 00100 { 00101 Inherited::changed(whichField, origin); 00102 }
|
|
||||||||||||
|
Reimplemented from osg::ShaderParameterChunk. Reimplemented in osg::SHLChunk. Definition at line 104 of file OSGShaderChunk.cpp. References SLOG. 00106 { 00107 SLOG << "Dump ShaderChunk NI" << std::endl; 00108 }
|
|
|
Read the program string from the given file Definition at line 114 of file OSGShaderChunk.cpp. References FWARNING. 00115 { 00116 std::ifstream s(file); 00117 00118 if(s.good()) 00119 { 00120 return readVertexProgram(s); 00121 } 00122 else 00123 { 00124 FWARNING(("ShaderChunk::readVertexProgram: couldn't open '%s' for reading!\n", 00125 file)); 00126 return false; 00127 } 00128 }
|
|
|
Read the program string from the given stream Definition at line 132 of file OSGShaderChunk.cpp. References BUFSIZE, FWARNING, and osg::ShaderChunkBase::getVertexProgram(). 00133 { 00134 #define BUFSIZE 200 00135 00136 getVertexProgram().erase(); 00137 char buf[BUFSIZE]; 00138 00139 if(!stream.good()) 00140 { 00141 FWARNING(("SHLChunk::readVertexProgram: stream is not good!\n")); 00142 return false; 00143 } 00144 00145 do 00146 { 00147 stream.read(buf, BUFSIZE); 00148 getVertexProgram().append(buf, stream.gcount()); 00149 } 00150 while(!stream.eof()); 00151 00152 return true; 00153 }
|
|
|
Read the program string from the given file Definition at line 157 of file OSGShaderChunk.cpp. References FWARNING. 00158 { 00159 std::ifstream s(file); 00160 00161 if(s.good()) 00162 { 00163 return readFragmentProgram(s); 00164 } 00165 else 00166 { 00167 FWARNING(("ShaderChunk::readFragmentProgram: couldn't open '%s' for reading!\n", 00168 file)); 00169 return false; 00170 } 00171 }
|
|
|
Read the program string from the given stream Definition at line 175 of file OSGShaderChunk.cpp. References BUFSIZE, FWARNING, and osg::ShaderChunkBase::getFragmentProgram(). 00176 { 00177 #define BUFSIZE 200 00178 00179 getFragmentProgram().erase(); 00180 char buf[BUFSIZE]; 00181 00182 if(!stream.good()) 00183 { 00184 FWARNING(("SHLChunk::readFragmentProgram: stream is not good!\n")); 00185 return false; 00186 } 00187 00188 do 00189 { 00190 stream.read(buf, BUFSIZE); 00191 getFragmentProgram().append(buf, stream.gcount()); 00192 } 00193 while(!stream.eof()); 00194 00195 return true; 00196 }
|
|
|
Reimplemented from osg::ShaderParameterChunk. Reimplemented in osg::SHLChunk. Definition at line 68 of file OSGShaderChunk.cpp.
|
|
|
|
|
|
Reimplemented from osg::ShaderParameterChunkBase. Reimplemented in osg::SHLChunkBase. Definition at line 58 of file OSGShaderChunkBase.inl. References osg::ShaderChunkBase::_type. 00059 { 00060 return _type; 00061 }
|
|
|
Reimplemented from osg::ShaderParameterChunkBase. Reimplemented in osg::SHLChunkBase. Definition at line 65 of file OSGShaderChunkBase.inl. References osg::ShaderChunkBase::_type, and osg::TypeBase::getId(). 00066 { 00067 return _type.getId(); 00068 }
|
|
|
Reimplemented from osg::ShaderParameterChunkBase. Reimplemented in osg::SHLChunkBase. Definition at line 117 of file OSGShaderChunkBase.cpp. References osg::ShaderChunkBase::_type. 00118 { 00119 return _type; 00120 }
|
|
|
Reimplemented from osg::ShaderParameterChunkBase. Reimplemented in osg::SHLChunkBase. Definition at line 122 of file OSGShaderChunkBase.cpp. References osg::ShaderChunkBase::_type. 00123 { 00124 return _type; 00125 }
|
|
|
Reimplemented from osg::ShaderParameterChunkBase. Reimplemented in osg::SHLChunkBase. Definition at line 128 of file OSGShaderChunkBase.cpp. 00129 { 00130 return sizeof(ShaderChunk); 00131 }
|
|
|
Definition at line 75 of file OSGShaderChunkBase.inl. References osg::ShaderChunkBase::_sfVertexProgram. 00076 { 00077 return &_sfVertexProgram; 00078 }
|
|
|
Definition at line 82 of file OSGShaderChunkBase.inl. References osg::ShaderChunkBase::_sfFragmentProgram. 00083 { 00084 return &_sfFragmentProgram; 00085 }
|
|
|
Definition at line 90 of file OSGShaderChunkBase.inl. References osg::ShaderChunkBase::_sfVertexProgram, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). Referenced by osg::SHLChunk::operator==(), readVertexProgram(), and osg::SHLChunk::updateProgram(). 00091 { 00092 return _sfVertexProgram.getValue(); 00093 }
|
|
|
Definition at line 97 of file OSGShaderChunkBase.inl. References osg::ShaderChunkBase::_sfVertexProgram, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). 00098 { 00099 return _sfVertexProgram.getValue(); 00100 }
|
|
|
Definition at line 111 of file OSGShaderChunkBase.inl. References osg::ShaderChunkBase::_sfFragmentProgram, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). Referenced by osg::SHLChunk::operator==(), readFragmentProgram(), and osg::SHLChunk::updateProgram(). 00112 { 00113 return _sfFragmentProgram.getValue(); 00114 }
|
|
|
Definition at line 118 of file OSGShaderChunkBase.inl. References osg::ShaderChunkBase::_sfFragmentProgram, and osg::SField< FieldTypeT, fieldNameSpace >::getValue(). 00119 { 00120 return _sfFragmentProgram.getValue(); 00121 }
|
|
|
Definition at line 104 of file OSGShaderChunkBase.inl. References osg::ShaderChunkBase::_sfVertexProgram, and osg::SField< FieldTypeT, fieldNameSpace >::setValue(). 00105 { 00106 _sfVertexProgram.setValue(value); 00107 }
|
|
|
Definition at line 125 of file OSGShaderChunkBase.inl. References osg::ShaderChunkBase::_sfFragmentProgram, and osg::SField< FieldTypeT, fieldNameSpace >::setValue(). 00126 { 00127 _sfFragmentProgram.setValue(value); 00128 }
|
|
|
Reimplemented from osg::ShaderParameterChunkBase. Reimplemented in osg::SHLChunkBase. Definition at line 192 of file OSGShaderChunkBase.cpp. References osg::ShaderChunkBase::_sfFragmentProgram, osg::ShaderChunkBase::_sfVertexProgram, osg::ShaderChunkBase::FragmentProgramFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::ShaderParameterChunkBase::getBinSize(), osg::FieldBits::NoField, and osg::ShaderChunkBase::VertexProgramFieldMask. Referenced by osg::SHLChunkBase::getBinSize(). 00193 { 00194 UInt32 returnValue = Inherited::getBinSize(whichField); 00195 00196 if(FieldBits::NoField != (VertexProgramFieldMask & whichField)) 00197 { 00198 returnValue += _sfVertexProgram.getBinSize(); 00199 } 00200 00201 if(FieldBits::NoField != (FragmentProgramFieldMask & whichField)) 00202 { 00203 returnValue += _sfFragmentProgram.getBinSize(); 00204 } 00205 00206 00207 return returnValue; 00208 }
|
|
||||||||||||
|
Reimplemented from osg::ShaderParameterChunkBase. Reimplemented in osg::SHLChunkBase. Definition at line 210 of file OSGShaderChunkBase.cpp. References osg::ShaderChunkBase::_sfFragmentProgram, osg::ShaderChunkBase::_sfVertexProgram, osg::SField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::ShaderParameterChunkBase::copyToBin(), osg::ShaderChunkBase::FragmentProgramFieldMask, osg::FieldBits::NoField, and osg::ShaderChunkBase::VertexProgramFieldMask. Referenced by osg::SHLChunkBase::copyToBin(). 00212 { 00213 Inherited::copyToBin(pMem, whichField); 00214 00215 if(FieldBits::NoField != (VertexProgramFieldMask & whichField)) 00216 { 00217 _sfVertexProgram.copyToBin(pMem); 00218 } 00219 00220 if(FieldBits::NoField != (FragmentProgramFieldMask & whichField)) 00221 { 00222 _sfFragmentProgram.copyToBin(pMem); 00223 } 00224 00225 00226 }
|
|
||||||||||||
|
Reimplemented from osg::ShaderParameterChunkBase. Reimplemented in osg::SHLChunkBase. Definition at line 228 of file OSGShaderChunkBase.cpp. References osg::ShaderChunkBase::_sfFragmentProgram, osg::ShaderChunkBase::_sfVertexProgram, osg::SField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::ShaderParameterChunkBase::copyFromBin(), osg::ShaderChunkBase::FragmentProgramFieldMask, osg::FieldBits::NoField, and osg::ShaderChunkBase::VertexProgramFieldMask. Referenced by osg::SHLChunkBase::copyFromBin(). 00230 { 00231 Inherited::copyFromBin(pMem, whichField); 00232 00233 if(FieldBits::NoField != (VertexProgramFieldMask & whichField)) 00234 { 00235 _sfVertexProgram.copyFromBin(pMem); 00236 } 00237 00238 if(FieldBits::NoField != (FragmentProgramFieldMask & whichField)) 00239 { 00240 _sfFragmentProgram.copyFromBin(pMem); 00241 } 00242 00243 00244 }
|
|
||||||||||||
|
Definition at line 247 of file OSGShaderChunkBase.cpp. References osg::ShaderChunkBase::_sfFragmentProgram, osg::ShaderChunkBase::_sfVertexProgram, osg::ShaderParameterChunkBase::executeSyncImpl(), osg::ShaderChunkBase::FragmentProgramFieldMask, osg::FieldBits::NoField, osg::SField< FieldTypeT, fieldNameSpace >::syncWith(), and osg::ShaderChunkBase::VertexProgramFieldMask. Referenced by osg::ShaderChunkBase::executeSync(), and osg::SHLChunkBase::executeSyncImpl(). 00249 { 00250 00251 Inherited::executeSyncImpl(pOther, whichField); 00252 00253 if(FieldBits::NoField != (VertexProgramFieldMask & whichField)) 00254 _sfVertexProgram.syncWith(pOther->_sfVertexProgram); 00255 00256 if(FieldBits::NoField != (FragmentProgramFieldMask & whichField)) 00257 _sfFragmentProgram.syncWith(pOther->_sfFragmentProgram); 00258 00259 00260 }
|
|
||||||||||||
|
Definition at line 220 of file OSGShaderParameterChunkBase.cpp. References osg::ShaderParameterChunkBase::_mfParameters, osg::StateChunkBase::executeSyncImpl(), osg::FieldBits::NoField, osg::ShaderParameterChunkBase::ParametersFieldMask, and osg::MField< FieldTypeT, fieldNameSpace >::syncWith(). Referenced by osg::ShaderParameterChunkBase::executeSync(), osg::SHLParameterChunkBase::executeSyncImpl(), and osg::ShaderChunkBase::executeSyncImpl(). 00222 { 00223 00224 Inherited::executeSyncImpl(pOther, whichField); 00225 00226 if(FieldBits::NoField != (ParametersFieldMask & whichField)) 00227 _mfParameters.syncWith(pOther->_mfParameters); 00228 00229 00230 }
|
|
||||||||||||
|
||||||||||||
|
||||||||||||
|
Definition at line 333 of file OSGFieldContainerImpl.inl. Referenced by osg::StateBase::executeSyncImpl(), osg::DVRShaderBase::executeSyncImpl(), osg::DVRClipGeometryBase::executeSyncImpl(), osg::AttachmentContainer::executeSyncImpl(), and osg::Attachment::executeSyncImpl().
|
|