#include <OSGSHLChunk.h>
Inheritance diagram for osg::SHLChunk:

Parameter Callbacks | |
| typedef void(* | paramtercbfp )(PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| *typedef | GLint (OSG_APIENTRY *PFNGLGETUNIFORMLOCATIONARBPROC)(GLuint programObj |
| void | addParameterCallback (const char *name, paramtercbfp fp) |
| *typedef const char * | name |
Public Types | |
| typedef SHLChunkPtr | Ptr |
| enum | { CgFrontEndFieldId = Inherited::NextFieldId, GLIdFieldId = CgFrontEndFieldId + 1, NextFieldId = GLIdFieldId + 1 } |
Public Member Functions | |
| virtual const StateChunkClass * | getClass (void) const |
Get Instance Type Information | |
| UInt32 | getTypeId (void) const |
| UInt16 | getGroupId (void) const |
| const Char8 * | getTypeName (void) const |
| Generic Field Access *Field * | getField (UInt32 fieldId) |
| Field * | getField (const Char8 *fieldName) |
Sync | |
| *virtual void | changed (BitVector whichField, UInt32 origin) |
Output | |
| *virtual void | dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const |
Paramerters | |
| *void | updateParameters (Window *win, const MFShaderParameterPtr ¶meters, bool useProgram=true, bool force=false, bool keepProgramActive=false) |
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) |
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 | |
| *SFBool * | getSFCgFrontEnd (void) |
| Get the SHLChunk::_sfCgFrontEnd field. | |
| SFUInt32 * | getSFGLId (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. | |
| UInt32 & | getGLId (void) |
| Get the value of the SHLChunk::_sfGLId field. | |
| const UInt32 & | getGLId (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 |
ShaderChunk Access | |
| *bool | readVertexProgram (const char *file) |
| bool | readVertexProgram (std::istream &stream) |
| bool | readFragmentProgram (const char *file) |
| bool | readFragmentProgram (std::istream &stream) |
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. | |
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. | |
Chunk Class Access | |
| *UInt32 | getClassId (void) const |
State | |
| virtual bool | isTransparent (void) const |
Parents | |
| *MFFieldContainerPtr & | getParents (void) |
| const MFFieldContainerPtr & | getParents (void) const |
| MFFieldContainerPtr * | getMFParents (void) |
| void | addParent (FieldContainerPtr parent) |
| void | subParent (FieldContainerPtr parent) |
| Int32 | findParent (FieldContainerPtr parent) |
Parents | |
| *SFBool & | getInternal (void) |
| const SFBool & | getInternal (void) const |
| SFBool * | getSFInternal (void) |
| void | setInternal (bool bVal) |
Get Instance Type Information | |
| UInt32 | getTypeId (void) const |
| UInt16 | getGroupId (void) const |
| const Char8 * | getTypeName (void) const |
| Generic Field Access *Field * | getField (UInt32 fieldId) |
| Field * | getField (const Char8 *fieldName) |
Static Public Member Functions | |
Get Class Type Information | |
| static UInt16 | getClassGroupId (void) |
Parameter funcs | |
| *static UInt32 | getFuncUniform1i (void) |
| static UInt32 | getFuncUniform2iv (void) |
| static UInt32 | getFuncUniform3iv (void) |
| static UInt32 | getFuncUniform4iv (void) |
| static UInt32 | getFuncUniform1f (void) |
| static UInt32 | getFuncUniform2fv (void) |
| static UInt32 | getFuncUniform3fv (void) |
| static UInt32 | getFuncUniform4fv (void) |
| static UInt32 | getFuncUniformMatrix4fv (void) |
| static UInt32 | getFuncGetUniformiv (void) |
| static UInt32 | getFuncGetUniformfv (void) |
Cluster | |
| *static void | setClusterId (Int32 id) |
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 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 StateChunkClass * | getStaticClass (void) |
Get Class Type Information | |
| static UInt16 | getClassGroupId (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 |
CoredNodePtr helper | |
| static const bool | isNodeCore = false |
CoredNodePtr helper | |
| static const bool | isNodeCore = false |
Protected Member Functions | |
| void | onCreate (const SHLChunk *source=NULL) |
| void | onDestroy (void) |
| void | onCreate (const ShaderParameterChunk *source=NULL) |
Sync | |
| void | executeSyncImpl (FieldContainer *pOther, const BitVector &whichField) |
MT Edit | |
| template<class FieldTypeT> | |
| *void | beginEditX (const BitVector &whichField, FieldTypeT &field) |
| template<class FieldTypeT> | |
| void | endEditX (const BitVector &whichField, FieldTypeT &field) |
MT Construction | |
| *void | onCreate (const FieldContainer *source=NULL) |
| void | onCreateAspect (const FieldContainer *aspect0, const FieldContainer *source=NULL) |
Constructors | |
| * | SHLChunk (void) |
| SHLChunk (const SHLChunk &source) | |
Destructors | |
| *virtual | ~SHLChunk (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) |
Sync | |
| void | executeSyncImpl (FieldContainer *pOther, const BitVector &whichField) |
MT Construction | |
| *void | onCreate (const FieldContainer *source=NULL) |
| void | onCreateAspect (const FieldContainer *aspect0, const FieldContainer *source=NULL) |
MT Edit | |
| template<class FieldTypeT> | |
| *void | beginEditX (const BitVector &whichField, FieldTypeT &field) |
| template<class FieldTypeT> | |
| void | endEditX (const BitVector &whichField, FieldTypeT &field) |
Static Protected Member Functions | |
Create Fieldcontainer | |
| template<class ObjectPtrT> | |
| *static void | newPtr (ObjectPtrT &result, const typename ObjectPtrT::StoredObjectType *prototypeP) |
| template<class ObjectPtrT> | |
| static void | newPtr (ObjectPtrT &result) |
Create Fieldcontainer | |
| template<class ObjectPtrT> | |
| *static void | newPtr (ObjectPtrT &result, const typename ObjectPtrT::StoredObjectType *prototypeP) |
| template<class ObjectPtrT> | |
| static void | newPtr (ObjectPtrT &result) |
Protected Attributes | |
Member | |
| *UInt32 | _shares |
Fields | |
| *SFBool | _sfCgFrontEnd |
| SFUInt32 | _sfGLId |
Fields | |
| *SFString | _sfVertexProgram |
| SFString | _sfFragmentProgram |
Parameter Access | |
| *ShaderParameterAccess * | _parameter_access |
Fields | |
| *MFShaderParameterPtr | _mfParameters |
Fields | |
| *SFBool | _sfInternal |
| MFFieldContainerPtr | _parents |
Member | |
| *UInt32 | _shares |
Private Types | |
| typedef SHLChunkBase | Inherited |
| typedef std::map< std::string, paramtercbfp > | userParameterCallbacksMap |
Private Member Functions | |
| void | handleGL (Window *win, UInt32 id) |
| void | operator= (const SHLChunk &source) |
| void | updateProgram (Window *win) |
| void | checkOSGParameters (void) |
| void | updateOSGParameters (DrawActionBase *action, GLuint program) |
Static Private Member Functions | |
| static void | initMethod (void) |
| static void | updateCameraOrientation (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateCameraPosition (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateViewMatrix (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateInvViewMatrix (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateStereoLeftEye (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateClusterId (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateActiveLightsMask (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateLight0Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateLight1Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateLight2Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateLight3Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateLight4Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateLight5Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateLight6Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
| static void | updateLight7Active (PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program) |
Private Attributes | |
| std::vector< paramtercbfp > | _osgParametersCallbacks |
| UInt32 | _oldParameterSize |
| userParameterCallbacksMap | _userParameterCallbacks |
Static Private Attributes | |
| static StateChunkClass | _class |
OpenGL Extension Handling | |
| *static UInt32 | _shl_extension |
| static UInt32 | _cg_extension |
| static UInt32 | _funcCreateProgramObject = Window::invalidFunctionID |
| static UInt32 | _funcCreateShaderObject = Window::invalidFunctionID |
| static UInt32 | _funcDeleteObject = Window::invalidFunctionID |
| static UInt32 | _funcDetachObject = Window::invalidFunctionID |
| static UInt32 | _funcAttachObject = Window::invalidFunctionID |
| static UInt32 | _funcShaderSource = Window::invalidFunctionID |
| static UInt32 | _funcCompileShader = Window::invalidFunctionID |
| static UInt32 | _funcLinkProgram = Window::invalidFunctionID |
| static UInt32 | _funcGetInfoLog = Window::invalidFunctionID |
| static UInt32 | _funcUseProgramObject = Window::invalidFunctionID |
| static UInt32 | _funcGetObjectParameteriv = Window::invalidFunctionID |
| static UInt32 | _funcGetObjectParameterfv = Window::invalidFunctionID |
| static UInt32 | _funcGetUniformLocation = Window::invalidFunctionID |
| static UInt32 | _funcBindAttribLocation = Window::invalidFunctionID |
| static UInt32 | _funcGetAttribLocation = Window::invalidFunctionID |
| static UInt32 | _funcUniform1i = Window::invalidFunctionID |
| static UInt32 | _funcUniform2iv = Window::invalidFunctionID |
| static UInt32 | _funcUniform3iv = Window::invalidFunctionID |
| static UInt32 | _funcUniform4iv = Window::invalidFunctionID |
| static UInt32 | _funcUniform1f = Window::invalidFunctionID |
| static UInt32 | _funcUniform2fv = Window::invalidFunctionID |
| static UInt32 | _funcUniform3fv = Window::invalidFunctionID |
| static UInt32 | _funcUniform4fv = Window::invalidFunctionID |
| static UInt32 | _funcUniformMatrix4fv = Window::invalidFunctionID |
| static UInt32 | _funcGetUniformiv = Window::invalidFunctionID |
| static UInt32 | _funcGetUniformfv = Window::invalidFunctionID |
| static Int32 | _clusterId = -1 |
Friends | |
| class | FieldContainer |
| class | SHLChunkBase |
Definition at line 62 of file OSGSHLChunk.h.
|
|
Reimplemented from osg::SHLChunkBase. Definition at line 66 of file OSGSHLChunk.h. |
|
|
Definition at line 129 of file OSGSHLChunk.h. |
|
|
Definition at line 286 of file OSGSHLChunk.h. |
|
|
Reimplemented from osg::ShaderChunkBase. Definition at line 91 of file OSGSHLChunkBase.h. |
|
|
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 };
|
|
|
|
Definition at line 278 of file OSGSHLChunk.cpp. 00278 : 00279 Inherited(source), 00280 _osgParametersCallbacks(source._osgParametersCallbacks), 00281 _oldParameterSize(source._oldParameterSize), 00282 _userParameterCallbacks(source._userParameterCallbacks) 00283 { 00284 }
|
|
|
Definition at line 286 of file OSGSHLChunk.cpp.
|
|
|
Reimplemented from osg::StateChunk. Definition at line 318 of file OSGSHLChunk.cpp. References _class. 00319 { 00320 return &_class; 00321 }
|
|
||||||||||||
|
Reimplemented from osg::ShaderChunk. Definition at line 325 of file OSGSHLChunk.cpp. References osg::SHLChunkBase::CgFrontEndFieldMask, osg::ShaderChunk::changed(), osg::ShaderChunkBase::FragmentProgramFieldMask, osg::SHLChunkBase::getGLId(), osg::ShaderParameterChunkBase::ParametersFieldMask, osg::Window::refreshGLObject(), osg::Window::reinitializeGLObject(), and osg::ShaderChunkBase::VertexProgramFieldMask. 00326 { 00327 if((whichField & VertexProgramFieldMask) || 00328 (whichField & FragmentProgramFieldMask) || 00329 (whichField & CgFrontEndFieldMask)) 00330 { 00331 Window::reinitializeGLObject(getGLId()); 00332 } 00333 00334 if(whichField & ParametersFieldMask) 00335 { 00336 Window::refreshGLObject(getGLId()); 00337 } 00338 00339 Inherited::changed(whichField, origin); 00340 }
|
|
||||||||||||
|
Reimplemented from osg::ShaderChunk. Definition at line 342 of file OSGSHLChunk.cpp. References SLOG. 00344 { 00345 SLOG << "Dump SHLChunk NI" << std::endl; 00346 }
|
|
||||||||||||||||||||||||
|
Definition at line 568 of file OSGSHLChunk.cpp. References _funcGetUniformfv, _funcGetUniformLocation, _funcUniform1f, _funcUniform1i, _funcUniform2fv, _funcUniform3fv, _funcUniform4fv, _funcUniformMatrix4fv, _funcUseProgramObject, checkOSGParameters(), osg::AttachmentContainerPtr::dcast(), osg::MField< FieldTypeT, fieldNameSpace >::empty(), FWARNING, osg::Window::getFunction(), osg::SHLChunkBase::getGLId(), osg::Window::getGLObjectId(), GLint(), GLuint(), p, osg::ShaderParameter::SHPTypeBool, osg::ShaderParameter::SHPTypeInt, osg::ShaderParameter::SHPTypeMatrix, osg::ShaderParameter::SHPTypeReal, osg::ShaderParameter::SHPTypeVec2f, osg::ShaderParameter::SHPTypeVec3f, osg::ShaderParameter::SHPTypeVec4f, and osg::MField< FieldTypeT, fieldNameSpace >::size(). Referenced by handleGL(), and updateProgram(). 00572 { 00573 GLuint program = (GLuint) win->getGLObjectId(getGLId()); 00574 00575 if(program == 0) 00576 return; 00577 00578 checkOSGParameters(); 00579 00580 if(parameters.empty()) 00581 return; 00582 00583 // get "glUseProgramObjectARB" function pointer 00584 PFNGLUSEPROGRAMOBJECTARBPROC useProgramObject = (PFNGLUSEPROGRAMOBJECTARBPROC) 00585 win->getFunction(_funcUseProgramObject); 00586 00587 if(useProgram) 00588 useProgramObject(program); 00589 00590 // get "glGetUniformLocationARB" function pointer 00591 PFNGLGETUNIFORMLOCATIONARBPROC getUniformLocation = (PFNGLGETUNIFORMLOCATIONARBPROC) 00592 win->getFunction(_funcGetUniformLocation); 00593 00594 // just a example showing how to get parameter values. 00595 #if 0 00596 // get "glGetUniformfvARB" function pointer 00597 PFNGLGETUNIFORMFVARBPROC getUniformfv = (PFNGLGETUNIFORMFVARBPROC) 00598 win->getFunction(_funcGetUniformfv); 00599 GLfloat values[2]; 00600 getUniformfv(program, location, values); 00601 #endif 00602 00603 for(UInt32 i = 0; i < parameters.size(); ++i) 00604 { 00605 ShaderParameterPtr parameter = parameters[i]; |