osg::SHLChunk Class Reference

SHLChunk class. See PageKernelSHLChunk for a description.

#include <OSGSHLChunk.h>

Inheritance diagram for osg::SHLChunk:

osg::SHLChunkBase osg::ShaderChunk osg::ShaderChunkBase osg::ShaderParameterChunk osg::ShaderParameterChunkBase osg::StateChunk osg::StateChunkBase osg::Attachment osg::FieldContainer

List of all members.

Parameter Callbacks



typedef const char * name
typedef void(* parametercbfp )(OSGGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)
typedef void(* osgparametercbfp )(const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
typedef GLint (OSG_APIENTRY *OSGGLGETUNIFORMLOCATIONARBPROC)(GLuint programObj
void addParameterCallback (const char *name, parametercbfp fp)
void addParameterCallback (const char *name, osgparametercbfp fp)
static void setParameterCallback (parametercbfp fp)

Paramerters



void updateParameterLocations (Window *win, const MFShaderParameterPtr &parameters)
void updateParameters (Window *win, const MFShaderParameterPtr &parameters, bool useProgram=true, bool force=false, bool keepProgramActive=false)
void updateProgramParameters (Window *win)
static void updateParameterLocation (Window *win, GLuint program, const ShaderParameterPtr &parameter)

Public Types

enum  {
  CgFrontEndFieldId = Inherited::NextFieldId, PointSizeFieldId = CgFrontEndFieldId + 1, ProgramParameterNamesFieldId = PointSizeFieldId + 1, ProgramParameterValuesFieldId = ProgramParameterNamesFieldId + 1,
  GLIdFieldId = ProgramParameterValuesFieldId + 1, IgnoreGLForAspectFieldId = GLIdFieldId + 1, NextFieldId = IgnoreGLForAspectFieldId + 1
}
typedef SHLChunkPtr Ptr
enum  { VertexProgramFieldId = Inherited::NextFieldId, FragmentProgramFieldId = VertexProgramFieldId + 1, GeometryProgramFieldId = FragmentProgramFieldId + 1, NextFieldId = GeometryProgramFieldId + 1 }
enum  { ParametersFieldId = Inherited::NextFieldId, NextFieldId = ParametersFieldId + 1 }
enum  { IgnoreFieldId = Inherited::NextFieldId, NextFieldId = IgnoreFieldId + 1 }
enum  { ParentsFieldId = Inherited::NextFieldId, InternalFieldId = ParentsFieldId + 1, NextFieldId = InternalFieldId + 1 }
enum  { NextFieldId = 1 }

Public Member Functions

Chunk Class Access


virtual const StateChunkClassgetClass (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 update (DrawActionBase *action)
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
Program Parameter


void addProgramParameter (GLenum name, UInt32 value)
void subProgramParameter (GLenum name)
void setProgramParameter (GLenum name, UInt32 value)
UInt32 getProgramParameter (GLenum name)
std::vector< std::pair< GLenum,
UInt32 > > 
getProgramParameters (void)
void clearProgramParameters (void)
FieldContainer Get


virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get


SFBoolgetSFCgFrontEnd (void)
 Get the SHLChunk::_sfCgFrontEnd field.
SFBoolgetSFPointSize (void)
 Get the SHLChunk::_sfPointSize field.
MFGLenumgetMFProgramParameterNames (void)
 Get the SHLChunk::_mfProgramParameterNames field.
MFUInt32getMFProgramParameterValues (void)
 Get the SHLChunk::_mfProgramParameterValues field.
SFUInt32getSFGLId (void)
 Get the SHLChunk::_sfGLId field.
SFInt32getSFIgnoreGLForAspect (void)
 Get the SHLChunk::_sfIgnoreGLForAspect 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.
bool & getPointSize (void)
 Get the value of the SHLChunk::_sfPointSize field.
const bool & getPointSize (void) const
 Get the value of the SHLChunk::_sfPointSize field.
UInt32getGLId (void)
 Get the value of the SHLChunk::_sfGLId field.
const UInt32getGLId (void) const
 Get the value of the SHLChunk::_sfGLId field.
Int32getIgnoreGLForAspect (void)
 Get the value of the SHLChunk::_sfIgnoreGLForAspect field.
const Int32getIgnoreGLForAspect (void) const
 Get the value of the SHLChunk::_sfIgnoreGLForAspect field.
GLenum & getProgramParameterNames (const UInt32 index)
 Get the value of the index element the SHLChunk::_mfProgramParameterNames field.
MFGLenumgetProgramParameterNames (void)
 Get the SHLChunk::_mfProgramParameterNames field.
const MFGLenumgetProgramParameterNames (void) const
 Get the SHLChunk::_mfProgramParameterNames field.
UInt32getProgramParameterValues (const UInt32 index)
 Get the value of the index element the SHLChunk::_mfProgramParameterValues field.
MFUInt32getProgramParameterValues (void)
 Get the SHLChunk::_mfProgramParameterValues field.
const MFUInt32getProgramParameterValues (void) const
 Get the SHLChunk::_mfProgramParameterValues field.
Field Set


void setCgFrontEnd (const bool &value)
 Set the value of the SHLChunk::_sfCgFrontEnd field.
void setPointSize (const bool &value)
 Set the value of the SHLChunk::_sfPointSize field.
void setGLId (const UInt32 &value)
 Set the value of the SHLChunk::_sfGLId field.
void setIgnoreGLForAspect (const Int32 &value)
 Set the value of the SHLChunk::_sfIgnoreGLForAspect 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


SFStringgetSFVertexProgram (void)
 Get the ShaderChunk::_sfVertexProgram field.
SFStringgetSFFragmentProgram (void)
 Get the ShaderChunk::_sfFragmentProgram field.
SFStringgetSFGeometryProgram (void)
 Get the ShaderChunk::_sfGeometryProgram 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.
std::string & getGeometryProgram (void)
 Get the value of the ShaderChunk::_sfGeometryProgram field.
const std::string & getGeometryProgram (void) const
 Get the value of the ShaderChunk::_sfGeometryProgram 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.
void setGeometryProgram (const std::string &value)
 Set the value of the ShaderChunk::_sfGeometryProgram 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 setUniformParameter (const char *name, const MFInt32 &value)
bool setUniformParameter (const char *name, const MFReal32 &value)
bool setUniformParameter (const char *name, const MFVec2f &value)
bool setUniformParameter (const char *name, const MFVec3f &value)
bool setUniformParameter (const char *name, const MFVec4f &value)
bool setUniformParameter (const char *name, const MFMatrix &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 getUniformParameter (const char *name, MFInt32 &value)
bool getUniformParameter (const char *name, MFReal32 &value)
bool getUniformParameter (const char *name, MFVec2f &value)
bool getUniformParameter (const char *name, MFVec3f &value)
bool getUniformParameter (const char *name, MFVec4f &value)
bool getUniformParameter (const char *name, MFMatrix &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
State


virtual bool isTransparent (void) const
Field Get


SFBoolgetSFIgnore (void)
 Get the StateChunk::_sfIgnore field.
bool & getIgnore (void)
 Get the value of the StateChunk::_sfIgnore field.
const bool & getIgnore (void) const
 Get the value of the StateChunk::_sfIgnore field.
Field Set


void setIgnore (const bool &value)
 Set the value of the StateChunk::_sfIgnore field.
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)
Get Instance Type Information


UInt32 getTypeId (void) const
UInt16 getGroupId (void) const
const Char8getTypeName (void) const


FieldgetField (UInt32 fieldId)
FieldgetField (const Char8 *fieldName)

Static Public Member Functions

Static Chunk Class Access


static UInt32 getStaticClassId (void)
static const StateChunkClassgetStaticClass (void)
Parameter funcs


static UInt32 getFuncUniform1i (void)
static UInt32 getFuncUniform1iv (void)
static UInt32 getFuncUniform2iv (void)
static UInt32 getFuncUniform3iv (void)
static UInt32 getFuncUniform4iv (void)
static UInt32 getFuncUniform1f (void)
static UInt32 getFuncUniform1fv (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 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
Get Class Type Information


static UInt16 getClassGroupId (void)

Static Public Attributes

static const osg::BitVector CgFrontEndFieldMask
static const osg::BitVector PointSizeFieldMask
static const osg::BitVector ProgramParameterNamesFieldMask
static const osg::BitVector ProgramParameterValuesFieldMask
static const osg::BitVector GLIdFieldMask
static const osg::BitVector IgnoreGLForAspectFieldMask
static const osg::BitVector MTInfluenceMask
static const osg::BitVector VertexProgramFieldMask
static const osg::BitVector FragmentProgramFieldMask
static const osg::BitVector GeometryProgramFieldMask
static const osg::BitVector ParametersFieldMask
static const osg::BitVector IgnoreFieldMask
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

Protected Member Functions

void onCreate (const SHLChunk *source=NULL)
void onDestroy (void)
void onCreate (const ShaderParameterChunk *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)

Protected Attributes

Fields


SFBool _sfCgFrontEnd
SFBool _sfPointSize
MFGLenum _mfProgramParameterNames
MFUInt32 _mfProgramParameterValues
SFUInt32 _sfGLId
SFInt32 _sfIgnoreGLForAspect
Fields


SFString _sfVertexProgram
SFString _sfFragmentProgram
SFString _sfGeometryProgram
Parameter Access


ShaderParameterAccess_parameter_access
Fields


MFShaderParameterPtr _mfParameters
Fields


SFBool _sfIgnore
Fields


SFBool _sfInternal
MFFieldContainerPtr _parents
Member


UInt32 _shares

Private Types

typedef SHLChunkBase Inherited
typedef std::map< std::string,
std::pair< parametercbfp,
osgparametercbfp > > 
userParameterCallbacksMap

Private Member Functions

void handleGL (Window *win, UInt32 id)
void operator= (const SHLChunk &source)
void updateProgram (Window *win)
void checkOSGParameters (bool force=false)
void updateOSGParameters (DrawActionBase *action, GLuint program, bool update=false)

Static Private Member Functions

static void initMethod (void)
static void updateWorldMatrix (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateInvWorldMatrix (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateTransInvWorldMatrix (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateCameraOrientation (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateCameraPosition (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateViewMatrix (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateInvViewMatrix (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateStereoLeftEye (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateClusterId (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateActiveLightsMask (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateLight0Active (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateLight1Active (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateLight2Active (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateLight3Active (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateLight4Active (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateLight5Active (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateLight6Active (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)
static void updateLight7Active (const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)

Private Attributes

std::vector< std::pair
< std::pair< parametercbfp,
osgparametercbfp >
, ShaderParameterPtr > > 
_osgParametersCallbacks
UInt32 _oldParameterSize
userParameterCallbacksMap _userParameterCallbacks

Static Private Attributes

static StateChunkClass _class
static parametercbfp _userParametersCallback = NULL
OpenGL Extension Handling


static UInt32 _shl_extension
static UInt32 _cg_extension
static UInt32 _geometry_extension
static UInt32 _funcCreateProgramObject = Window::invalidFunctionID
static UInt32 _funcProgramParameteri = 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 _funcUniform1iv = Window::invalidFunctionID
static UInt32 _funcUniform2iv = Window::invalidFunctionID
static UInt32 _funcUniform3iv = Window::invalidFunctionID
static UInt32 _funcUniform4iv = Window::invalidFunctionID
static UInt32 _funcUniform1f = Window::invalidFunctionID
static UInt32 _funcUniform1fv = 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


Detailed Description

Definition at line 62 of file OSGSHLChunk.h.


Member Typedef Documentation

Reimplemented from osg::SHLChunkBase.

Definition at line 66 of file OSGSHLChunk.h.

typedef const char* osg::SHLChunk::name

Definition at line 150 of file OSGSHLChunk.h.

typedef void(* osg::SHLChunk::parametercbfp)(OSGGLGETUNIFORMLOCATIONARBPROC getUniformLocation, DrawActionBase *action, GLuint program)

typedef void(* osg::SHLChunk::osgparametercbfp)(const ShaderParameterPtr &parameter, DrawActionBase *action, GLuint program)

typedef std::map<std::string, std::pair<parametercbfp, osgparametercbfp> > osg::SHLChunk::userParameterCallbacksMap [private]

Definition at line 342 of file OSGSHLChunk.h.

typedef SHLChunkPtr osg::SHLChunkBase::Ptr [inherited]

Reimplemented from osg::ShaderChunkBase.

Definition at line 95 of file OSGSHLChunkBase.h.


Member Enumeration Documentation

anonymous enum [inherited]

Enumerator:
CgFrontEndFieldId 
PointSizeFieldId 
ProgramParameterNamesFieldId 
ProgramParameterValuesFieldId 
GLIdFieldId 
IgnoreGLForAspectFieldId 
NextFieldId 

Definition at line 97 of file OSGSHLChunkBase.h.

00098     {
00099         CgFrontEndFieldId             = Inherited::NextFieldId,
00100         PointSizeFieldId              = CgFrontEndFieldId             + 1,
00101         ProgramParameterNamesFieldId  = PointSizeFieldId              + 1,
00102         ProgramParameterValuesFieldId = ProgramParameterNamesFieldId  + 1,
00103         GLIdFieldId                   = ProgramParameterValuesFieldId + 1,
00104         IgnoreGLForAspectFieldId      = GLIdFieldId                   + 1,
00105         NextFieldId                   = IgnoreGLForAspectFieldId      + 1
00106     };

anonymous enum [inherited]

Enumerator:
VertexProgramFieldId 
FragmentProgramFieldId 
GeometryProgramFieldId 
NextFieldId 

Definition at line 94 of file OSGShaderChunkBase.h.

00095     {
00096         VertexProgramFieldId   = Inherited::NextFieldId,
00097         FragmentProgramFieldId = VertexProgramFieldId   + 1,
00098         GeometryProgramFieldId = FragmentProgramFieldId + 1,
00099         NextFieldId            = GeometryProgramFieldId + 1
00100     };

anonymous enum [inherited]

Enumerator:
ParametersFieldId 
NextFieldId 

Definition at line 92 of file OSGShaderParameterChunkBase.h.

anonymous enum [inherited]

Enumerator:
IgnoreFieldId 
NextFieldId 

Definition at line 92 of file OSGStateChunkBase.h.

00093     {
00094         IgnoreFieldId = Inherited::NextFieldId,
00095         NextFieldId   = IgnoreFieldId + 1
00096     };

anonymous enum [inherited]

Enumerator:
ParentsFieldId 
InternalFieldId 
NextFieldId 

Definition at line 86 of file OSGAttachmentImpl.h.

00087     { 
00088         ParentsFieldId     = Inherited::NextFieldId, 
00089         InternalFieldId    = ParentsFieldId  + 1,
00090         NextFieldId        = InternalFieldId + 1
00091     };

anonymous enum [inherited]

Enumerator:
NextFieldId 

Definition at line 73 of file OSGFieldContainerImpl.h.

00073 { NextFieldId = 1 };


Constructor & Destructor Documentation

SHLChunk::SHLChunk ( void   )  [protected]

Definition at line 179 of file OSGSHLChunk.cpp.

References _cg_extension, _funcAttachObject, _funcBindAttribLocation, _funcCompileShader, _funcCreateProgramObject, _funcCreateShaderObject, _funcDeleteObject, _funcDetachObject, _funcGetAttribLocation, _funcGetInfoLog, _funcGetObjectParameterfv, _funcGetObjectParameteriv, _funcGetUniformfv, _funcGetUniformiv, _funcGetUniformLocation, _funcLinkProgram, _funcProgramParameteri, _funcShaderSource, _funcUniform1f, _funcUniform1fv, _funcUniform1i, _funcUniform1iv, _funcUniform2fv, _funcUniform2iv, _funcUniform3fv, _funcUniform3iv, _funcUniform4fv, _funcUniform4iv, _funcUniformMatrix4fv, _funcUseProgramObject, _geometry_extension, _shl_extension, OSG_DLSYM_UNDERSCORE, osg::Window::registerExtension(), and osg::Window::registerFunction().

00179                        :
00180     Inherited(),
00181     _osgParametersCallbacks(),
00182     _oldParameterSize(0),
00183     _userParameterCallbacks()
00184 {
00185     _shl_extension = Window::registerExtension("GL_ARB_shading_language_100");
00186     _cg_extension = Window::registerExtension("GL_EXT_Cg_shader");
00187     _geometry_extension = Window::registerExtension("GL_EXT_geometry_shader4");
00188 
00189     _funcCreateProgramObject =
00190         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glCreateProgramObjectARB", 
00191                                   _shl_extension);
00192 
00193     _funcProgramParameteri =
00194         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glProgramParameteriEXT", 
00195                                   _geometry_extension);
00196 
00197     _funcCreateShaderObject =
00198         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glCreateShaderObjectARB", 
00199                                   _shl_extension);
00200     _funcDeleteObject =
00201         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glDeleteObjectARB", 
00202                                   _shl_extension);
00203     
00204     _funcDetachObject =
00205         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glDetachObjectARB", 
00206                                   _shl_extension);
00207     
00208     _funcAttachObject =
00209         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glAttachObjectARB", 
00210                                   _shl_extension);
00211 
00212     _funcShaderSource =
00213         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glShaderSourceARB", 
00214                                   _shl_extension);
00215                                   
00216     _funcCompileShader =
00217         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glCompileShaderARB", 
00218                                   _shl_extension);
00219                                   
00220     _funcLinkProgram =
00221         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glLinkProgramARB", 
00222                                   _shl_extension);
00223                                   
00224     _funcGetInfoLog =
00225         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetInfoLogARB", 
00226                                   _shl_extension);
00227                                   
00228     _funcUseProgramObject =
00229         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUseProgramObjectARB", 
00230                                   _shl_extension);
00231     
00232     _funcGetObjectParameteriv =
00233         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetObjectParameterivARB", 
00234                                   _shl_extension);
00235 
00236     _funcGetObjectParameterfv =
00237         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetObjectParameterfvARB", 
00238                                   _shl_extension);
00239 
00240     _funcGetUniformLocation =
00241         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetUniformLocationARB", 
00242                                   _shl_extension);
00243     
00244     _funcBindAttribLocation =
00245         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glBindAttribLocationARB", 
00246                                   _shl_extension);
00247 
00248     _funcGetAttribLocation =
00249         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetAttribLocationARB", 
00250                                   _shl_extension);
00251     
00252     _funcUniform1i =
00253         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform1iARB", 
00254                                   _shl_extension);
00255 
00256     _funcUniform1iv =
00257         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform1ivARB", 
00258                                   _shl_extension);
00259 
00260     _funcUniform2iv =
00261         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform2ivARB", 
00262                                   _shl_extension);
00263                                   
00264     _funcUniform3iv =
00265         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform3ivARB", 
00266                                   _shl_extension);
00267                                   
00268     _funcUniform4iv =
00269         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform4ivARB", 
00270                                   _shl_extension);
00271 
00272     _funcUniform1f =
00273         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform1fARB", 
00274                                   _shl_extension);
00275 
00276     _funcUniform1fv =
00277         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform1fvARB", 
00278                                   _shl_extension);
00279 
00280     _funcUniform2fv =
00281         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform2fvARB", 
00282                                   _shl_extension);
00283 
00284     _funcUniform3fv =
00285         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform3fvARB", 
00286                                   _shl_extension);
00287 
00288     _funcUniform4fv =
00289         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniform4fvARB", 
00290                                   _shl_extension);
00291 
00292     _funcUniformMatrix4fv =
00293         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glUniformMatrix4fvARB", 
00294                                   _shl_extension);
00295 
00296     _funcGetUniformiv =
00297         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetUniformivARB", 
00298                                   _shl_extension);
00299     
00300     _funcGetUniformfv =
00301         Window::registerFunction (OSG_DLSYM_UNDERSCORE"glGetUniformfvARB", 
00302                                   _shl_extension);
00303 }

SHLChunk::SHLChunk ( const SHLChunk source  )  [protected]

Definition at line 305 of file OSGSHLChunk.cpp.

00305                                          :
00306     Inherited(source),
00307     _osgParametersCallbacks(source._osgParametersCallbacks),
00308     _oldParameterSize(source._oldParameterSize),
00309     _userParameterCallbacks(source._userParameterCallbacks)
00310 {
00311 }

SHLChunk::~SHLChunk ( void   )  [protected, virtual]

Definition at line 313 of file OSGSHLChunk.cpp.

00314 {
00315 }


Member Function Documentation

const StateChunkClass * SHLChunk::getClass ( void   )  const [virtual]

Reimplemented from osg::StateChunk.

Definition at line 349 of file OSGSHLChunk.cpp.

References _class.

00350 {
00351     return &_class;
00352 }

UInt32 osg::SHLChunk::getStaticClassId ( void   )  [inline, static]

Reimplemented from osg::StateChunk.

Definition at line 46 of file OSGSHLChunk.inl.

References osg::StateChunkClass::getId(), and getStaticClass().

00047 {
00048     return getStaticClass()->getId();
00049 }

const StateChunkClass * osg::SHLChunk::getStaticClass ( void   )  [inline, static]

Reimplemented from osg::StateChunk.

Definition at line 52 of file OSGSHLChunk.inl.

References _class.

Referenced by getStaticClassId().

00053 {
00054     return &SHLChunk::_class;
00055 }

void SHLChunk::changed ( BitVector  whichField,
UInt32  origin 
) [virtual]

Reimplemented from osg::ShaderChunk.

Definition at line 356 of file OSGSHLChunk.cpp.

References osg::SHLChunkBase::_sfIgnoreGLForAspect, osg::beginEditCP(), osg::SHLChunkBase::CgFrontEndFieldMask, osg::ShaderChunk::changed(), osg::endEditCP(), osg::ShaderChunkBase::FragmentProgramFieldMask, osg::ShaderChunkBase::GeometryProgramFieldMask, osg::PThreadBase::getAspect(), osg::SHLChunkBase::getGLId(), osg::SField< FieldTypeT, fieldNameSpace >::getValue(), osg::SHLChunkBase::GLIdFieldMask, handleGL(), osg::osgTypedMethodVoidFunctor2ObjCPtrPtr(), osg::ShaderParameterChunkBase::ParametersFieldMask, osg::SHLChunkBase::ProgramParameterNamesFieldMask, osg::SHLChunkBase::ProgramParameterValuesFieldMask, osg::Window::refreshGLObject(), osg::Window::registerGLObject(), osg::Window::reinitializeGLObject(), osg::SHLChunkBase::setGLId(), and osg::ShaderChunkBase::VertexProgramFieldMask.

00357 {
00358     if(Thread::getAspect() != _sfIgnoreGLForAspect.getValue())
00359     {
00360         if(getGLId() == 0)
00361         {
00362             SHLChunkPtr tmpPtr(*this);
00363 
00364             beginEditCP(tmpPtr, SHLChunk::GLIdFieldMask);
00365             
00366             setGLId(
00367                 Window::registerGLObject(
00368                     osgTypedMethodVoidFunctor2ObjCPtrPtr<SHLChunkPtr,
00369                                                  Window ,
00370                                                  UInt32>(
00371                                                      tmpPtr,
00372                                                      &SHLChunk::handleGL),
00373                     1));
00374             
00375             endEditCP(tmpPtr, SHLChunk::GLIdFieldMask);
00376         }
00377     }
00378 
00379     if((whichField & VertexProgramFieldMask) ||
00380        (whichField & FragmentProgramFieldMask) ||
00381        (whichField & GeometryProgramFieldMask) ||
00382        (whichField & CgFrontEndFieldMask))
00383     {
00384         if(Thread::getAspect() != _sfIgnoreGLForAspect.getValue())
00385         {
00386             Window::reinitializeGLObject(getGLId());
00387         }
00388     }
00389 
00390     if((whichField & ParametersFieldMask) ||
00391        (whichField & ProgramParameterNamesFieldMask) ||
00392        (whichField & ProgramParameterValuesFieldMask))
00393     {
00394         if(Thread::getAspect() != _sfIgnoreGLForAspect.getValue())
00395         {
00396             Window::refreshGLObject(getGLId());
00397         }
00398     }
00399 
00400     Inherited::changed(whichField, origin);
00401 }

void SHLChunk::dump ( UInt32  uiIndent = 0,
const BitVector  bvFlags = 0 
) const [virtual]

Reimplemented from osg::ShaderChunk.

Definition at line 403 of file OSGSHLChunk.cpp.

References SLOG.

00405 {
00406     SLOG << "Dump SHLChunk NI" << std::endl;
00407 }

void SHLChunk::updateParameterLocation ( Window win,
GLuint  program,
const ShaderParameterPtr parameter 
) [static]

Definition at line 690 of file OSGSHLChunk.cpp.

References _funcGetUniformLocation, FNOTICE, and osg::Window::getFunction().

Referenced by updateActiveLightsMask(), updateCameraOrientation(), updateCameraPosition(), updateClusterId(), updateInvViewMatrix(), updateInvWorldMatrix(), updateLight0Active(), updateLight1Active(), updateLight2Active(), updateLight3Active(), updateLight4Active(), updateLight5Active(), updateLight6Active(), updateLight7Active(), updateParameters(), updateStereoLeftEye(), updateTransInvWorldMatrix(), updateViewMatrix(), and updateWorldMatrix().

00692 {
00693     if(program == 0)
00694     {
00695         FNOTICE(("SHLChunk::updateParameterLocation: program == 0!\n"
00696                  "This frame will probably be rendered wrong!\n"));
00697         return;
00698     }
00699 
00700     // get "glGetUniformLocationARB" function pointer
00701     OSGGLGETUNIFORMLOCATIONARBPROC getUniformLocation = (OSGGLGETUNIFORMLOCATIONARBPROC)
00702         win->getFunction(_funcGetUniformLocation);
00703 
00704     // as the location won't change after linking we can store them for speedup.
00705     parameter->setLocation(getUniformLocation(program, parameter->getName().c_str()));
00706 }

void SHLChunk::updateParameterLocations ( Window win,
const MFShaderParameterPtr parameters 
)

Definition at line 708 of file OSGSHLChunk.cpp.

References _funcGetUniformLocation, checkOSGParameters(), osg::MField< FieldTypeT, fieldNameSpace >::empty(), FNOTICE, osg::Window::getFunction(), osg::SHLChunkBase::getGLId(), osg::Window::getGLObjectId(), GLuint(), and osg::MField< FieldTypeT, fieldNameSpace >::size().

Referenced by updateProgram().

00710 {
00711     GLuint program = (GLuint) win->getGLObjectId(getGLId());
00712 
00713     if(program == 0)
00714     {
00715         FNOTICE(("SHLChunk::updateParameterLocations: program == 0!\n"
00716                  "This frame will probably be rendered wrong!\n"));
00717         return;
00718     }
00719 
00720     if(parameters.empty())
00721         return;
00722 
00723     // get "glGetUniformLocationARB" function pointer
00724     OSGGLGETUNIFORMLOCATIONARBPROC getUniformLocation = (OSGGLGETUNIFORMLOCATIONARBPROC)
00725         win->getFunction(_funcGetUniformLocation);
00726 
00727     for(UInt32 i = 0; i < parameters.size(); ++i)
00728     {
00729         ShaderParameterPtr parameter = parameters[i];
00730 
00731         // as the location won't change after linking we can store them for speedup.
00732         parameter->setLocation(getUniformLocation(program, parameter->getName().c_str()));
00733     }
00734 
00735     // force a update of the osg parameters.
00736     checkOSGParameters(true);
00737 }

void SHLChunk::updateParameters ( Window win,
const MFShaderParameterPtr parameters,
bool  useProgram = true,
bool  force = false,
bool  keepProgramActive = false 
)

Definition at line 739 of file OSGSHLChunk.cpp.

References _funcUniform1f, _funcUniform1fv, _funcUniform1i, _funcUniform1iv, _funcUniform2fv, _funcUniform3fv, _funcUniform4fv, _funcUniformMatrix4fv, _funcUseProgramObject, checkOSGParameters(), osg::AttachmentContainerPtr::dcast(), osg::MField< FieldTypeT, fieldNameSpace >::empty(), FNOTICE, FWARNING, osg::Window::getFunction(), osg::SHLChunkBase::getGLId(), osg::Window::getGLObjectId(), GLint(), GLuint(), p, osg::ShaderParameter::SHPTypeBool, osg::ShaderParameter::SHPTypeInt, osg::ShaderParameter::SHPTypeMatrix, osg::ShaderParameter::SHPTypeMInt, osg::ShaderParameter::SHPTypeMMatrix, osg::ShaderParameter::SHPTypeMReal, osg::ShaderParameter::SHPTypeMVec2f, osg::ShaderParameter::SHPTypeMVec3f, osg::ShaderParameter::SHPTypeMVec4f, osg::ShaderParameter::SHPTypeReal, osg::ShaderParameter::SHPTypeVec2f, osg::ShaderParameter::SHPTypeVec3f, osg::ShaderParameter::SHPTypeVec4f, osg::MField< FieldTypeT, fieldNameSpace >::size(), and updateParameterLocation().

Referenced by handleGL(), and updateProgram().

00743 {
00744     GLuint program = (GLuint) win->getGLObjectId(getGLId());
00745 
00746     if(program == 0)
00747     {
00748         FNOTICE(("SHLChunk::updateParameters: program == 0!\n"
00749                  "This frame will probably be rendered wrong!\n"));
00750         return;
00751     }
00752 
00753     checkOSGParameters();
00754 
00755     if(parameters.empty())
00756         return;
00757 
00758     // get "glUseProgramObjectARB" function pointer
00759     OSGGLUSEPROGRAMOBJECTARBPROC useProgramObject = (OSGGLUSEPROGRAMOBJECTARBPROC)
00760         win->getFunction(_funcUseProgramObject);
00761 
00762     if(useProgram)
00763         useProgramObject(program);
00764 
00765     for(UInt32 i = 0; i < parameters.size(); ++i)
00766     {
00767         ShaderParameterPtr parameter = parameters[i];
00768 
00769         // ignore special osg parameters
00770         if(parameter->getName().size() > 3 &&
00771            parameter->getName()[0] == 'O' &&
00772            parameter->getName()[1] == 'S' &&
00773            parameter->getName()[2] == 'G')
00774         {
00775             continue;
00776         }
00777         
00778         // works also but is not possible with a switch and a switch is much faster.
00779         //UInt16 groupid = parameter->getType().getGroupId();
00780         //if(groupid == ShaderParameterInt::getClassType().getGroupId())
00781         
00782         if(!force)
00783         {
00784             if(!parameter->hasChanged())
00785                 continue;
00786             parameter->resetChanged();
00787         }
00788 
00789         //printf("seeting parameter: '%s'\n", parameter->getName().c_str());
00790 
00791         switch(parameter->getTypeId())
00792         {
00793             case ShaderParameter::SHPTypeBool:
00794             {
00795                 ShaderParameterBoolPtr p = ShaderParameterBoolPtr::dcast(parameter);
00796                 // get "glUniform1iARB" function pointer
00797                 OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
00798                     win->getFunction(_funcUniform1i);
00799     
00800                 //printf("setting: %s %d\n", p->getName().c_str(), p->getValue());
00801                 if(p->getLocation() == -1)
00802                     updateParameterLocation(win, program, p);
00803                 if(p->getLocation() != -1)
00804                     uniform1i(p->getLocation(), (GLint) p->getValue());
00805                 else
00806                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00807             }
00808             break;
00809             case ShaderParameter::SHPTypeInt:
00810             {
00811                 ShaderParameterIntPtr p = ShaderParameterIntPtr::dcast(parameter);
00812                 // get "glUniform1iARB" function pointer
00813                 OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
00814                     win->getFunction(_funcUniform1i);
00815     
00816                 //printf("setting: %s %d\n", p->getName().c_str(), p->getValue());
00817                 if(p->getLocation() == -1)
00818                     updateParameterLocation(win, program, p);
00819                 if(p->getLocation() != -1)
00820                     uniform1i(p->getLocation(), p->getValue());
00821                 else
00822                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00823             }
00824             break;
00825             case ShaderParameter::SHPTypeReal:
00826             {
00827                 ShaderParameterRealPtr p = ShaderParameterRealPtr::dcast(parameter);
00828                 // get "glUniform1fARB" function pointer
00829                 OSGGLUNIFORM1FARBPROC uniform1f = (OSGGLUNIFORM1FARBPROC)
00830                     win->getFunction(_funcUniform1f);
00831 
00832                 //printf("setting: %s %f\n", p->getName().c_str(), p->getValue());
00833                 if(p->getLocation() == -1)
00834                     updateParameterLocation(win, program, p);
00835                 if(p->getLocation() != -1)
00836                     uniform1f(p->getLocation(), p->getValue());
00837                 else
00838                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00839             }
00840             break;
00841             case ShaderParameter::SHPTypeVec2f:
00842             {
00843                 ShaderParameterVec2fPtr p = ShaderParameterVec2fPtr::dcast(parameter);
00844                 // get "glUniform2fvARB" function pointer
00845                 OSGGLUNIFORMFVARBPROC uniform2fv = (OSGGLUNIFORMFVARBPROC)
00846                     win->getFunction(_funcUniform2fv);
00847 
00848                 if(p->getLocation() == -1)
00849                     updateParameterLocation(win, program, p);
00850                 if(p->getLocation() != -1)
00851                     uniform2fv(p->getLocation(), 1, p->getValue().getValues());
00852                 else
00853                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00854             }
00855             break;
00856             case ShaderParameter::SHPTypeVec3f:
00857             {
00858                 ShaderParameterVec3fPtr p = ShaderParameterVec3fPtr::dcast(parameter);
00859                 // get "glUniform3fvARB" function pointer
00860                 OSGGLUNIFORMFVARBPROC uniform3fv = (OSGGLUNIFORMFVARBPROC)
00861                     win->getFunction(_funcUniform3fv);
00862 
00863                 if(p->getLocation() == -1)
00864                     updateParameterLocation(win, program, p);
00865                 if(p->getLocation() != -1)
00866                     uniform3fv(p->getLocation(), 1, p->getValue().getValues());
00867                 else
00868                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00869             }
00870             break;
00871             case ShaderParameter::SHPTypeVec4f:
00872             {
00873                 ShaderParameterVec4fPtr p = ShaderParameterVec4fPtr::dcast(parameter);
00874                 // get "glUniform4fvARB" function pointer
00875                 OSGGLUNIFORMFVARBPROC uniform4fv = (OSGGLUNIFORMFVARBPROC)
00876                     win->getFunction(_funcUniform4fv);
00877 
00878                 if(p->getLocation() == -1)
00879                     updateParameterLocation(win, program, p);
00880                 if(p->getLocation() != -1)
00881                     uniform4fv(p->getLocation(), 1, p->getValue().getValues());
00882                 else
00883                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00884             }
00885             break;
00886             case ShaderParameter::SHPTypeMatrix:
00887             {
00888                 ShaderParameterMatrixPtr p = ShaderParameterMatrixPtr::dcast(parameter);
00889                 // get "glUniformMatrix4fvARB" function pointer
00890                 OSGGLUNIFORMMATRIXFVARBPROC uniformMatrix4fv = (OSGGLUNIFORMMATRIXFVARBPROC)
00891                     win->getFunction(_funcUniformMatrix4fv);
00892 
00893                 if(p->getLocation() == -1)
00894                     updateParameterLocation(win, program, p);
00895                 if(p->getLocation() != -1)
00896                     uniformMatrix4fv(p->getLocation(), 1, GL_FALSE, p->getValue().getValues());
00897                 else
00898                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00899             }
00900             break;
00901             // arrays
00902             case ShaderParameter::SHPTypeMInt:
00903             {
00904                 ShaderParameterMIntPtr p = ShaderParameterMIntPtr::dcast(parameter);
00905                 // get "glUniform1ivARB" function pointer
00906                 OSGGLUNIFORMIVARBPROC uniform1iv = (OSGGLUNIFORMIVARBPROC)
00907                     win->getFunction(_funcUniform1iv);
00908     
00909                 //printf("setting: %s %d\n", p->getName().c_str(), p->getValue());
00910                 if(p->getLocation() == -1)
00911                     updateParameterLocation(win, program, p);
00912                 if(p->getLocation() != -1 && !p->getValue().empty())
00913           ; // XXX uniform1iv(p->getLocation(), p->getValue().getSize(), &p->getValue()[0]);
00914                 else
00915                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00916             }
00917             break;
00918             case ShaderParameter::SHPTypeMReal:
00919             {
00920                 ShaderParameterMRealPtr p = ShaderParameterMRealPtr::dcast(parameter);
00921                 // get "glUniform1fvARB" function pointer
00922                 OSGGLUNIFORMFVARBPROC uniform1fv = (OSGGLUNIFORMFVARBPROC)
00923                     win->getFunction(_funcUniform1fv);
00924 
00925                 //printf("setting: %s %f\n", p->getName().c_str(), p->getValue());
00926                 if(p->getLocation() == -1)
00927                     updateParameterLocation(win, program, p);
00928                 if(p->getLocation() != -1 && !p->getValue().empty())
00929                     uniform1fv(p->getLocation(), p->getValue().getSize(), &p->getValue()[0]);
00930                 else
00931                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00932             }
00933             break;
00934             case ShaderParameter::SHPTypeMVec2f:
00935             {
00936                 ShaderParameterMVec2fPtr p = ShaderParameterMVec2fPtr::dcast(parameter);
00937                 // get "glUniform2fvARB" function pointer
00938                 OSGGLUNIFORMFVARBPROC uniform2fv = (OSGGLUNIFORMFVARBPROC)
00939                     win->getFunction(_funcUniform2fv);
00940 
00941                 if(p->getLocation() == -1)
00942                     updateParameterLocation(win, program, p);
00943 
00944                 if(p->getLocation() != -1 && !p->getValue().empty())
00945                     uniform2fv(p->getLocation(), p->getValue().getSize(), p->getValue()[0].getValues());
00946                 else
00947                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00948             }
00949             break;
00950             case ShaderParameter::SHPTypeMVec3f:
00951             {
00952                 ShaderParameterMVec3fPtr p = ShaderParameterMVec3fPtr::dcast(parameter);
00953                 // get "glUniform3fvARB" function pointer
00954                 OSGGLUNIFORMFVARBPROC uniform3fv = (OSGGLUNIFORMFVARBPROC)
00955                     win->getFunction(_funcUniform3fv);
00956 
00957                 if(p->getLocation() == -1)
00958                     updateParameterLocation(win, program, p);
00959                 if(p->getLocation() != -1 && !p->getValue().empty())
00960                     uniform3fv(p->getLocation(), p->getValue().getSize(), p->getValue()[0].getValues());
00961                 else
00962                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00963             }
00964             break;
00965             case ShaderParameter::SHPTypeMVec4f:
00966             {
00967                 ShaderParameterMVec4fPtr p = ShaderParameterMVec4fPtr::dcast(parameter);
00968                 // get "glUniform4fvARB" function pointer
00969                 OSGGLUNIFORMFVARBPROC uniform4fv = (OSGGLUNIFORMFVARBPROC)
00970                     win->getFunction(_funcUniform4fv);
00971 
00972                 if(p->getLocation() == -1)
00973                     updateParameterLocation(win, program, p);
00974                 if(p->getLocation() != -1 && !p->getValue().empty())
00975                     uniform4fv(p->getLocation(), p->getValue().getSize(), p->getValue()[0].getValues());
00976                 else
00977                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00978             }
00979             break;
00980             case ShaderParameter::SHPTypeMMatrix:
00981             {
00982                 ShaderParameterMMatrixPtr p = ShaderParameterMMatrixPtr::dcast(parameter);
00983                 // get "glUniformMatrix4fvARB" function pointer
00984                 OSGGLUNIFORMMATRIXFVARBPROC uniformMatrix4fv = (OSGGLUNIFORMMATRIXFVARBPROC)
00985                     win->getFunction(_funcUniformMatrix4fv);
00986 
00987                 if(p->getLocation() == -1)
00988                     updateParameterLocation(win, program, p);
00989                 if(p->getLocation() != -1 && !p->getValue().empty())
00990                     uniformMatrix4fv(p->getLocation(), p->getValue().getSize(), GL_FALSE, p->getValue()[0].getValues());
00991                 else
00992                     FWARNING(("Unknown parameter '%s'!\n", p->getName().c_str()));
00993             }
00994             break;
00995             default:
00996                 FWARNING(("Parameter '%s' has unknown type %d!\n", parameter->getName().c_str(),
00997                                                                    parameter->getTypeId()));
00998             break;
00999         }
01000     }
01001 
01002     if(useProgram && !keepProgramActive)
01003         useProgramObject(0);
01004 }

void SHLChunk::updateProgramParameters ( Window win  ) 

Definition at line 1006 of file OSGSHLChunk.cpp.

References _funcProgramParameteri, _geometry_extension, FNOTICE, osg::Window::getFunction(), osg::SHLChunkBase::getGLId(), osg::Window::getGLObjectId(), osg::SHLChunkBase::getProgramParameterNames(), osg::SHLChunkBase::getProgramParameterValues(), GLuint(), osg::Window::hasExtension(), and osg::MField< FieldTypeT, fieldNameSpace >::size().

Referenced by handleGL(), and updateProgram().

01007 {
01008     if(!win->hasExtension(_geometry_extension))
01009         return;
01010 
01011     GLuint program = (GLuint) win->getGLObjectId(getGLId());
01012 
01013     if(program == 0)
01014     {
01015         FNOTICE(("SHLChunk::updateParameters: program == 0!\n"
01016                  "This frame will probably be rendered wrong!\n"));
01017         return;
01018     }
01019 
01020     // get "glProgramParameteriEXT" function pointer
01021     OSGGLPROGRAMPARAMETERIEXTPROC programParameteri =
01022         (OSGGLPROGRAMPARAMETERIEXTPROC) win->getFunction(_funcProgramParameteri);
01023 
01024     // set program parameters.
01025     const MFGLenum &ppnames = getProgramParameterNames();
01026     const MFUInt32 &ppvalues = getProgramParameterValues();
01027     for(UInt32 i = 0; i < ppnames.size(); ++i)
01028     {
01029         if(i < ppvalues.size()) {
01030             programParameteri(program, ppnames[i], ppvalues[i]);
01031         }
01032     }
01033 }

void SHLChunk::update ( DrawActionBase action  )  [virtual]

Reimplemented from osg::StateChunk.

Definition at line 1723 of file OSGSHLChunk.cpp.

References osg::SHLChunkBase::getGLId(), osg::Window::getGLObjectId(), osg::DrawActionBase::getWindow(), GLuint(), updateOSGParameters(), and osg::Window::validateGLObject().

01724 {
01725     action->getWindow()->validateGLObject(getGLId());
01726 
01727     GLuint program = (GLuint) action->getWindow()->getGLObjectId(getGLId());
01728     if(program == 0)
01729         return;
01730 
01731     updateOSGParameters(action, program, true);
01732 }

void SHLChunk::activate ( DrawActionBase action,
UInt32  index = 0 
) [virtual]

Reimplemented from osg::StateChunk.

Definition at line 1734 of file OSGSHLChunk.cpp.

References _funcUseProgramObject, osg::Window::getFunction(), osg::SHLChunkBase::getGLId(), osg::Window::getGLObjectId(), osg::SHLChunkBase::getPointSize(), osg::DrawActionBase::getWindow(), GL_VERTEX_PROGRAM_POINT_SIZE_ARB, GLuint(), updateOSGParameters(), and osg::Window::validateGLObject().

01735 {
01736     //printf("SHLChunk::activate : %p\n", action->getWindow());
01737     action->getWindow()->validateGLObject(getGLId());
01738 
01739     GLuint program = (GLuint) action->getWindow()->getGLObjectId(getGLId());
01740     if(program == 0)
01741         return;
01742 
01743     //printf("SHLChunk::activate : %p %x\n", action->getWindow(), action->getWindow()->getGLObjectId(getGLId()));
01744 
01745     // get "glUseProgramObjectARB" function pointer
01746     OSGGLUSEPROGRAMOBJECTARBPROC useProgramObject = (OSGGLUSEPROGRAMOBJECTARBPROC)
01747         action->getWindow()->getFunction(_funcUseProgramObject);
01748     
01749     useProgramObject(program);
01750 
01751     updateOSGParameters(action, program);
01752     
01753     if(getPointSize())
01754     {
01755         glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
01756     }
01757 }

void SHLChunk::changeFrom ( DrawActionBase action,
StateChunk old,
UInt32  index = 0 
) [virtual]

Reimplemented from osg::StateChunk.

Definition at line 1759 of file OSGSHLChunk.cpp.

References _funcUseProgramObject, FWARNING, osg::Window::getFunction(), osg::SHLChunkBase::getGLId(), osg::Window::getGLObjectId(), osg::SHLChunkBase::getPointSize(), osg::DrawActionBase::getWindow(), GL_VERTEX_PROGRAM_POINT_SIZE_ARB, GLuint(), updateOSGParameters(), and osg::Window::validateGLObject().

01761 {
01762     SHLChunk *old = dynamic_cast<SHLChunk *>(old_chunk);
01763 
01764     if(old == NULL)
01765     {
01766         FWARNING(( "SHLChunk::changeFrom: caught non-SHLChunk!\n"));
01767         return;
01768     }
01769 
01770     // SHLChunk didn't change so do nothing.
01771     if(old == this)
01772         return;
01773 
01774     action->getWindow()->validateGLObject(getGLId());
01775 
01776     // get "glUseProgramObjectARB" function pointer
01777     OSGGLUSEPROGRAMOBJECTARBPROC useProgramObject = (OSGGLUSEPROGRAMOBJECTARBPROC)
01778         action->getWindow()->getFunction(_funcUseProgramObject);
01779 
01780     //printf("SHLChunk::changeFrom : %p %x\n", action->getWindow(), action->getWindow()->getGLObjectId(getGLId()));
01781 
01782     GLuint program = (GLuint) action->getWindow()->getGLObjectId(getGLId());
01783 
01784     if(program != 0)
01785     {
01786         useProgramObject(program);
01787         updateOSGParameters(action, program);
01788 
01789         if(getPointSize())
01790         {
01791             if(!old->getPointSize())
01792                 glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
01793         }
01794         else
01795         {
01796             if(old->getPointSize())
01797                 glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
01798         }
01799     }
01800     else
01801     {
01802         if(action->getWindow()->getGLObjectId(old->getGLId()) != 0)
01803             useProgramObject(0);
01804     }
01805 }

void SHLChunk::deactivate ( DrawActionBase action,
UInt32  index = 0 
) [virtual]

Reimplemented from osg::StateChunk.

Definition at line 1808 of file OSGSHLChunk.cpp.

References _funcUseProgramObject, osg::Window::getFunction(), osg::SHLChunkBase::getGLId(), osg::Window::getGLObjectId(), osg::SHLChunkBase::getPointSize(), osg::DrawActionBase::getWindow(), and GL_VERTEX_PROGRAM_POINT_SIZE_ARB.

01809 {
01810     if(action->getWindow()->getGLObjectId(getGLId()) == 0)
01811         return;
01812     
01813     // get "glUseProgramObjectARB" function pointer
01814     OSGGLUSEPROGRAMOBJECTARBPROC useProgramObject = (OSGGLUSEPROGRAMOBJECTARBPROC)
01815         action->getWindow()->getFunction(_funcUseProgramObject);
01816 
01817     useProgramObject(0);
01818     
01819     if(getPointSize())
01820     {
01821         glDisable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB);
01822     }
01823 }

Real32 SHLChunk::switchCost ( StateChunk chunk  )  [virtual]

Reimplemented from osg::StateChunk.

Definition at line 1827 of file OSGSHLChunk.cpp.

01828 {
01829     return 0;
01830 }

bool SHLChunk::operator< ( const StateChunk other  )  const [virtual]

Reimplemented from osg::StateChunk.

Definition at line 1832 of file OSGSHLChunk.cpp.

01833 {
01834     return this < &other;
01835 }

bool SHLChunk::operator== ( const StateChunk other  )  const [virtual]

Reimplemented from osg::StateChunk.

Definition at line 1837 of file OSGSHLChunk.cpp.

References osg::ShaderChunkBase::getFragmentProgram(), osg::ShaderParameterChunkBase::getParameters(), osg::ShaderChunkBase::getVertexProgram(), and osg::MField< FieldTypeT, fieldNameSpace >::size().

01838 {
01839     SHLChunk const *tother = dynamic_cast<SHLChunk const*>(&other);
01840 
01841     if(!tother)
01842         return false;
01843 
01844     if(getVertexProgram() != tother->getVertexProgram() ||
01845        getFragmentProgram() != tother->getFragmentProgram() ||
01846        getParameters().size() != tother->getParameters().size())
01847         return false;
01848 
01849     return true;
01850 }

bool SHLChunk::operator!= ( const StateChunk other  )  const [virtual]

Reimplemented from osg::StateChunk.

Definition at line 1852 of file OSGSHLChunk.cpp.

01853 {
01854     return ! (*this == other);
01855 }

typedef osg::SHLChunk::GLint ( OSG_APIENTRY *  OSGGLGETUNIFORMLOCATIONARBPROC  ) 

void SHLChunk::addParameterCallback ( const char *  name,
parametercbfp  fp 
)

Definition at line 1205 of file OSGSHLChunk.cpp.

References _userParameterCallbacks, and osg::ShaderParameterChunk::setUniformParameter().

01206 {
01207     if(name == NULL || fp == NULL)
01208         return;
01209 
01210 //    std::string szName(name);
01211 
01212     osgparametercbfp nullfp = NULL;
01213 
01214     setUniformParameter(name, 0);
01215     _userParameterCallbacks.insert(
01216         std::make_pair(name, std::make_pair(fp, nullfp)));
01217 }

void osg::SHLChunk::addParameterCallback ( const char *  name,
osgparametercbfp  fp 
)

void SHLChunk::setParameterCallback ( parametercbfp  fp  )  [static]

Definition at line 1233 of file OSGSHLChunk.cpp.

References _userParametersCallback.

01234 {
01235     _userParametersCallback = fp;
01236 }

void SHLChunk::addProgramParameter ( GLenum  name,
UInt32  value 
)

void SHLChunk::subProgramParameter ( GLenum  name  ) 

Definition at line 1244 of file OSGSHLChunk.cpp.

References osg::MField< FieldTypeT, fieldNameSpace >::begin(), osg::MField< FieldTypeT, fieldNameSpace >::erase(), osg::SHLChunkBase::getProgramParameterNames(), osg::SHLChunkBase::getProgramParameterValues(), and osg::MField< FieldTypeT, fieldNameSpace >::size().

Referenced by setProgramParameter().

01245 {
01246     MFGLenum &ppnames = getProgramParameterNames();
01247     MFUInt32 &ppvalues = getProgramParameterValues();
01248 
01249     for(UInt32 i = 0; i < ppnames.size(); ++i)
01250     {
01251         if(ppnames[i] == name && i < ppvalues.size())
01252         {
01253             ppnames.erase(ppnames.begin() + i);
01254             ppvalues.erase(ppvalues.begin() + i);
01255             break;
01256         }
01257     }
01258 }

void SHLChunk::setProgramParameter ( GLenum  name,
UInt32  value 
)

Definition at line 1260 of file OSGSHLChunk.cpp.

References addProgramParameter(), and subProgramParameter().

01261 {
01262     // remove old one.
01263     subProgramParameter(name);
01264     // add new one.
01265     addProgramParameter(name, value);
01266 }

UInt32 SHLChunk::getProgramParameter ( GLenum  name  ) 

Definition at line 1268 of file OSGSHLChunk.cpp.

References FWARNING, osg::SHLChunkBase::getProgramParameterNames(), osg::SHLChunkBase::getProgramParameterValues(), and osg::MField< FieldTypeT, fieldNameSpace >::size().

01269 {
01270     const MFGLenum &ppnames = getProgramParameterNames();
01271     const MFUInt32 &ppvalues = getProgramParameterValues();
01272 
01273     for(UInt32 i = 0; i < ppnames.size(); ++i)
01274     {
01275         if(ppnames[i] == name && i < ppvalues.size())
01276             return ppvalues[i];
01277     }
01278     FWARNING(("SHLChunk::getProgramParameter : Couldn't find program parameter %u!\n",
01279               name));
01280     return 0;
01281 }

std::vector< std::pair< GLenum, UInt32 > > SHLChunk::getProgramParameters ( void   ) 

Definition at line 1283 of file OSGSHLChunk.cpp.

References osg::SHLChunkBase::getProgramParameterNames(), osg::SHLChunkBase::getProgramParameterValues(), and osg::MField< FieldTypeT, fieldNameSpace >::size().

01284 {
01285     std::vector<std::pair<GLenum, UInt32> > parameters;
01286 
01287     const MFGLenum &ppnames = getProgramParameterNames();
01288     const MFUInt32 &ppvalues = getProgramParameterValues();
01289 
01290     for(UInt32 i = 0; i < ppnames.size(); ++i)
01291     {
01292         if(i < ppvalues.size())
01293             parameters.push_back(std::make_pair(ppnames[i], ppvalues[i]));
01294     }
01295 
01296     return parameters;
01297 }

void SHLChunk::clearProgramParameters ( void   ) 

UInt32 osg::SHLChunk::getFuncUniform1i ( void   )  [inline, static]

Definition at line 58 of file OSGSHLChunk.inl.

References _funcUniform1i.

00059 {
00060     return _funcUniform1i;
00061 }

UInt32 osg::SHLChunk::getFuncUniform1iv ( void   )  [inline, static]

Definition at line 64 of file OSGSHLChunk.inl.

References _funcUniform1iv.

00065 {
00066     return _funcUniform1iv;
00067 }

UInt32 osg::SHLChunk::getFuncUniform2iv ( void   )  [inline, static]

Definition at line 70 of file OSGSHLChunk.inl.

References _funcUniform2iv.

00071 {
00072     return _funcUniform2iv;
00073 }

UInt32 osg::SHLChunk::getFuncUniform3iv ( void   )  [inline, static]

Definition at line 76 of file OSGSHLChunk.inl.

References _funcUniform3iv.

00077 {
00078     return _funcUniform3iv;
00079 }

UInt32 osg::SHLChunk::getFuncUniform4iv ( void   )  [inline, static]

Definition at line 82 of file OSGSHLChunk.inl.

References _funcUniform4iv.

00083 {
00084     return _funcUniform4iv;
00085 }

UInt32 osg::SHLChunk::getFuncUniform1f ( void   )  [inline, static]

Definition at line 88 of file OSGSHLChunk.inl.

References _funcUniform1f.

00089 {
00090     return _funcUniform1f;
00091 }

UInt32 osg::SHLChunk::getFuncUniform1fv ( void   )  [inline, static]

Definition at line 94 of file OSGSHLChunk.inl.

References _funcUniform1fv.

00095 {
00096     return _funcUniform1fv;
00097 }

UInt32 osg::SHLChunk::getFuncUniform2fv ( void   )  [inline, static]

Definition at line 100 of file OSGSHLChunk.inl.

References _funcUniform2fv.

00101 {
00102     return _funcUniform2fv;
00103 }

UInt32 osg::SHLChunk::getFuncUniform3fv ( void   )  [inline, static]

Definition at line 106 of file OSGSHLChunk.inl.

References _funcUniform3fv.

00107 {
00108     return _funcUniform3fv;
00109 }

UInt32 osg::SHLChunk::getFuncUniform4fv ( void   )  [inline, static]

Definition at line 112 of file OSGSHLChunk.inl.

References _funcUniform4fv.

00113 {
00114     return _funcUniform4fv;
00115 }

UInt32 osg::SHLChunk::getFuncUniformMatrix4fv ( void   )  [inline, static]

Definition at line 118 of file OSGSHLChunk.inl.

References _funcUniformMatrix4fv.

00119 {
00120     return _funcUniformMatrix4fv;
00121 }

UInt32 osg::SHLChunk::getFuncGetUniformiv ( void   )  [inline, static]

Definition at line 124 of file OSGSHLChunk.inl.

References _funcGetUniformiv.

00125 {
00126     return _funcGetUniformiv;
00127 }

UInt32 osg::SHLChunk::getFuncGetUniformfv ( void   )  [inline, static]

Definition at line 130 of file OSGSHLChunk.inl.

References _funcGetUniformfv.

00131 {
00132     return _funcGetUniformfv;
00133 }

void SHLChunk::setClusterId ( Int32  id  )  [static]

Definition at line 1575 of file OSGSHLChunk.cpp.

References _clusterId.

Referenced by osg::ClusterServer::doSync().

01576 {
01577     _clusterId = id;
01578 }

void SHLChunk::onCreate ( const SHLChunk source = NULL  )  [protected]

void SHLChunk::onDestroy ( void   )  [protected, virtual]

Reimplemented from osg::ShaderParameterChunk.

Definition at line 341 of file OSGSHLChunk.cpp.

References osg::Window::destroyGLObject(), osg::SHLChunkBase::getGLId(), and osg::ShaderParameterChunk::onDestroy().

00342 {
00343     Inherited::onDestroy();
00344 
00345     if(getGLId() > 0)
00346         Window::destroyGLObject(getGLId(), 1);
00347 }

void SHLChunk::initMethod ( void   )  [static, private]

Reimplemented from osg::ShaderChunk.

Definition at line 164 of file OSGSHLChunk.cpp.

00165 {
00166 }

void SHLChunk::handleGL ( Window win,
UInt32  idstatus 
) [private]

GL object handler create the program and destroy it

Definition at line 412 of file OSGSHLChunk.cpp.

References _funcDeleteObject, _shl_extension, osg::Window::destroy, osg::Window::finaldestroy, FWARNING, osg::Window::getFunction(), osg::SHLChunkBase::getGLId(), osg::Window::getGLObjectId(), osg::ShaderParameterChunkBase::getParameters(), GLuint(), osg::Window::hasExtension(), osg::Window::initialize, osg::Window::needrefresh, osg::Window::reinitialize, osg::Window::setGLObjectId(), SWARNING, osg::Window::unpackIdStatus(), updateParameters(), updateProgram(), and updateProgramParameters().

Referenced by changed(), and onCreate().

00413 {
00414     Window::GLObjectStatusE mode;
00415     UInt32 id;
00416 
00417     Window::unpackIdStatus(idstatus, id, mode);
00418 
00419     if(!win->hasExtension(_shl_extension))
00420     {
00421         FWARNING(("OpenGL Shading Language is not supported, couldn't find extension 'GL_ARB_shading_language_100'!\n"));
00422         win->setGLObjectId(getGLId(), 0);
00423         return;
00424     }
00425 
00426     // BUG this is not called for every window!
00427     if(mode == Window::destroy)
00428     {
00429         // This is called after the destructor so getGLId() doesn't work anymore!
00430         //printf("Window::destroy: %p %u %x\n", win, id, win->getGLObjectId(id));
00431         GLuint program = (GLuint) win->getGLObjectId(id);
00432         if(program != 0)
00433         {
00434             // get "glDeleteObjectARB" function pointer
00435             OSGGLDELETEOBJECTARBPROC deleteObject = (OSGGLDELETEOBJECTARBPROC)
00436                 win->getFunction(_funcDeleteObject);
00437             deleteObject(program);
00438             win->setGLObjectId(id, 0);
00439         }
00440     }
00441     else if(mode == Window::finaldestroy)
00442     {
00443         ;//SWARNING << "Last program user destroyed" << std::endl;
00444     }
00445     else if(mode == Window::initialize || mode == Window::reinitialize ||
00446             mode == Window::needrefresh)
00447     {
00448         if(mode != Window::needrefresh)
00449         {
00450             updateProgram(win);
00451         }
00452 
00453         updateProgramParameters(win);
00454         updateParameters(win, getParameters(), true, true/*mode != Window::needrefresh*/);
00455     }
00456     else
00457     {
00458         SWARNING << "SHLChunk(" << this << "::handleGL: Illegal mode: "
00459              << mode << " for id " << id << std::endl;
00460     }
00461 }

void osg::SHLChunk::operator= ( const SHLChunk source  )  [private]

void SHLChunk::updateProgram ( Window win  )  [private]

Definition at line 463 of file OSGSHLChunk.cpp.

References _cg_extension, _funcAttachObject, _funcCompileShader, _funcCreateProgramObject, _funcCreateShaderObject, _funcDeleteObject, _funcGetInfoLog, _funcGetObjectParameteriv, _funcLinkProgram, _funcShaderSource, _funcUseProgramObject, _geometry_extension, FFATAL, FWARNING, osg::SHLChunkBase::getCgFrontEnd(), osg::ShaderChunkBase::getFragmentProgram(), osg::Window::getFunction(), osg::ShaderChunkBase::getGeometryProgram(), osg::SHLChunkBase::getGLId(), osg::Window::getGLObjectId(), osg::ShaderParameterChunkBase::getParameters(), osg::ShaderChunkBase::getVertexProgram(), GL_CG_FRAGMENT_SHADER_EXT, GL_CG_VERTEX_SHADER_EXT, GL_FRAGMENT_SHADER_ARB, GL_GEOMETRY_SHADER_EXT, GL_OBJECT_COMPILE_STATUS_ARB, GL_OBJECT_INFO_LOG_LENGTH_ARB, GL_OBJECT_LINK_STATUS_ARB, GL_VERTEX_SHADER_ARB, GLenum, GLint(), GLuint(), osg::Window::hasExtension(), osg::Window::setGLObjectId(), updateParameterLocations(), updateParameters(), and updateProgramParameters().

Referenced by handleGL().

00464 {
00465     //printf("SHLChunk::updateProgram glid %u\n", getGLId());
00466 
00467     // get "glCreateProgramObjectARB" function pointer
00468     OSGGLCREATEPROGRAMOBJECTARBPROC createProgramObject = (OSGGLCREATEPROGRAMOBJECTARBPROC)
00469         win->getFunction(_funcCreateProgramObject);
00470 
00471     // get "glDeleteObjectARB" function pointer
00472     OSGGLDELETEOBJECTARBPROC deleteObject = (OSGGLDELETEOBJECTARBPROC)
00473         win->getFunction(_funcDeleteObject);
00474 
00475     // get "glCreateShaderObjectARB" function pointer
00476     OSGGLCREATESHADEROBJECTARBPROC createShaderObject = (OSGGLCREATESHADEROBJECTARBPROC)
00477         win->getFunction(_funcCreateShaderObject);
00478 
00479     // get "glShaderSourceARB" function pointer
00480     OSGGLSHADERSOURCEARBPROC shaderSource = (OSGGLSHADERSOURCEARBPROC)
00481         win->getFunction(_funcShaderSource);
00482 
00483     // get "glCompileShaderARB" function pointer
00484     OSGGLCOMPILESHADERARBPROC compileShader = (OSGGLCOMPILESHADERARBPROC)
00485         win->getFunction(_funcCompileShader);
00486 
00487     // get "glGetObjectParameterivARB" function pointer
00488     OSGGLGETOBJECTPARAMETERIVARBPROC getObjectParameteriv = (OSGGLGETOBJECTPARAMETERIVARBPROC)
00489         win->getFunction(_funcGetObjectParameteriv);
00490 
00491     // get "glGetInfoLogARB" function pointer
00492     OSGGLGETINFOLOGARBPROC getInfoLog = (OSGGLGETINFOLOGARBPROC)
00493         win->getFunction(_funcGetInfoLog);
00494 
00495     // get "glAttachObjectARB" function pointer
00496     OSGGLATTACHOBJECTARBPROC attachObject = (OSGGLATTACHOBJECTARBPROC)
00497         win->getFunction(_funcAttachObject);
00498 
00499     // get "glLinkProgramARB" function pointer
00500     OSGGLLINKPROGRAMARBPROC linkProgram = (OSGGLLINKPROGRAMARBPROC)
00501         win->getFunction(_funcLinkProgram);
00502 
00503     // get "glUseProgramObjectARB" function pointer
00504     OSGGLUSEPROGRAMOBJECTARBPROC useProgramObject = (OSGGLUSEPROGRAMOBJECTARBPROC)
00505         win->getFunction(_funcUseProgramObject);
00506 
00507     GLuint program = (GLuint) win->getGLObjectId(getGLId());
00508     // delete old program.
00509     if(program != 0)
00510         deleteObject(program);
00511     program = createProgramObject();
00512     //printf("updateProgram create: %p %u %x\n", win, getGLId(), program);
00513     win->setGLObjectId(getGLId(), (UInt32) program);
00514 
00515     UInt32 vShader = 0;
00516     GLint has_vertex = 0;
00517     // reload programs
00518     if(!getVertexProgram().empty())
00519     {
00520         GLenum shader_type = GL_VERTEX_SHADER_ARB;
00521         if(getCgFrontEnd())
00522         {
00523             if(win->hasExtension(_cg_extension))
00524                 shader_type = GL_CG_VERTEX_SHADER_EXT;
00525             else
00526                 FWARNING(("EXT_Cg_shader extension not supported, using GLSL front end!\n"));
00527         }
00528 
00529         vShader = createShaderObject(shader_type);
00530         const char *source = getVertexProgram().c_str();
00531         shaderSource(vShader, 1, (const char **) &source, 0);
00532 
00533         int success = 0;
00534         compileShader(vShader);
00535         getObjectParameteriv(vShader, GL_OBJECT_COMPILE_STATUS_ARB, &has_vertex);
00536         
00537         if(has_vertex == 0)
00538         {
00539             char *debug;
00540             GLint debugLength;
00541             getObjectParameteriv(vShader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &debugLength);
00542               
00543             debug = new char[debugLength];
00544             getInfoLog(vShader, debugLength, &debugLength, debug);
00545         
00546             FFATAL(("Couldn't compile vertex program!\n%s\n", debug));
00547             delete [] debug;
00548             deleteObject(vShader);
00549         }
00550     }
00551 
00552     UInt32 fShader = 0;
00553     GLint has_fragment = 0;
00554     if(!getFragmentProgram().empty())
00555     {
00556         GLenum shader_type = GL_FRAGMENT_SHADER_ARB;
00557         if(getCgFrontEnd())
00558         {
00559             if(win->hasExtension(_cg_extension))
00560                 shader_type = GL_CG_FRAGMENT_SHADER_EXT;
00561             else
00562                 FWARNING(("EXT_Cg_shader extension not supported, using GLSL front end!\n"));
00563         }
00564 
00565         fShader = createShaderObject(shader_type);
00566         const char *source = getFragmentProgram().c_str();
00567         shaderSource(fShader, 1, (const char **) &source, 0);
00568 
00569         compileShader(fShader);
00570         getObjectParameteriv(fShader, GL_OBJECT_COMPILE_STATUS_ARB, &has_fragment);
00571         
00572         if(has_fragment == 0)
00573         {
00574             char *debug;
00575             GLint debugLength;
00576             getObjectParameteriv(fShader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &debugLength);
00577               
00578             debug = new char[debugLength];
00579             getInfoLog(fShader, debugLength, &debugLength, debug);
00580         
00581             FFATAL(("Couldn't compile fragment program!\n%s\n", debug));
00582             delete [] debug;
00583             deleteObject(fShader);
00584         }
00585     }
00586 
00587     UInt32 gShader = 0;
00588     GLint has_geometry = 0;
00589     // reload programs
00590     if(!getGeometryProgram().empty())
00591     {
00592         if(win->hasExtension(_geometry_extension))
00593         {
00594             GLenum shader_type = GL_GEOMETRY_SHADER_EXT;
00595 
00596             gShader = createShaderObject(shader_type);
00597             const char *source = getGeometryProgram().c_str();
00598             shaderSource(gShader, 1, (const char **) &source, 0);
00599 
00600             int success = 0;
00601             compileShader(gShader);
00602             getObjectParameteriv(gShader, GL_OBJECT_COMPILE_STATUS_ARB, &has_geometry);
00603 
00604             if(has_geometry == 0)
00605             {
00606                 char *debug;
00607                 GLint debugLength;
00608                 getObjectParameteriv(gShader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &debugLength);
00609 
00610                 debug = new char[debugLength];
00611                 getInfoLog(gShader, debugLength, &debugLength, debug);
00612 
00613                 FFATAL(("Couldn't compile geometry program!\n%s\n", debug));
00614                 delete [] debug;
00615                 deleteObject(gShader);
00616             }
00617         }
00618         else
00619         {
00620             FWARNING(("GL_EXT_geometry_shader4 extension not supported!\n"));
00621         }
00622     }
00623     
00624     updateProgramParameters(win);
00625 
00626     if(has_vertex || has_fragment || has_geometry)
00627     {
00628         if(has_vertex)
00629         {
00630             attachObject(program, vShader);
00631             // just flagged for deletion
00632             deleteObject(vShader);
00633         }
00634 
00635         if(has_fragment)
00636         {
00637             attachObject(program, fShader);
00638             // just flagged for deletion
00639             deleteObject(fShader);
00640         }
00641 
00642         if(has_geometry)
00643         {
00644             attachObject(program, gShader);
00645             // just flagged for deletion
00646             deleteObject(gShader);
00647         }
00648 
00649         linkProgram(program);
00650         
00651         GLint success = 0;
00652         getObjectParameteriv(program, GL_OBJECT_LINK_STATUS_ARB, &success);
00653         char *debug = NULL;
00654         GLint debugLength;
00655         getObjectParameteriv(program, GL_OBJECT_INFO_LOG_LENGTH_ARB, &debugLength);
00656         if(debugLength > 0)
00657         {
00658             debug = new char[debugLength];
00659             debug[0] = 0;
00660             getInfoLog(program, debugLength, &debugLength, debug);
00661         }
00662 
00663         if(success)
00664         {
00665             if(debug != NULL && debug[0] != 0)
00666                 FWARNING(("SHLChunk: link status: %s\n", debug));
00667         }
00668         else
00669         {
00670             if(debug != NULL && debug[0] != 0)
00671                 FFATAL(("Couldn't link vertex and fragment program!\n%s\n", debug));
00672             deleteObject(program);
00673             win->setGLObjectId(getGLId(), 0);
00674         }
00675         if(debug != NULL)
00676             delete [] debug;
00677     }
00678     else
00679     {
00680         deleteObject(program);
00681         win->setGLObjectId(getGLId(), 0);
00682     }
00683 
00684     // update all parameter locations
00685     updateParameterLocations(win, getParameters());
00686     // update all parameters.
00687     updateParameters(win, getParameters());
00688 }

void SHLChunk::checkOSGParameters ( bool  force = false  )  [private]

Definition at line 1035 of file OSGSHLChunk.cpp.

References _oldParameterSize, _osgParametersCallbacks, _userParameterCallbacks, FWARNING, osg::ShaderParameterChunkBase::getParameters(), osg::MField< FieldTypeT, fieldNameSpace >::getSize(), osg::MField< FieldTypeT, fieldNameSpace >::size(), updateActiveLightsMask(), updateCameraOrientation(), updateCameraPosition(), updateClusterId(), updateInvViewMatrix(), updateInvWorldMatrix(), updateLight0Active(), updateLight1Active(), updateLight2Active(), updateLight3Active(), updateLight4Active(), updateLight5Active(), updateLight6Active(), updateLight7Active(), updateStereoLeftEye(), updateTransInvWorldMatrix(), updateViewMatrix(), and updateWorldMatrix().

Referenced by updateParameterLocations(), and updateParameters().

01036 {
01037     // ok this can go wrong if you sub and add a parameter
01038     // between one begin/endEditCP ...
01039     if(!force &&
01040        getParameters().getSize() == _oldParameterSize)
01041         return;
01042 
01043     _oldParameterSize = getParameters().getSize();
01044 
01045     _osgParametersCallbacks.clear();
01046     const MFShaderParameterPtr &parameters = getParameters();
01047     for(UInt32 i = 0; i < parameters.size(); ++i)
01048     {
01049         ShaderParameterPtr parameter = parameters[i];
01050         if(parameter->getName().size() > 3 &&
01051            parameter->getName()[0] == 'O' &&
01052            parameter->getName()[1] == 'S' &&
01053            parameter->getName()[2] == 'G')
01054         {
01055             if(parameter->getName() == "OSGWorldMatrix")
01056             {
01057                 // .net compiler needs this workaround in opt mode ...
01058                 parametercbfp oldfp = NULL;
01059                 osgparametercbfp fp = updateWorldMatrix;
01060                 _osgParametersCallbacks.push_back(
01061                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01062             }
01063             else if(parameter->getName() == "OSGInvWorldMatrix")
01064             {
01065                 parametercbfp oldfp = NULL;
01066                 osgparametercbfp fp = updateInvWorldMatrix;
01067                 _osgParametersCallbacks.push_back(
01068                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01069             }
01070             else if(parameter->getName() == "OSGTransInvWorldMatrix")
01071             {
01072                 parametercbfp oldfp = NULL;
01073                 osgparametercbfp fp = updateTransInvWorldMatrix;
01074                 _osgParametersCallbacks.push_back(
01075                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01076             }
01077             else if(parameter->getName() == "OSGCameraOrientation")
01078             {
01079                 parametercbfp oldfp = NULL;
01080                 osgparametercbfp fp = updateCameraOrientation;
01081                 _osgParametersCallbacks.push_back(
01082                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01083             }
01084             else if(parameter->getName() == "OSGCameraPosition")
01085             {
01086                 parametercbfp oldfp = NULL;
01087                 osgparametercbfp fp = updateCameraPosition;
01088                 _osgParametersCallbacks.push_back(
01089                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01090             }
01091             else if(parameter->getName() == "OSGViewMatrix")
01092             {
01093                 parametercbfp oldfp = NULL;
01094                 osgparametercbfp fp = updateViewMatrix;
01095                 _osgParametersCallbacks.push_back(
01096                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01097             }
01098             else if(parameter->getName() == "OSGInvViewMatrix")
01099             {
01100                 parametercbfp oldfp = NULL;
01101                 osgparametercbfp fp = updateInvViewMatrix;
01102                 _osgParametersCallbacks.push_back(
01103                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01104             }
01105             else if(parameter->getName() == "OSGStereoLeftEye")
01106             {
01107                 parametercbfp oldfp = NULL;
01108                 osgparametercbfp fp = updateStereoLeftEye;
01109                 _osgParametersCallbacks.push_back(
01110                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01111             }
01112             else if(parameter->getName() == "OSGClusterId")
01113             {
01114                 parametercbfp oldfp = NULL;
01115                 osgparametercbfp fp = updateClusterId;
01116                 _osgParametersCallbacks.push_back(
01117                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01118             }
01119             else if(parameter->getName() == "OSGActiveLightsMask")
01120             {
01121                 parametercbfp oldfp = NULL;
01122                 osgparametercbfp fp = updateActiveLightsMask;
01123                 _osgParametersCallbacks.push_back(
01124                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01125             }
01126             else if(parameter->getName() == "OSGLight0Active")
01127             {
01128                 parametercbfp oldfp = NULL;
01129                 osgparametercbfp fp = updateLight0Active;
01130                 _osgParametersCallbacks.push_back(
01131                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01132             }
01133             else if(parameter->getName() == "OSGLight1Active")
01134             {
01135                 parametercbfp oldfp = NULL;
01136                 osgparametercbfp fp = updateLight1Active;
01137                 _osgParametersCallbacks.push_back(
01138                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01139             }
01140             else if(parameter->getName() == "OSGLight2Active")
01141             {
01142                 parametercbfp oldfp = NULL;
01143                 osgparametercbfp fp = updateLight2Active;
01144                 _osgParametersCallbacks.push_back(
01145                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01146             }
01147             else if(parameter->getName() == "OSGLight3Active")
01148             {
01149                 parametercbfp oldfp = NULL;
01150                 osgparametercbfp fp = updateLight3Active;
01151                 _osgParametersCallbacks.push_back(
01152                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01153             }
01154             else if(parameter->getName() == "OSGLight4Active")
01155             {
01156                 parametercbfp oldfp = NULL;
01157                 osgparametercbfp fp = updateLight4Active;
01158                 _osgParametersCallbacks.push_back(
01159                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01160             }
01161             else if(parameter->getName() == "OSGLight5Active")
01162             {
01163                 parametercbfp oldfp = NULL;
01164                 osgparametercbfp fp = updateLight5Active;
01165                 _osgParametersCallbacks.push_back(
01166                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01167             }
01168             else if(parameter->getName() == "OSGLight6Active")
01169             {
01170                 parametercbfp oldfp = NULL;
01171                 osgparametercbfp fp = updateLight6Active;
01172                 _osgParametersCallbacks.push_back(
01173                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01174             }
01175             else if(parameter->getName() == "OSGLight7Active")
01176             {
01177                 parametercbfp oldfp = NULL;
01178                 osgparametercbfp fp = updateLight7Active;
01179                 _osgParametersCallbacks.push_back(
01180                     std::make_pair(std::make_pair(oldfp, fp), parameter));
01181             }
01182             else
01183             {
01184                 // check user parameter callbacks.
01185                 userParameterCallbacksMap::iterator it =
01186                     _userParameterCallbacks.find(parameter->getName());
01187                 if(it != _userParameterCallbacks.end())
01188                 {
01189                     parametercbfp oldfp = (*it).second.first;
01190                     osgparametercbfp fp = (*it).second.second;
01191 
01192                     _osgParametersCallbacks.push_back(
01193                         std::make_pair(std::make_pair(oldfp, fp), parameter));
01194                 }
01195                 else
01196                 {
01197                     FWARNING(("SHLChunk::checkOSGParameters : unknown osg parameter '%s'\n",
01198                               parameter->getName().c_str()));
01199                 }
01200             }
01201         }
01202     }
01203 }

void SHLChunk::updateOSGParameters ( DrawActionBase action,
GLuint  program,
bool  update = false 
) [private]

Definition at line 1305 of file OSGSHLChunk.cpp.

References _funcGetUniformLocation, _osgParametersCallbacks, _userParametersCallback, osg::Window::getFunction(), osg::DrawActionBase::getWindow(), osg::ShaderParameter::SHPFlagNone, and osg::ShaderParameter::SHPFlagUpdate.

Referenced by activate(), changeFrom(), and update().

01307 {
01308     // get "glGetUniformLocationARB" function pointer
01309     OSGGLGETUNIFORMLOCATIONARBPROC getUniformLocation = (OSGGLGETUNIFORMLOCATIONARBPROC)
01310         action->getWindow()->getFunction(_funcGetUniformLocation);
01311 
01312     if(_userParametersCallback != NULL)
01313         _userParametersCallback(getUniformLocation, action, program);
01314 
01315     if(_osgParametersCallbacks.empty())
01316         return;
01317 
01318     for(UInt32 i=0;i<_osgParametersCallbacks.size();++i)
01319     {
01320         parametercbfp oldfp = _osgParametersCallbacks[i].first.first;
01321         osgparametercbfp fp = _osgParametersCallbacks[i].first.second;
01322         if(oldfp != NULL)
01323         {
01324             oldfp(getUniformLocation, action, program);
01325         }
01326         else if(fp != NULL)
01327         {
01328             // ok if update is true this means it was called from update()
01329             // in this case we only need set parameters which use the
01330             // object transformation (top_matrix())
01331             ShaderParameterPtr parameter = _osgParametersCallbacks[i].second;
01332             parameter->setFlags(update ? ShaderParameter::SHPFlagUpdate :
01333                                 ShaderParameter::SHPFlagNone);
01334             fp(parameter, action, program);
01335         }
01336     }
01337 }

void SHLChunk::updateWorldMatrix ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1339 of file OSGSHLChunk.cpp.

References _funcUniformMatrix4fv, FWARNING, osg::DrawActionBase::getCamera(), osg::Window::getFunction(), osg::TransformationMatrix< ValueTypeT >::getValues(), osg::DrawActionBase::getViewport(), osg::DrawActionBase::getWindow(), osg::RenderAction::top_matrix(), and updateParameterLocation().

Referenced by checkOSGParameters().

01341 {
01342     // this parameter needs to be updated for each object because it
01343     // is dependend from the object transformation!
01344     if(action->getCamera() == NULL || action->getViewport() == NULL)
01345     {
01346         FWARNING(("SHLChunk::updateWorldMatrix : Can't update OSGWorldMatrix"
01347                   "parameter, camera or viewport is NULL!\n"));
01348         return;
01349     }
01350 
01351     Matrix m;
01352     RenderAction *ra = dynamic_cast<RenderAction *>(action);
01353     if(ra != NULL)
01354         m = ra->top_matrix();
01355 
01356     // get "glUniformMatrix4fvARB" function pointer
01357     OSGGLUNIFORMMATRIXFVARBPROC uniformMatrix4fv = (OSGGLUNIFORMMATRIXFVARBPROC)
01358         action->getWindow()->getFunction(_funcUniformMatrix4fv);
01359     if(parameter->getLocation() == -1)
01360         updateParameterLocation(action->getWindow(), program, parameter);
01361     if(parameter->getLocation() != -1)
01362         uniformMatrix4fv(parameter->getLocation(), 1, GL_FALSE, m.getValues());
01363 }

void SHLChunk::updateInvWorldMatrix ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1365 of file OSGSHLChunk.cpp.

References _funcUniformMatrix4fv, FWARNING, osg::DrawActionBase::getCamera(), osg::Window::getFunction(), osg::TransformationMatrix< ValueTypeT >::getValues(), osg::DrawActionBase::getViewport(), osg::DrawActionBase::getWindow(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::RenderAction::top_matrix(), and updateParameterLocation().

Referenced by checkOSGParameters().

01367 {
01368     // this parameter needs to be updated for each object because it
01369     // is dependend from the object transformation!
01370     if(action->getCamera() == NULL || action->getViewport() == NULL)
01371     {
01372         FWARNING(("SHLChunk::updateInvWorldMatrix : Can't update OSGInvWorldMatrix"
01373                   "parameter, camera or viewport is NULL!\n"));
01374         return;
01375     }
01376 
01377     Matrix m;
01378     RenderAction *ra = dynamic_cast<RenderAction *>(action);
01379     if(ra != NULL)
01380         m = ra->top_matrix();
01381     m.invert();
01382 
01383     // get "glUniformMatrix4fvARB" function pointer
01384     OSGGLUNIFORMMATRIXFVARBPROC uniformMatrix4fv = (OSGGLUNIFORMMATRIXFVARBPROC)
01385         action->getWindow()->getFunction(_funcUniformMatrix4fv);
01386     if(parameter->getLocation() == -1)
01387         updateParameterLocation(action->getWindow(), program, parameter);
01388     if(parameter->getLocation() != -1)
01389         uniformMatrix4fv(parameter->getLocation(), 1, GL_FALSE, m.getValues());
01390 }

void SHLChunk::updateTransInvWorldMatrix ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1392 of file OSGSHLChunk.cpp.

References _funcUniformMatrix4fv, FWARNING, osg::DrawActionBase::getCamera(), osg::Window::getFunction(), osg::TransformationMatrix< ValueTypeT >::getValues(), osg::DrawActionBase::getViewport(), osg::DrawActionBase::getWindow(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::RenderAction::top_matrix(), osg::TransformationMatrix< ValueTypeT >::transpose(), and updateParameterLocation().

Referenced by checkOSGParameters().

01394 {
01395     // this parameter needs to be updated for each object because it
01396     // is dependend from the object transformation!
01397     if(action->getCamera() == NULL || action->getViewport() == NULL)
01398     {
01399         FWARNING(("SHLChunk::updateTransInvWorldMatrix : Can't update OSGTransInvWorldMatrix"
01400                   "parameter, camera or viewport is NULL!\n"));
01401         return;
01402     }
01403 
01404     Matrix m;
01405     RenderAction *ra = dynamic_cast<RenderAction *>(action);
01406     if(ra != NULL)
01407         m = ra->top_matrix();
01408     m.invert();
01409     m.transpose();
01410 
01411     // get "glUniformMatrix4fvARB" function pointer
01412     OSGGLUNIFORMMATRIXFVARBPROC uniformMatrix4fv = (OSGGLUNIFORMMATRIXFVARBPROC)
01413         action->getWindow()->getFunction(_funcUniformMatrix4fv);
01414     if(parameter->getLocation() == -1)
01415         updateParameterLocation(action->getWindow(), program, parameter);
01416     if(parameter->getLocation() != -1)
01417         uniformMatrix4fv(parameter->getLocation(), 1, GL_FALSE, m.getValues());
01418 }

void SHLChunk::updateCameraOrientation ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1420 of file OSGSHLChunk.cpp.

References _funcUniformMatrix4fv, FWARNING, osg::DrawActionBase::getCamera(), osg::Window::getFunction(), osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), osg::TransformationMatrix< ValueTypeT >::getValues(), osg::Camera::getViewing(), osg::DrawActionBase::getViewport(), osg::DrawActionBase::getWindow(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::ShaderParameter::SHPFlagUpdate, and updateParameterLocation().

Referenced by checkOSGParameters().

01422 {
01423     // the parameter is not object transformation dependend so we can leave now.
01424     if(parameter->getFlags() & ShaderParameter::SHPFlagUpdate)
01425         return;
01426 
01427     if(action->getCamera() == NULL || action->getViewport() == NULL)
01428     {
01429         FWARNING(("SHLChunk::updateCameraOrientation : Can't update OSGCameraOrientation"
01430                   "parameter, camera or viewport is NULL!\n"));
01431         return;
01432     }
01433 
01434     Matrix m;
01435     action->getCamera()->getViewing(m,
01436                                 action->getViewport()->getPixelWidth(),
01437                                 action->getViewport()->getPixelHeight());
01438     m.invert();
01439     m[3].setValues(0, 0, 0, 1);
01440 
01441     // get "glUniformMatrix4fvARB" function pointer
01442     OSGGLUNIFORMMATRIXFVARBPROC uniformMatrix4fv = (OSGGLUNIFORMMATRIXFVARBPROC)
01443         action->getWindow()->getFunction(_funcUniformMatrix4fv);
01444     if(parameter->getLocation() == -1)
01445         updateParameterLocation(action->getWindow(), program, parameter);
01446     if(parameter->getLocation() != -1)
01447         uniformMatrix4fv(parameter->getLocation(), 1, GL_FALSE, m.getValues());
01448 }

void SHLChunk::updateCameraPosition ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1450 of file OSGSHLChunk.cpp.

References _funcUniform3fv, FWARNING, osg::DrawActionBase::getCamera(), osg::Window::getFunction(), osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), osg::PointInterface< ValueTypeT, StorageInterfaceT >::getValues(), osg::Camera::getViewing(), osg::DrawActionBase::getViewport(), osg::DrawActionBase::getWindow(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::ShaderParameter::SHPFlagUpdate, and updateParameterLocation().

Referenced by checkOSGParameters().

01452 {
01453     if(parameter->getFlags() & ShaderParameter::SHPFlagUpdate)
01454         return;
01455 
01456     if(action->getCamera() == NULL || action->getViewport() == NULL)
01457     {
01458         FWARNING(("SHLChunk::updateCameraPosition : Can't update OSGCameraPosition"
01459                   "parameter, camera or viewport is NULL!\n"));
01460         return;
01461     }
01462 
01463     Matrix m;
01464     action->getCamera()->getViewing(m,
01465                                 action->getViewport()->getPixelWidth(),
01466                                 action->getViewport()->getPixelHeight());
01467     m.invert();
01468     Vec3f cameraPos(m[3][0], m[3][1], m[3][2]);
01469 
01470     // get "glUniform3fvARB" function pointer
01471     OSGGLUNIFORMFVARBPROC uniform3fv = (OSGGLUNIFORMFVARBPROC)
01472         action->getWindow()->getFunction(_funcUniform3fv);
01473     if(parameter->getLocation() == -1)
01474         updateParameterLocation(action->getWindow(), program, parameter);
01475     if(parameter->getLocation() != -1)
01476         uniform3fv(parameter->getLocation(), 1, cameraPos.getValues());
01477 }

void SHLChunk::updateViewMatrix ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1479 of file OSGSHLChunk.cpp.

References _funcUniformMatrix4fv, FWARNING, osg::DrawActionBase::getCamera(), osg::Window::getFunction(), osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), osg::TransformationMatrix< ValueTypeT >::getValues(), osg::Camera::getViewing(), osg::DrawActionBase::getViewport(), osg::DrawActionBase::getWindow(), osg::ShaderParameter::SHPFlagUpdate, and updateParameterLocation().

Referenced by checkOSGParameters().

01481 {
01482     if(parameter->getFlags() & ShaderParameter::SHPFlagUpdate)
01483         return;
01484 
01485     if(action->getCamera() == NULL || action->getViewport() == NULL)
01486     {
01487         FWARNING(("SHLChunk::updateViewMatrix : Can't update OSGViewMatrix"
01488                   "parameter, camera or viewport is NULL!\n"));
01489         return;
01490     }
01491 
01492     Matrix m;
01493     action->getCamera()->getViewing(m,
01494                                 action->getViewport()->getPixelWidth(),
01495                                 action->getViewport()->getPixelHeight());
01496 
01497     // get "glUniformMatrix4fvARB" function pointer
01498     OSGGLUNIFORMMATRIXFVARBPROC uniformMatrix4fv = (OSGGLUNIFORMMATRIXFVARBPROC)
01499         action->getWindow()->getFunction(_funcUniformMatrix4fv);
01500     if(parameter->getLocation() == -1)
01501         updateParameterLocation(action->getWindow(), program, parameter);
01502     if(parameter->getLocation() != -1)
01503         uniformMatrix4fv(parameter->getLocation(), 1, GL_FALSE, m.getValues());
01504 }

void SHLChunk::updateInvViewMatrix ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1506 of file OSGSHLChunk.cpp.

References _funcUniformMatrix4fv, FWARNING, osg::DrawActionBase::getCamera(), osg::Window::getFunction(), osg::Viewport::getPixelHeight(), osg::Viewport::getPixelWidth(), osg::TransformationMatrix< ValueTypeT >::getValues(), osg::Camera::getViewing(), osg::DrawActionBase::getViewport(), osg::DrawActionBase::getWindow(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::ShaderParameter::SHPFlagUpdate, and updateParameterLocation().

Referenced by checkOSGParameters().

01508 {
01509     if(parameter->getFlags() & ShaderParameter::SHPFlagUpdate)
01510         return;
01511 
01512     if(action->getCamera() == NULL || action->getViewport() == NULL)
01513     {
01514         FWARNING(("SHLChunk::updateInvViewMatrix : Can't update OSGInvViewMatrix"
01515                   "parameter, camera or viewport is NULL!\n"));
01516         return;
01517     }
01518 
01519     Matrix m;
01520     action->getCamera()->getViewing(m,
01521                                 action->getViewport()->getPixelWidth(),
01522                                 action->getViewport()->getPixelHeight());
01523     m.invert();
01524 
01525     // get "glUniformMatrix4fvARB" function pointer
01526     OSGGLUNIFORMMATRIXFVARBPROC uniformMatrix4fv = (OSGGLUNIFORMMATRIXFVARBPROC)
01527         action->getWindow()->getFunction(_funcUniformMatrix4fv);
01528     if(parameter->getLocation() == -1)
01529         updateParameterLocation(action->getWindow(), program, parameter);
01530     if(parameter->getLocation() != -1)
01531         uniformMatrix4fv(parameter->getLocation(), 1, GL_FALSE, m.getValues());
01532 }

void SHLChunk::updateStereoLeftEye ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1534 of file OSGSHLChunk.cpp.

References _funcUniform1i, osg::AttachmentContainerPtr::dcast(), FWARNING, osg::DrawActionBase::getCamera(), osg::Window::getFunction(), osg::DrawActionBase::getViewport(), osg::DrawActionBase::getWindow(), osg::NullFC, osg::ShaderParameter::SHPFlagUpdate, and updateParameterLocation().

Referenced by checkOSGParameters().

01536 {
01537     if(parameter->getFlags() & ShaderParameter::SHPFlagUpdate)
01538         return;
01539 
01540     if(action->getCamera() == NULL || action->getViewport() == NULL)
01541     {
01542         FWARNING(("SHLChunk::updateStereoLeftEye : Can't update OSGStereoLeftEye"
01543                   "parameter, camera or viewport is NULL!\n"));
01544         return;
01545     }
01546 
01547     // ok -1 is mono
01548     Int32 leftEye = -1;
01549     // now search for a stereo camera decorator and get the eye.
01550     CameraPtr camera(*action->getCamera());
01551     CameraDecoratorPtr decorator = CameraDecoratorPtr::dcast(camera);
01552     while(decorator != NullFC)
01553     {
01554         StereoCameraDecoratorPtr stereoDecorator = StereoCameraDecoratorPtr::dcast(decorator);
01555         if(stereoDecorator != NullFC)
01556         {
01557             if(stereoDecorator->getLeftEye())
01558                 leftEye = 1;
01559             else
01560                 leftEye = 0;
01561             break;
01562         }
01563         decorator = CameraDecoratorPtr::dcast(decorator->getDecoratee());
01564     }
01565 
01566     // get "glUniform1iARB" function pointer
01567     OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
01568         action->getWindow()->getFunction(_funcUniform1i);
01569     if(parameter->getLocation() == -1)
01570         updateParameterLocation(action->getWindow(), program, parameter);
01571     if(parameter->getLocation() != -1)
01572         uniform1i(parameter->getLocation(), leftEye);
01573 }

void SHLChunk::updateClusterId ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1580 of file OSGSHLChunk.cpp.

References _clusterId, _funcUniform1i, osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GLint(), osg::ShaderParameter::SHPFlagUpdate, and updateParameterLocation().

Referenced by checkOSGParameters().

01582 {
01583     if(parameter->getFlags() & ShaderParameter::SHPFlagUpdate)
01584         return;
01585 
01586     // get "glUniform1iARB" function pointer
01587     OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
01588         action->getWindow()->getFunction(_funcUniform1i);
01589     if(parameter->getLocation() == -1)
01590         updateParameterLocation(action->getWindow(), program, parameter);
01591     if(parameter->getLocation() != -1)
01592         uniform1i(parameter->getLocation(), (GLint) _clusterId);
01593 }

void SHLChunk::updateActiveLightsMask ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1595 of file OSGSHLChunk.cpp.

References _funcUniform1i, osg::RenderAction::getActiveLightsMask(), osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GLint(), and updateParameterLocation().

Referenced by checkOSGParameters().

01597 {
01598     RenderAction *ract = (RenderAction *) action;
01599 
01600     // get "glUniform1iARB" function pointer
01601     OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
01602         action->getWindow()->getFunction(_funcUniform1i);
01603     if(parameter->getLocation() == -1)
01604         updateParameterLocation(action->getWindow(), program, parameter);
01605     if(parameter->getLocation() != -1)
01606         uniform1i(parameter->getLocation(), (GLint) ract->getActiveLightsMask());
01607 }

void SHLChunk::updateLight0Active ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1609 of file OSGSHLChunk.cpp.

References _funcUniform1i, osg::RenderAction::getActiveLightsMask(), osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GLint(), and updateParameterLocation().

Referenced by checkOSGParameters().

01611 {
01612     RenderAction *ract = (RenderAction *) action;
01613 
01614     // get "glUniform1iARB" function pointer
01615     OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
01616         action->getWindow()->getFunction(_funcUniform1i);
01617     if(parameter->getLocation() == -1)
01618         updateParameterLocation(action->getWindow(), program, parameter);
01619     if(parameter->getLocation() != -1)
01620         uniform1i(parameter->getLocation(), (GLint) ract->getActiveLightsMask() & 1);
01621 }

void SHLChunk::updateLight1Active ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1623 of file OSGSHLChunk.cpp.

References _funcUniform1i, osg::RenderAction::getActiveLightsMask(), osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GLint(), and updateParameterLocation().

Referenced by checkOSGParameters().

01625 {
01626     RenderAction *ract = (RenderAction *) action;
01627 
01628     // get "glUniform1iARB" function pointer
01629     OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
01630         action->getWindow()->getFunction(_funcUniform1i);
01631     if(parameter->getLocation() == -1)
01632         updateParameterLocation(action->getWindow(), program, parameter);
01633     if(parameter->getLocation() != -1)
01634         uniform1i(parameter->getLocation(), (GLint) ract->getActiveLightsMask() & 2);
01635 }

void SHLChunk::updateLight2Active ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1637 of file OSGSHLChunk.cpp.

References _funcUniform1i, osg::RenderAction::getActiveLightsMask(), osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GLint(), and updateParameterLocation().

Referenced by checkOSGParameters().

01639 {
01640     RenderAction *ract = (RenderAction *) action;
01641 
01642     // get "glUniform1iARB" function pointer
01643     OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
01644         action->getWindow()->getFunction(_funcUniform1i);
01645     if(parameter->getLocation() == -1)
01646         updateParameterLocation(action->getWindow(), program, parameter);
01647     if(parameter->getLocation() != -1)
01648         uniform1i(parameter->getLocation(), (GLint) ract->getActiveLightsMask() & 4);
01649 }

void SHLChunk::updateLight3Active ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1651 of file OSGSHLChunk.cpp.

References _funcUniform1i, osg::RenderAction::getActiveLightsMask(), osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GLint(), and updateParameterLocation().

Referenced by checkOSGParameters().

01653 {
01654     RenderAction *ract = (RenderAction *) action;
01655 
01656     // get "glUniform1iARB" function pointer
01657     OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
01658         action->getWindow()->getFunction(_funcUniform1i);
01659     if(parameter->getLocation() == -1)
01660         updateParameterLocation(action->getWindow(), program, parameter);
01661     if(parameter->getLocation() != -1)
01662         uniform1i(parameter->getLocation(), (GLint) ract->getActiveLightsMask() & 8);
01663 }

void SHLChunk::updateLight4Active ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1665 of file OSGSHLChunk.cpp.

References _funcUniform1i, osg::RenderAction::getActiveLightsMask(), osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GLint(), and updateParameterLocation().

Referenced by checkOSGParameters().

01667 {
01668     RenderAction *ract = (RenderAction *) action;
01669 
01670     // get "glUniform1iARB" function pointer
01671     OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
01672         action->getWindow()->getFunction(_funcUniform1i);
01673     if(parameter->getLocation() == -1)
01674         updateParameterLocation(action->getWindow(), program, parameter);
01675     if(parameter->getLocation() != -1)
01676         uniform1i(parameter->getLocation(), (GLint) ract->getActiveLightsMask() & 16);
01677 }

void SHLChunk::updateLight5Active ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1679 of file OSGSHLChunk.cpp.

References _funcUniform1i, osg::RenderAction::getActiveLightsMask(), osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GLint(), and updateParameterLocation().

Referenced by checkOSGParameters().

01681 {
01682     RenderAction *ract = (RenderAction *) action;
01683 
01684     // get "glUniform1iARB" function pointer
01685     OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
01686         action->getWindow()->getFunction(_funcUniform1i);
01687     if(parameter->getLocation() == -1)
01688         updateParameterLocation(action->getWindow(), program, parameter);
01689     if(parameter->getLocation() != -1)
01690         uniform1i(parameter->getLocation(), (GLint) ract->getActiveLightsMask() & 32);
01691 }

void SHLChunk::updateLight6Active ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1693 of file OSGSHLChunk.cpp.

References _funcUniform1i, osg::RenderAction::getActiveLightsMask(), osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GLint(), and updateParameterLocation().

Referenced by checkOSGParameters().

01695 {
01696     RenderAction *ract = (RenderAction *) action;
01697 
01698     // get "glUniform1iARB" function pointer
01699     OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
01700         action->getWindow()->getFunction(_funcUniform1i);
01701     if(parameter->getLocation() == -1)
01702         updateParameterLocation(action->getWindow(), program, parameter);
01703     if(parameter->getLocation() != -1)
01704         uniform1i(parameter->getLocation(), (GLint) ract->getActiveLightsMask() & 64);
01705 }

void SHLChunk::updateLight7Active ( const ShaderParameterPtr parameter,
DrawActionBase action,
GLuint  program 
) [static, private]

Definition at line 1707 of file OSGSHLChunk.cpp.

References _funcUniform1i, osg::RenderAction::getActiveLightsMask(), osg::Window::getFunction(), osg::DrawActionBase::getWindow(), GLint(), and updateParameterLocation().

Referenced by checkOSGParameters().

01709 {
01710     RenderAction *ract = (RenderAction *) action;
01711 
01712     // get "glUniform1iARB" function pointer
01713     OSGGLUNIFORM1IARBPROC uniform1i = (OSGGLUNIFORM1IARBPROC)
01714         action->getWindow()->getFunction(_funcUniform1i);
01715     if(parameter->getLocation() == -1)
01716         updateParameterLocation(action->getWindow(), program, parameter);
01717     if(parameter->getLocation() != -1)
01718         uniform1i(parameter->getLocation(), (GLint) ract->getActiveLightsMask() & 128);
01719 }

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

Reimplemented from osg::ShaderChunkBase.

Definition at line 58 of file OSGSHLChunkBase.inl.

References osg::SHLChunkBase::_type.

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

00059 {
00060     return _type; 
00061 } 

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

Reimplemented from osg::ShaderChunkBase.

Definition at line 65 of file OSGSHLChunkBase.inl.

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

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

FieldContainerType & osg::SHLChunkBase::getType ( void   )  [virtual, inherited]

Reimplemented from osg::ShaderChunkBase.

Definition at line 162 of file OSGSHLChunkBase.cpp.

References osg::SHLChunkBase::_type.

00163 {
00164     return _type; 
00165 } 

const FieldContainerType & osg::SHLChunkBase::getType ( void   )  const [virtual, inherited]

Reimplemented from osg::ShaderChunkBase.

Definition at line 167 of file OSGSHLChunkBase.cpp.

References osg::SHLChunkBase::_type.

00168 {
00169     return _type;
00170 } 

UInt32 osg::SHLChunkBase::getContainerSize ( void   )  const [virtual, inherited]

Reimplemented from osg::ShaderChunkBase.

Definition at line 182 of file OSGSHLChunkBase.cpp.

00183 { 
00184     return sizeof(SHLChunk); 
00185 }

SFBool * osg::SHLChunkBase::getSFCgFrontEnd ( void   )  [inline, inherited]

Definition at line 101 of file OSGSHLChunkBase.inl.

References osg::SHLChunkBase::_sfCgFrontEnd.

00102 {
00103     return &_sfCgFrontEnd;
00104 }

SFBool * osg::SHLChunkBase::getSFPointSize ( void   )  [inline, inherited]

Definition at line 108 of file OSGSHLChunkBase.inl.

References osg::SHLChunkBase::_sfPointSize.

00109 {
00110     return &_sfPointSize;
00111 }

MFGLenum * osg::SHLChunkBase::getMFProgramParameterNames ( void   )  [inline, inherited]

Definition at line 115 of file OSGSHLChunkBase.inl.

References osg::SHLChunkBase::_mfProgramParameterNames.

00116 {
00117     return &_mfProgramParameterNames;
00118 }

MFUInt32 * osg::SHLChunkBase::getMFProgramParameterValues ( void   )  [inline, inherited]

Definition at line 122 of file OSGSHLChunkBase.inl.

References osg::SHLChunkBase::_mfProgramParameterValues.

00123 {
00124     return &_mfProgramParameterValues;
00125 }

SFUInt32 * osg::SHLChunkBase::getSFGLId ( void   )  [inline, inherited]

Definition at line 129 of file OSGSHLChunkBase.inl.

References osg::SHLChunkBase::_sfGLId.

00130 {
00131     return &_sfGLId;
00132 }

SFInt32 * osg::SHLChunkBase::getSFIgnoreGLForAspect ( void   )  [inline, inherited]

Definition at line 136 of file OSGSHLChunkBase.inl.

References osg::SHLChunkBase::_sfIgnoreGLForAspect.

00137 {
00138     return &_sfIgnoreGLForAspect;
00139 }

bool & osg::SHLChunkBase::getCgFrontEnd ( void   )  [inline, inherited]

Definition at line 144 of file OSGSHLChunkBase.inl.

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

Referenced by updateProgram().

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

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

Definition at line 151 of file OSGSHLChunkBase.inl.

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

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

bool & osg::SHLChunkBase::getPointSize ( void   )  [inline, inherited]

Definition at line 165 of file OSGSHLChunkBase.inl.

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

Referenced by activate(), changeFrom(), and deactivate().

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

const bool & osg::SHLChunkBase::getPointSize ( void   )  const [inline, inherited]

Definition at line 172 of file OSGSHLChunkBase.inl.

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

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

UInt32 & osg::SHLChunkBase::getGLId ( void   )  [inline, inherited]

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

Definition at line 193 of file OSGSHLChunkBase.inl.

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

00194 {
00195     return _sfGLId.getValue();
00196 }

Int32 & osg::SHLChunkBase::getIgnoreGLForAspect ( void   )  [inline, inherited]

Definition at line 207 of file OSGSHLChunkBase.inl.

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

00208 {
00209     return _sfIgnoreGLForAspect.getValue();
00210 }

const Int32 & osg::SHLChunkBase::getIgnoreGLForAspect ( void   )  const [inline, inherited]

Definition at line 214 of file OSGSHLChunkBase.inl.

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

00215 {
00216     return _sfIgnoreGLForAspect.getValue();
00217 }

GLenum & osg::SHLChunkBase::getProgramParameterNames ( const UInt32  index  )  [inline, inherited]

Definition at line 229 of file OSGSHLChunkBase.inl.

References osg::SHLChunkBase::_mfProgramParameterNames.

00230 {
00231     return _mfProgramParameterNames[index];
00232 }

MFGLenum & osg::SHLChunkBase::getProgramParameterNames ( void   )  [inline, inherited]

const MFGLenum & osg::SHLChunkBase::getProgramParameterNames ( void   )  const [inline, inherited]

Definition at line 243 of file OSGSHLChunkBase.inl.

References osg::SHLChunkBase::_mfProgramParameterNames.

00244 {
00245     return _mfProgramParameterNames;
00246 }

UInt32 & osg::SHLChunkBase::getProgramParameterValues ( const UInt32  index  )  [inline, inherited]

Definition at line 250 of file OSGSHLChunkBase.inl.

References osg::SHLChunkBase::_mfProgramParameterValues.

00251 {
00252     return _mfProgramParameterValues[index];
00253 }

MFUInt32 & osg::SHLChunkBase::getProgramParameterValues ( void   )  [inline, inherited]

const MFUInt32 & osg::SHLChunkBase::getProgramParameterValues ( void   )  const [inline, inherited]

Definition at line 264 of file OSGSHLChunkBase.inl.

References osg::SHLChunkBase::_mfProgramParameterValues.

00265 {
00266     return _mfProgramParameterValues;
00267 }

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

Definition at line 158 of file OSGSHLChunkBase.inl.

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

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

void osg::SHLChunkBase::setPointSize ( const bool &  value  )  [inline, inherited]

Definition at line 179 of file OSGSHLChunkBase.inl.

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

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

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

Definition at line 200 of file OSGSHLChunkBase.inl.

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

Referenced by changed(), and onCreate().

00201 {
00202     _sfGLId.setValue(value);
00203 }

void osg::SHLChunkBase::setIgnoreGLForAspect ( const Int32 value  )  [inline, inherited]

UInt32 osg::SHLChunkBase::getBinSize ( const BitVector whichField  )  [virtual, inherited]

Reimplemented from osg::ShaderChunkBase.

Definition at line 256 of file OSGSHLChunkBase.cpp.

References osg::SHLChunkBase::_mfProgramParameterNames, osg::SHLChunkBase::_mfProgramParameterValues, osg::SHLChunkBase::_sfCgFrontEnd, osg::SHLChunkBase::_sfGLId, osg::SHLChunkBase::_sfIgnoreGLForAspect, osg::SHLChunkBase::_sfPointSize, osg::SHLChunkBase::CgFrontEndFieldMask, osg::MField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::SField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::ShaderChunkBase::getBinSize(), osg::SHLChunkBase::GLIdFieldMask, osg::SHLChunkBase::IgnoreGLForAspectFieldMask, osg::FieldBits::NoField, osg::SHLChunkBase::PointSizeFieldMask, osg::SHLChunkBase::ProgramParameterNamesFieldMask, and osg::SHLChunkBase::ProgramParameterValuesFieldMask.

00257 {
00258     UInt32 returnValue = Inherited::getBinSize(whichField);
00259 
00260     if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00261     {
00262         returnValue += _sfCgFrontEnd.getBinSize();
00263     }
00264 
00265     if(FieldBits::NoField != (PointSizeFieldMask & whichField))
00266     {
00267         returnValue += _sfPointSize.getBinSize();
00268     }
00269 
00270     if(FieldBits::NoField != (ProgramParameterNamesFieldMask & whichField))
00271     {
00272         returnValue += _mfProgramParameterNames.getBinSize();
00273     }
00274 
00275     if(FieldBits::NoField != (ProgramParameterValuesFieldMask & whichField))
00276     {
00277         returnValue += _mfProgramParameterValues.getBinSize();
00278     }
00279 
00280     if(FieldBits::NoField != (GLIdFieldMask & whichField))
00281     {
00282         returnValue += _sfGLId.getBinSize();
00283     }
00284 
00285     if(FieldBits::NoField != (IgnoreGLForAspectFieldMask & whichField))
00286     {
00287         returnValue += _sfIgnoreGLForAspect.getBinSize();
00288     }
00289 
00290 
00291     return returnValue;
00292 }

void osg::SHLChunkBase::copyToBin ( BinaryDataHandler pMem,
const BitVector whichField 
) [virtual, inherited]

Reimplemented from osg::ShaderChunkBase.

Definition at line 294 of file OSGSHLChunkBase.cpp.

References osg::SHLChunkBase::_mfProgramParameterNames, osg::SHLChunkBase::_mfProgramParameterValues, osg::SHLChunkBase::_sfCgFrontEnd, osg::SHLChunkBase::_sfGLId, osg::SHLChunkBase::_sfIgnoreGLForAspect, osg::SHLChunkBase::_sfPointSize, osg::SHLChunkBase::CgFrontEndFieldMask, osg::MField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::SField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::ShaderChunkBase::copyToBin(), osg::SHLChunkBase::GLIdFieldMask, osg::SHLChunkBase::IgnoreGLForAspectFieldMask, osg::FieldBits::NoField, osg::SHLChunkBase::PointSizeFieldMask, osg::SHLChunkBase::ProgramParameterNamesFieldMask, and osg::SHLChunkBase::ProgramParameterValuesFieldMask.

00296 {
00297     Inherited::copyToBin(pMem, whichField);
00298 
00299     if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00300     {
00301         _sfCgFrontEnd.copyToBin(pMem);
00302     }
00303 
00304     if(FieldBits::NoField != (PointSizeFieldMask & whichField))
00305     {
00306         _sfPointSize.copyToBin(pMem);
00307     }
00308 
00309     if(FieldBits::NoField != (ProgramParameterNamesFieldMask & whichField))
00310     {
00311         _mfProgramParameterNames.copyToBin(pMem);
00312     }
00313 
00314     if(FieldBits::NoField != (ProgramParameterValuesFieldMask & whichField))
00315     {
00316         _mfProgramParameterValues.copyToBin(pMem);
00317     }
00318 
00319     if(FieldBits::NoField != (GLIdFieldMask & whichField))
00320     {
00321         _sfGLId.copyToBin(pMem);
00322     }
00323 
00324     if(FieldBits::NoField != (IgnoreGLForAspectFieldMask & whichField))
00325     {
00326         _sfIgnoreGLForAspect.copyToBin(pMem);
00327     }
00328 
00329 
00330 }

void osg::SHLChunkBase::copyFromBin ( BinaryDataHandler pMem,
const BitVector whichField 
) [virtual, inherited]

Reimplemented from osg::ShaderChunkBase.

Definition at line 332 of file OSGSHLChunkBase.cpp.

References osg::SHLChunkBase::_mfProgramParameterNames, osg::SHLChunkBase::_mfProgramParameterValues, osg::SHLChunkBase::_sfCgFrontEnd, osg::SHLChunkBase::_sfGLId, osg::SHLChunkBase::_sfIgnoreGLForAspect, osg::SHLChunkBase::_sfPointSize, osg::SHLChunkBase::CgFrontEndFieldMask, osg::MField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::SField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::ShaderChunkBase::copyFromBin(), osg::SHLChunkBase::GLIdFieldMask, osg::SHLChunkBase::IgnoreGLForAspectFieldMask, osg::FieldBits::NoField, osg::SHLChunkBase::PointSizeFieldMask, osg::SHLChunkBase::ProgramParameterNamesFieldMask, and osg::SHLChunkBase::ProgramParameterValuesFieldMask.

00334 {
00335     Inherited::copyFromBin(pMem, whichField);
00336 
00337     if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00338     {
00339         _sfCgFrontEnd.copyFromBin(pMem);
00340     }
00341 
00342     if(FieldBits::NoField != (PointSizeFieldMask & whichField))
00343     {
00344         _sfPointSize.copyFromBin(pMem);
00345     }
00346 
00347     if(FieldBits::NoField != (ProgramParameterNamesFieldMask & whichField))
00348     {
00349         _mfProgramParameterNames.copyFromBin(pMem);
00350     }
00351 
00352     if(FieldBits::NoField != (ProgramParameterValuesFieldMask & whichField))
00353     {
00354         _mfProgramParameterValues.copyFromBin(pMem);
00355     }
00356 
00357     if(FieldBits::NoField != (GLIdFieldMask & whichField))
00358     {
00359         _sfGLId.copyFromBin(pMem);
00360     }
00361 
00362     if(FieldBits::NoField != (IgnoreGLForAspectFieldMask & whichField))
00363     {
00364         _sfIgnoreGLForAspect.copyFromBin(pMem);
00365     }
00366 
00367 
00368 }

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

Reimplemented from osg::Attachment.

Definition at line 72 of file OSGSHLChunkBase.inl.

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

Referenced by osg::ColorDisplayFilter::createFilter().

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, inherited]

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 osg::SHLChunkBase::shallowCopy ( void   )  const [virtual, inherited]

Reimplemented from osg::Attachment.

Definition at line 173 of file OSGSHLChunkBase.cpp.

References osg::FieldContainer::newPtr().

Referenced by osg::SHLChunkBase::create().

00174 { 
00175     SHLChunkPtr returnValue; 
00176 
00177     newPtr(returnValue, dynamic_cast<const SHLChunk *>(this)); 
00178 
00179     return returnValue; 
00180 }

void osg::SHLChunkBase::executeSyncImpl ( SHLChunkBase pOther,
const BitVector whichField 
) [protected, inherited]

Definition at line 371 of file OSGSHLChunkBase.cpp.

References osg::SHLChunkBase::_mfProgramParameterNames, osg::SHLChunkBase::_mfProgramParameterValues, osg::SHLChunkBase::_sfCgFrontEnd, osg::SHLChunkBase::_sfGLId, osg::SHLChunkBase::_sfIgnoreGLForAspect, osg::SHLChunkBase::_sfPointSize, osg::SHLChunkBase::CgFrontEndFieldMask, osg::ShaderChunkBase::executeSyncImpl(), osg::SHLChunkBase::GLIdFieldMask, osg::SHLChunkBase::IgnoreGLForAspectFieldMask, osg::FieldBits::NoField, osg::SHLChunkBase::PointSizeFieldMask, osg::SHLChunkBase::ProgramParameterNamesFieldMask, osg::SHLChunkBase::ProgramParameterValuesFieldMask, osg::MField< FieldTypeT, fieldNameSpace >::syncWith(), and osg::SField< FieldTypeT, fieldNameSpace >::syncWith().

Referenced by osg::SHLChunkBase::executeSync().

00373 {
00374 
00375     Inherited::executeSyncImpl(pOther, whichField);
00376 
00377     if(FieldBits::NoField != (CgFrontEndFieldMask & whichField))
00378         _sfCgFrontEnd.syncWith(pOther->_sfCgFrontEnd);
00379 
00380     if(FieldBits::NoField != (PointSizeFieldMask & whichField))
00381         _sfPointSize.syncWith(pOther->_sfPointSize);
00382 
00383     if(FieldBits::NoField != (ProgramParameterNamesFieldMask & whichField))
00384         _mfProgramParameterNames.syncWith(pOther->_mfProgramParameterNames);
00385 
00386     if(FieldBits::NoField != (ProgramParameterValuesFieldMask & whichField))
00387         _mfProgramParameterValues.syncWith(pOther->_mfProgramParameterValues);
00388 
00389     if(FieldBits::NoField != (GLIdFieldMask & whichField))
00390         _sfGLId.syncWith(pOther->_sfGLId);
00391 
00392     if(FieldBits::NoField != (IgnoreGLForAspectFieldMask & whichField))
00393         _sfIgnoreGLForAspect.syncWith(pOther->_sfIgnoreGLForAspect);
00394 
00395 
00396 }

void osg::ShaderChunkBase::executeSyncImpl ( ShaderChunkBase pOther,
const BitVector whichField 
) [protected, inherited]

void ShaderParameterChunkBase::executeSyncImpl ( ShaderParameterChunkBase pOther,
const BitVector whichField 
) [protected, inherited]

void osg::StateChunkBase::executeSyncImpl ( StateChunkBase pOther,
const BitVector whichField 
) [protected, inherited]

void Attachment::executeSyncImpl ( Attachment pOther,
const BitVector whichField 
) [protected, inherited]

void osg::FieldContainer::executeSyncImpl ( FieldContainer pOther,
const BitVector whichField 
) [inline, protected, inherited]

void osg::SHLChunkBase::executeSync ( FieldContainer other,
const BitVector whichField 
) [protected, virtual, inherited]

Reimplemented from osg::ShaderChunkBase.

Definition at line 189 of file OSGSHLChunkBase.cpp.

References osg::SHLChunkBase::executeSyncImpl().

00191 {
00192     this->executeSyncImpl((SHLChunkBase *) &other, whichField);
00193 }

bool ShaderChunk::readVertexProgram ( const char *  file  )  [inherited]

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 }

bool ShaderChunk::readVertexProgram ( std::istream &  stream  )  [inherited]

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 }

bool ShaderChunk::readFragmentProgram ( const char *  file  )  [inherited]

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 }

bool ShaderChunk::readFragmentProgram ( std::istream &  stream  )  [inherited]

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 }

SFString * osg::ShaderChunkBase::getSFVertexProgram ( void   )  [inline, inherited]

Definition at line 75 of file OSGShaderChunkBase.inl.

References osg::ShaderChunkBase::_sfVertexProgram.

00076 {
00077     return &_sfVertexProgram;
00078 }

SFString * osg::ShaderChunkBase::getSFFragmentProgram ( void   )  [inline, inherited]

Definition at line 82 of file OSGShaderChunkBase.inl.

References osg::ShaderChunkBase::_sfFragmentProgram.

00083 {
00084     return &_sfFragmentProgram;
00085 }

SFString * osg::ShaderChunkBase::getSFGeometryProgram ( void   )  [inline, inherited]

Definition at line 89 of file OSGShaderChunkBase.inl.

References osg::ShaderChunkBase::_sfGeometryProgram.

00090 {
00091     return &_sfGeometryProgram;
00092 }

std::string & osg::ShaderChunkBase::getVertexProgram ( void   )  [inline, inherited]

const std::string & osg::ShaderChunkBase::getVertexProgram ( void   )  const [inline, inherited]

Definition at line 104 of file OSGShaderChunkBase.inl.

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

00105 {
00106     return _sfVertexProgram.getValue();
00107 }

std::string & osg::ShaderChunkBase::getFragmentProgram ( void   )  [inline, inherited]

const std::string & osg::ShaderChunkBase::getFragmentProgram ( void   )  const [inline, inherited]

Definition at line 125 of file OSGShaderChunkBase.inl.

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

00126 {
00127     return _sfFragmentProgram.getValue();
00128 }

std::string & osg::ShaderChunkBase::getGeometryProgram ( void   )  [inline, inherited]

Definition at line 139 of file OSGShaderChunkBase.inl.

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

Referenced by updateProgram().

00140 {
00141     return _sfGeometryProgram.getValue();
00142 }

const std::string & osg::ShaderChunkBase::getGeometryProgram ( void   )  const [inline, inherited]

Definition at line 146 of file OSGShaderChunkBase.inl.

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

00147 {
00148     return _sfGeometryProgram.getValue();
00149 }

void osg::ShaderChunkBase::setVertexProgram ( const std::string &  value  )  [inline, inherited]

void osg::ShaderChunkBase::setFragmentProgram ( const std::string &  value  )  [inline, inherited]

void osg::ShaderChunkBase::setGeometryProgram ( const std::string &  value  )  [inline, inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
bool  value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
Int32  value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
Real32  value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
const Vec2f value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
const Vec3f value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
const Vec4f value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
const Matrix value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
const MFInt32 value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
const MFReal32 value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
const MFVec2f value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
const MFVec3f value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
const MFVec4f value 
) [inherited]

bool ShaderParameterChunk::setUniformParameter ( const char *  name,
const MFMatrix value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
bool &  value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
Int32 value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
Real32 value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
Vec2f value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
Vec3f value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
Vec4f value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
Matrix value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
MFInt32 value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
MFReal32 value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
MFVec2f value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
MFVec3f value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
MFVec4f value 
) [inherited]

bool ShaderParameterChunk::getUniformParameter ( const char *  name,
MFMatrix value 
) [inherited]

bool ShaderParameterChunk::subUniformParameter ( const char *  name  )  [inherited]

void ShaderParameterChunk::onCreate ( const ShaderParameterChunk source = NULL  )  [protected, inherited]

void osg::FieldContainer::onCreate ( const FieldContainer source = NULL  )  [inline, protected, inherited]

Definition at line 318 of file OSGFieldContainerImpl.inl.

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

00319 {
00320 }

MFShaderParameterPtr * osg::ShaderParameterChunkBase::getMFParameters ( void   )  [inline, inherited]

Definition at line 75 of file OSGShaderParameterChunkBase.inl.

References osg::ShaderParameterChunkBase::_mfParameters.

00076 {
00077     return &_mfParameters;
00078 }

ShaderParameterPtr & osg::ShaderParameterChunkBase::getParameters ( const UInt32  index  )  [inline, inherited]

Definition at line 84 of file OSGShaderParameterChunkBase.inl.

References osg::ShaderParameterChunkBase::_mfParameters.

Referenced by osg::SHLParameterChunk::operator==(), and operator==().

00085 {
00086     return _mfParameters[index];
00087 }

MFShaderParameterPtr & osg::ShaderParameterChunkBase::getParameters ( void   )  [inline, inherited]

const MFShaderParameterPtr & osg::ShaderParameterChunkBase::getParameters ( void   )  const [inline, inherited]

Definition at line 98 of file OSGShaderParameterChunkBase.inl.

References osg::ShaderParameterChunkBase::_mfParameters.

00099 {
00100     return _mfParameters;
00101 }

UInt32 osg::StateChunk::getClassId ( void   )  const [inline, inherited]

Definition at line 48 of file OSGStateChunk.inl.

References osg::StateChunk::getClass(), and osg::StateChunkClass::getId().

00049 {
00050     return getClass()->getId();
00051 }

bool StateChunk::isTransparent ( void   )  const [virtual, inherited]

Check if the chunk is transparent, i.e. needs to be rendered after the opaque objects.

Reimplemented in osg::BlendChunk, osg::MaterialChunk, osg::PointChunk, osg::ProgramChunk, osg::RegisterCombinersChunk, and osg::TextureChunk.

Definition at line 352 of file OSGStateChunk.cpp.

00353 {
00354     return false;
00355 }

SFBool * osg::StateChunkBase::getSFIgnore ( void   )  [inline, inherited]

Definition at line 75 of file OSGStateChunkBase.inl.

References osg::StateChunkBase::_sfIgnore.

00076 {
00077     return &_sfIgnore;
00078 }

bool & osg::StateChunkBase::getIgnore ( void   )  [inline, inherited]

Definition at line 83 of file OSGStateChunkBase.inl.

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

00084 {
00085     return _sfIgnore.getValue();
00086 }

const bool & osg::StateChunkBase::getIgnore ( void   )  const [inline, inherited]

Definition at line 90 of file OSGStateChunkBase.inl.

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

00091 {
00092     return _sfIgnore.getValue();
00093 }

void osg::StateChunkBase::setIgnore ( const bool &  value  )  [inline, inherited]

Definition at line 97 of file OSGStateChunkBase.inl.

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

00098 {
00099     _sfIgnore.setValue(value);
00100 }

MFFieldContainerPtr & Attachment::getParents ( void   )  [inherited]

Definition at line 95 of file OSGAttachment.cpp.

00096 {
00097     return _parents;
00098 }

const MFFieldContainerPtr & Attachment::getParents ( void   )  const [inherited]

Definition at line 100 of file OSGAttachment.cpp.

References osg::Attachment::_parents.

00101 {
00102     return _parents;
00103 }

MFFieldContainerPtr * Attachment::getMFParents ( void   )  [inherited]

Definition at line 105 of file OSGAttachment.cpp.

References osg::Attachment::_parents.

Referenced by osg::DVRLookupTable::changed().

00106 {
00107     return &_parents;
00108 }

void Attachment::addParent ( FieldContainerPtr  parent  )  [inherited]

Definition at line 110 of file OSGAttachment.cpp.

References osg::Attachment::_parents, and osg::MField< FieldTypeT, fieldNameSpace >::push_back().

00111 {
00112     _parents.push_back(parent);
00113 }

void Attachment::subParent ( FieldContainerPtr  parent  )  [inherited]

Int32 Attachment::findParent ( FieldContainerPtr  parent  )  [inherited]

Definition at line 125 of file OSGAttachment.cpp.

References osg::Attachment::_parents, osg::MField< FieldTypeT, fieldNameSpace >::begin(), osg::MField< FieldTypeT, fieldNameSpace >::end(), and osg::MField< FieldTypeT, fieldNameSpace >::find().

00126 {
00127     MFFieldContainerPtr::iterator parentIt = _parents.find(parent);
00128 
00129     if(parentIt != _parents.end())
00130     {
00131         return parentIt - _parents.begin();
00132     }
00133     else
00134     {
00135         return -1;
00136     }
00137 }

SFBool & Attachment::getInternal ( void   )  [inherited]

Definition at line 142 of file OSGAttachment.cpp.

References osg::Attachment::_sfInternal.

00143 {
00144     return _sfInternal;
00145 }

const SFBool & Attachment::getInternal ( void   )  const [inherited]

Definition at line 147 of file OSGAttachment.cpp.

References osg::Attachment::_sfInternal.

00148 {
00149     return _sfInternal;
00150 }

SFBool * Attachment::getSFInternal ( void   )  [inherited]

Definition at line 152 of file OSGAttachment.cpp.

References osg::Attachment::_sfInternal.

00153 {
00154     return &_sfInternal;
00155 }

void Attachment::setInternal ( bool  bVal  )  [inherited]

Definition at line 157 of file OSGAttachment.cpp.

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

00158 {
00159     _sfInternal.setValue(bVal);
00160 }

UInt16 osg::FieldContainer::getClassGroupId ( void   )  [inline, static, inherited]

Definition at line 71 of file OSGFieldContainerImpl.inl.

References osg::FieldContainer::_type, and osg::FieldContainerType::getGroupId().

00072 {
00073     return _type.getGroupId();
00074 }

UInt32 osg::FieldContainer::getTypeId ( void   )  const [inline, inherited]

Definition at line 77 of file OSGFieldContainerImpl.inl.

References osg::TypeBase::getId(), and osg::FieldContainer::getType().

Referenced by osg::TextureChunk::changeFrom(), and osg::CubeTextureChunk::changeFrom().

00078 {
00079     return getType().getId();
00080 }

UInt16 osg::FieldContainer::getGroupId ( void   )  const [inline, inherited]

const Char8 * osg::FieldContainer::getTypeName ( void   )  const [inline, inherited]

Definition at line 89 of file OSGFieldContainerImpl.inl.

References osg::TypeBase::getCName(), and osg::FieldContainer::getType().

00090 {
00091     return getType().getCName();
00092 }

Field * osg::FieldContainer::getField ( UInt32  fieldId  )  [inline, inherited]

Generic Field Access

Definition at line 95 of file OSGFieldContainerImpl.inl.

References osg::FieldDescription::getField(), osg::FieldContainerType::getFieldDescription(), and osg::FieldContainer::getType().

Referenced by osg::QFCItem::expand(), osg::VRMLShapeDesc::getFieldAndDesc(), osg::QFieldViewBase::getFieldPtr(), osg::QFieldEditorBase::getFieldPtr(), osg::getParentsField(), and osg::QFCItem::setup().

00096 {
00097     const FieldDescription *desc = getType().getFieldDescription(fieldId);
00098 
00099     return desc ? desc->getField(*this) : NULL;
00100 }

Field * osg::FieldContainer::getField ( const Char8 fieldName  )  [inline, inherited]

Generic Field Access

Definition at line 103 of file OSGFieldContainerImpl.inl.

References osg::FieldContainerType::findFieldDescription(), osg::FieldDescription::getField(), and osg::FieldContainer::getType().

00104 {
00105     const FieldDescription *desc =getType().findFieldDescription(fieldName);
00106 
00107     return desc ? desc->getField(*this) : NULL;
00108 }

template<class ObjectPtrT>
void osg::FieldContainer::newPtr ( ObjectPtrT &  result,
const typename ObjectPtrT::StoredObjectType *  prototypeP 
) [inline, static, protected, inherited]

Definition at line 138 of file OSGFieldContainerImpl.inl.

References osg::ChangeList::addCreated(), osg::PThreadBase::getAspect(), osg::PThreadBase::getCurrentChangeList(), osg::ThreadManager::getNumAspects(), osg::FieldContainerFactory::registerFieldContainer(), and osg::FieldContainerFactory::the().

Referenced by osg::XWindowBase::createEmpty(), osg::WIN32WindowBase::createEmpty(), osg::ViewportBase::createEmpty(), osg::VertexProgramChunkBase::createEmpty(), osg::TwoSidedLightingChunkBase::createEmpty(), osg::TransformChunkBase::createEmpty(), osg::TransformBase::createEmpty(), osg::TileCameraDecoratorBase::createEmpty(), osg::TextureTransformChunkBase::createEmpty(), osg::TextureGrabForegroundBase::createEmpty(), osg::TextureGrabBackgroundBase::createEmpty(), osg::TextureChunkBase::createEmpty(), osg::TextureBackgroundBase::createEmpty(), osg::TexGenChunkBase::createEmpty(), osg::SwitchMaterialBase::createEmpty(), osg::SwitchBase::createEmpty(), osg::SurfaceBase::createEmpty(), osg::StringAttributeMapBase::createEmpty(), osg::StereoBufferViewportBase::createEmpty(), osg::StencilChunkBase::createEmpty(), osg::StateSortingGroupBase::createEmpty(), osg::StateBase::createEmpty(), osg::SpotLightBase::createEmpty(), osg::SortFirstWindowBase::createEmpty(), osg::SolidBackgroundBase::createEmpty(), osg::SlicesBase::createEmpty(), osg::SkyBackgroundBase::createEmpty(), osg::SimpleTexturedMaterialBase::createEmpty(), osg::SimpleStatisticsForegroundBase::createEmpty(), osg::SimpleMaterialBase::createEmpty(), osg::SHLParameterChunkBase::createEmpty(), osg::SHLChunkBase::createEmpty(), osg::ShearedStereoCameraDecoratorBase::createEmpty(), osg::ShaderParameterVec4fBase::createEmpty(), osg::ShaderParameterVec3fBase::createEmpty(), osg::ShaderParameterVec2fBase::createEmpty(), osg::ShaderParameterStringBase::createEmpty(), osg::ShaderParameterRealBase::createEmpty(), osg::ShaderParameterMVec4fBase::createEmpty(), osg::ShaderParameterMVec3fBase::createEmpty(), osg::ShaderParameterMVec2fBase::createEmpty(), osg::ShaderParameterMRealBase::createEmpty(), osg::ShaderParameterMMatrixBase::createEmpty(), osg::ShaderParameterMIntBase::createEmpty(), osg::ShaderParameterMatrixBase::createEmpty(), osg::ShaderParameterIntBase::createEmpty(), osg::ShaderParameterBoolBase::createEmpty(), osg::ScreenGroupBase::createEmpty(), osg::SClipPlaneChunkBase::createEmpty(), osg::ResolutionDisplayFilterBase::createEmpty(), osg::RenderOptionsBase::createEmpty(), osg::RegisterCombinersChunkBase::createEmpty(), osg::QTWindowBase::createEmpty(), osg::ProxyGroupBase::createEmpty(), osg::ProjectionCameraDecoratorBase::createEmpty(), osg::PolygonForegroundBase::createEmpty(), osg::PolygonChunkBase::createEmpty(), osg::PolygonBackgroundBase::createEmpty(), osg::PointLightBase::createEmpty(), osg::PointChunkBase::createEmpty(), osg::PhongMaterialBase::createEmpty(), osg::PerspectiveCameraBase::createEmpty(), osg::PassiveWindowBase::createEmpty(), osg::PassiveViewportBase::createEmpty(), osg::PassiveBackgroundBase::createEmpty(), osg::ParticlesBase::createEmpty(), osg::OrthographicCameraBase::createEmpty(), osg::OffCenterPerspectiveCameraBase::createEmpty(), osg::MultiPassMaterialBase::createEmpty(), osg::MultiDisplayWindowBase::createEmpty(), osg::MatrixCameraDecoratorBase::createEmpty(), osg::MatrixCameraBase::createEmpty(), osg::MaterialPoolBase::createEmpty(), osg::MaterialGroupBase::createEmpty(), osg::MaterialChunkBase::createEmpty(), osg::LogicOpChunkBase::createEmpty(), osg::LineChunkBase::createEmpty(), osg::LightModelChunkBase::createEmpty(), osg::LightEnvBase::createEmpty(), osg::LightChunkBase::createEmpty(), osg::InverseTransformBase::createEmpty(), osg::InlineBase::createEmpty(), osg::ImageForegroundBase::createEmpty(), osg::ImageBase::createEmpty(), osg::ImageBackgroundBase::createEmpty(), osg::GroupBase::createEmpty(), osg::GraphicStatisticsForegroundBase::createEmpty(), osg::GradientBackgroundBase::createEmpty(), osg::GrabForegroundBase::createEmpty(), osg::GLUTWindowBase::createEmpty(), osg::GeometryBase::createEmpty(), osg::FresnelMaterialBase::createEmpty(), osg::FragmentProgramChunkBase::createEmpty(), osg::FileGrabForegroundBase::createEmpty(), osg::FCPtrAttributeMapBase::createEmpty(), osg::FBOViewportBase::createEmpty(), osg::FatBorderChunkBase::createEmpty(), osg::DVRVolumeTextureBase::createEmpty(), osg::DVRVolumeBase::createEmpty(), osg::DVRSimpleShaderBase::createEmpty(), osg::DVRSimpleLUTShaderBase::createEmpty(), osg::DVRMtexLUTShaderBase::createEmpty(), osg::DVRLookupTableBase::createEmpty(), osg::DVRIsoSurfaceBase::createEmpty(), osg::DVRIsoShaderBase::createEmpty(), osg::DVRGeometryBase::createEmpty(), osg::DVRClipObjectsBase::createEmpty(), osg::DVRClipGeometryBase::createEmpty(), osg::DVRAppearanceBase::createEmpty(), osg::DistortionDisplayFilterBase::createEmpty(), osg::DistanceLODBase::createEmpty(), osg::DisplayFilterForegroundBase::createEmpty(), osg::DisplayCalibrationBase::createEmpty(), osg::DirectionalLightBase::createEmpty(), osg::DepthClearBackgroundBase::createEmpty(), osg::DepthChunkBase::createEmpty(), osg::CubeTextureChunkBase::createEmpty(), osg::ComponentTransformBase::createEmpty(), osg::ColorMaskChunkBase::createEmpty(), osg::ColorDisplayFilterBase::createEmpty(), osg::ColorBufferViewportBase::createEmpty(), osg::ClusterWindowBase::createEmpty(), osg::ClipPlaneChunkBase::createEmpty(), osg::ClipPlaneBase::createEmpty(), osg::ChunkMaterialBase::createEmpty(), osg::BlendChunkBase::createEmpty(), osg::BillboardBase::createEmpty(), osg::XWindowBase::shallowCopy(), osg::WIN32WindowBase::shallowCopy(), osg::ViewportBase::shallowCopy(), osg::VertexProgramChunkBase::shallowCopy(), osg::TwoSidedLightingChunkBase::shallowCopy(), osg::TransformChunkBase::shallowCopy(), osg::TransformBase::shallowCopy(), osg::TileCameraDecoratorBase::shallowCopy(), osg::TextureTransformChunkBase::shallowCopy(), osg::TextureGrabForegroundBase::shallowCopy(), osg::TextureGrabBackgroundBase::shallowCopy(), osg::TextureChunkBase::shallowCopy(), osg::TextureBackgroundBase::shallowCopy(), osg::TexGenChunkBase::shallowCopy(), osg::SwitchMaterialBase::shallowCopy(), osg::SwitchBase::shallowCopy(), osg::SurfaceBase::shallowCopy(), osg::StringAttributeMapBase::shallowCopy(), osg::StereoBufferViewportBase::shallowCopy(), osg::StencilChunkBase::shallowCopy(), osg::StateSortingGroupBase::shallowCopy(), osg::StateBase::shallowCopy(), osg::SpotLightBase::shallowCopy(), osg::SortFirstWindowBase::shallowCopy(), osg::SolidBackgroundBase::shallowCopy(), osg::SlicesBase::shallowCopy(), osg::SkyBackgroundBase::shallowCopy(), osg::SimpleTexturedMaterialBase::shallowCopy(), osg::SimpleStatisticsForegroundBase::shallowCopy(), osg::SimpleMaterialBase::shallowCopy(), osg::SHLParameterChunkBase::shallowCopy(), osg::SHLChunkBase::shallowCopy(), osg::ShearedStereoCameraDecoratorBase::shallowCopy(), osg::ShaderParameterVec4fBase::shallowCopy(), osg::ShaderParameterVec3fBase::shallowCopy(), osg::ShaderParameterVec2fBase::shallowCopy(), osg::ShaderParameterStringBase::shallowCopy(), osg::ShaderParameterRealBase::shallowCopy(), osg::ShaderParameterMVec4fBase::shallowCopy(), osg::ShaderParameterMVec3fBase::shallowCopy(), osg::ShaderParameterMVec2fBase::shallowCopy(), osg::ShaderParameterMRealBase::shallowCopy(), osg::ShaderParameterMMatrixBase::shallowCopy(), osg::ShaderParameterMIntBase::shallowCopy(), osg::ShaderParameterMatrixBase::shallowCopy(), osg::ShaderParameterIntBase::shallowCopy(), osg::ShaderParameterBoolBase::shallowCopy(), osg::ScreenGroupBase::shallowCopy(), osg::SClipPlaneChunkBase::shallowCopy(), osg::ResolutionDisplayFilterBase::shallowCopy(), osg::RenderOptionsBase::shallowCopy(), osg::RegisterCombinersChunkBase::shallowCopy(), osg::QTWindowBase::shallowCopy(), osg::ProxyGroupBase::shallowCopy(), osg::ProjectionCameraDecoratorBase::shallowCopy(), osg::PolygonForegroundBase::shallowCopy(), osg::PolygonChunkBase::shallowCopy(), osg::PolygonBackgroundBase::shallowCopy(), osg::PointLightBase::shallowCopy(), osg::PointChunkBase::shallowCopy(), osg::PhongMaterialBase::shallowCopy(), osg::PerspectiveCameraBase::shallowCopy(), osg::PassiveWindowBase::shallowCopy(), osg::PassiveViewportBase::shallowCopy(), osg::PassiveBackgroundBase::shallowCopy(), osg::ParticlesBase::shallowCopy(), osg::OrthographicCameraBase::shallowCopy(), osg::OffCenterPerspectiveCameraBase::shallowCopy(), osg::MultiPassMaterialBase::shallowCopy(), osg::MultiDisplayWindowBase::shallowCopy(), osg::MatrixCameraDecoratorBase::shallowCopy(), osg::MatrixCameraBase::shallowCopy(), osg::MaterialPoolBase::shallowCopy(), osg::MaterialGroupBase::shallowCopy(), osg::MaterialChunkBase::shallowCopy(), osg::LogicOpChunkBase::shallowCopy(), osg::LineChunkBase::shallowCopy(), osg::LightModelChunkBase::shallowCopy(), osg::LightEnvBase::shallowCopy(), osg::LightChunkBase::shallowCopy(), osg::InverseTransformBase::shallowCopy(), osg::InlineBase::shallowCopy(), osg::ImageForegroundBase::shallowCopy(), osg::ImageBase::shallowCopy(), osg::ImageBackgroundBase::shallowCopy(), osg::GroupBase::shallowCopy(), osg::GraphicStatisticsForegroundBase::shallowCopy(), osg::GradientBackgroundBase::shallowCopy(), osg::GrabForegroundBase::shallowCopy(), osg::GLUTWindowBase::shallowCopy(), osg::GeometryBase::shallowCopy(), osg::FresnelMaterialBase::shallowCopy(), osg::FragmentProgramChunkBase::shallowCopy(), osg::FileGrabForegroundBase::shallowCopy(), osg::FCPtrAttributeMapBase::shallowCopy(), osg::FBOViewportBase::shallowCopy(), osg::FatBorderChunkBase::shallowCopy(), osg::DVRVolumeTextureBase::shallowCopy(), osg::DVRVolumeBase::shallowCopy(), osg::DVRSimpleShaderBase::shallowCopy(), osg::DVRSimpleLUTShaderBase::shallowCopy(), osg::DVRMtexLUTShaderBase::shallowCopy(), osg::DVRLookupTableBase::shallowCopy(), osg::DVRIsoSurfaceBase::shallowCopy(), osg::DVRIsoShaderBase::shallowCopy(), osg::DVRGeometryBase::shallowCopy(), osg::DVRClipObjectsBase::shallowCopy(), osg::DVRClipGeometryBase::shallowCopy(), osg::DVRAppearanceBase::shallowCopy(), osg::DistortionDisplayFilterBase::shallowCopy(), osg::DistanceLODBase::shallowCopy(), osg::DisplayFilterForegroundBase::shallowCopy(), osg::DisplayCalibrationBase::shallowCopy(), osg::DirectionalLightBase::shallowCopy(), osg::DepthClearBackgroundBase::shallowCopy(), osg::DepthChunkBase::shallowCopy(), osg::CubeTextureChunkBase::shallowCopy(), osg::ComponentTransformBase::shallowCopy(), osg::ColorMaskChunkBase::shallowCopy(), osg::ColorDisplayFilterBase::shallowCopy(), osg::ColorBufferViewportBase::shallowCopy(), osg::ClusterWindowBase::shallowCopy(), osg::ClipPlaneChunkBase::shallowCopy(), osg::ClipPlaneBase::shallowCopy(), osg::ChunkMaterialBase::shallowCopy(), osg::BlendChunkBase::shallowCopy(), and osg::BillboardBase::shallowCopy().

00141 {
00142     typedef typename ObjectPtrT::StoredObjectType ObjectType;
00143     
00144     UInt8 *pTmp;
00145     
00146     result._containerSize = sizeof(ObjectType);
00147     
00148     pTmp        = 
00149         static_cast<UInt8 *>(operator new(
00150             sizeof(Int32)      + // ReferenceCount
00151             sizeof(UInt32)     + // ContainerId
00152             sizeof(ObjectType) * ThreadManager::getNumAspects()));
00153     
00154     *(reinterpret_cast<Int32 *>(pTmp)) = 0;
00155     
00156     pTmp += sizeof(Int32);
00157     
00158     result._storeP = (pTmp + sizeof(UInt32));
00159 
00160 #ifdef OSG_DEBUG_FCPTR
00161     result._typedStoreP = reinterpret_cast<FieldContainer *>(result._storeP);
00162 #endif
00163 
00164     *(reinterpret_cast<UInt32 *>(pTmp)) = 
00165         FieldContainerFactory::the()->registerFieldContainer(result);
00166     
00167     Thread::getCurrentChangeList()->addCreated(
00168         *(reinterpret_cast<UInt32 *>(pTmp)));
00169     
00170     pTmp += sizeof(UInt32);
00171     
00172     ObjectType *aObject = reinterpret_cast<ObjectType *>(pTmp);
00173 
00174     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00175     {
00176         pTmp = 
00177             reinterpret_cast<UInt8 *>(new (pTmp) ObjectType(*prototypeP));
00178         
00179         pTmp += sizeof(ObjectType);
00180     }
00181     
00182     result->onCreate(prototypeP);
00183 
00184     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00185     {
00186         aObject[i].onCreateAspect(aObject, prototypeP);
00187     }
00188 
00189 #if defined(OSG_GV_BETA) && defined(OSG_DBG_MEM)
00190 
00191     fprintf(stderr, "GV_MEM_FC_DBG : (%u) cc (%p|%u)\n", 
00192             Thread::getAspect(),
00193             result._storeP,
00194 //            ObjectType::getClassType().getCName(),
00195             ObjectType::getClassType().getId());
00196 #endif
00197 
00198 #ifdef OSG_DEBUG_TYPED_FCPTR
00199     result.updateTypedStore();
00200 #endif
00201 }

template<class ObjectPtrT>
void osg::FieldContainer::newPtr ( ObjectPtrT &  result  )  [inline, static, protected, inherited]

Definition at line 204 of file OSGFieldContainerImpl.inl.

References osg::ChangeList::addCreated(), osg::PThreadBase::getAspect(), osg::PThreadBase::getCurrentChangeList(), osg::ThreadManager::getNumAspects(), osg::FieldContainerFactory::registerFieldContainer(), and osg::FieldContainerFactory::the().

00205 {
00206     typedef typename ObjectPtrT::StoredObjectType ObjectType;
00207     
00208     UInt8 *pTmp;
00209     
00210     result._containerSize = sizeof(ObjectType);
00211     
00212     pTmp        =             
00213         static_cast<UInt8 *>(operator new(
00214             sizeof(Int32)      + // ReferenceCount
00215             sizeof(UInt32)     + // ContainerId
00216             sizeof(ObjectType) * ThreadManager::getNumAspects()));
00217     
00218     *(reinterpret_cast<Int32 *>(pTmp)) = 0;
00219     
00220     pTmp  += sizeof(Int32);
00221     
00222     result._storeP = (pTmp + sizeof(UInt32));
00223     
00224 #ifdef OSG_DEBUG_FCPTR
00225     result._typedStoreP = reinterpret_cast<FieldContainer *>(result._storeP);
00226 #endif
00227 
00228     *(reinterpret_cast<UInt32 *>(pTmp)) = 
00229         FieldContainerFactory::the()->registerFieldContainer(result);
00230     
00231     Thread::getCurrentChangeList()->addCreated(
00232         *(reinterpret_cast<UInt32 *>(pTmp)));
00233     
00234     pTmp += sizeof(UInt32);
00235     
00236     ObjectType *aObject = reinterpret_cast<ObjectType *>(pTmp);
00237 
00238     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00239     {
00240         pTmp = reinterpret_cast<UInt8 *>(new (pTmp) ObjectType());
00241         
00242         pTmp += sizeof(ObjectType);
00243     }
00244     
00245     result->onCreate();
00246     
00247     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00248     {
00249         aObject[i].onCreateAspect(aObject);
00250     }
00251 
00252 #if defined(OSG_GV_BETA) && defined(OSG_DBG_MEM)
00253     fprintf(stderr, "GV_MEM_FC_DBG : (%u) c (%p|%u)\n", 
00254             Thread::getAspect(),
00255             result._storeP,
00256 //            ObjectType::getClassType().getCName(),
00257             ObjectType::getClassType().getId());
00258 #endif
00259     
00260 #ifdef OSG_DEBUG_TYPED_FCPTR
00261     result.updateTypedStore();
00262 #endif
00263 }

template<class FieldTypeT>
void osg::FieldContainer::beginEditX ( const BitVector whichField,
FieldTypeT &  field 
) [inline, protected, inherited]

Definition at line 285 of file OSGFieldContainerImpl.inl.

00286 {
00287 //    fieldR.beginEdit();
00288 }

template<class FieldTypeT>
void osg::FieldContainer::endEditX ( const BitVector whichField,
FieldTypeT &  field 
) [inline, protected, inherited]

Definition at line 291 of file OSGFieldContainerImpl.inl.

References osg::endEditCP().

00292 {
00293     FieldContainerPtr tmpPtr(this);
00294     endEditCP(tmpPtr, whichField);
00295 }

void osg::FieldContainer::onCreateAspect ( const FieldContainer aspect0,
const FieldContainer source = NULL 
) [inline, protected, inherited]

Definition at line 323 of file OSGFieldContainerImpl.inl.

00325 {
00326 }


Friends And Related Function Documentation

friend class FieldContainer [friend]

Reimplemented from osg::SHLChunkBase.

Definition at line 232 of file OSGSHLChunk.h.

friend class SHLChunkBase [friend]

Definition at line 233 of file OSGSHLChunk.h.


Member Data Documentation

StateChunkClass SHLChunk::_class [static, private]

Definition at line 236 of file OSGSHLChunk.h.

Referenced by getClass(), and getStaticClass().

UInt32 SHLChunk::_shl_extension [static, private]

Definition at line 242 of file OSGSHLChunk.h.

Referenced by handleGL(), and SHLChunk().

UInt32 SHLChunk::_cg_extension [static, private]

Definition at line 243 of file OSGSHLChunk.h.

Referenced by SHLChunk(), and updateProgram().

Definition at line 244 of file OSGSHLChunk.h.

Referenced by SHLChunk(), updateProgram(), and updateProgramParameters().

UInt32 SHLChunk::_funcCreateProgramObject = Window::invalidFunctionID [static, private]

Definition at line 246 of file OSGSHLChunk.h.

Referenced by SHLChunk(), and updateProgram().

UInt32 SHLChunk::_funcProgramParameteri = Window::invalidFunctionID [static, private]

Definition at line 247 of file OSGSHLChunk.h.

Referenced by SHLChunk(), and updateProgramParameters().

UInt32 SHLChunk::_funcCreateShaderObject = Window::invalidFunctionID [static, private]

Definition at line 248 of file OSGSHLChunk.h.

Referenced by SHLChunk(), and updateProgram().

UInt32 SHLChunk::_funcDeleteObject = Window::invalidFunctionID [static, private]

Definition at line 249 of file OSGSHLChunk.h.

Referenced by handleGL(), SHLChunk(), and updateProgram().

UInt32 SHLChunk::_funcDetachObject = Window::invalidFunctionID [static, private]

Definition at line 250 of file OSGSHLChunk.h.

Referenced by SHLChunk().

UInt32 SHLChunk::_funcAttachObject = Window::invalidFunctionID [static, private]

Definition at line 251 of file OSGSHLChunk.h.

Referenced by SHLChunk(), and updateProgram().

UInt32 SHLChunk::_funcShaderSource = Window::invalidFunctionID [static, private]

Definition at line 253 of file OSGSHLChunk.h.

Referenced by SHLChunk(), and updateProgram().

UInt32 SHLChunk::_funcCompileShader = Window::invalidFunctionID [static, private]

Definition at line 254 of file OSGSHLChunk.h.

Referenced by SHLChunk(), and updateProgram().

UInt32 SHLChunk::_funcLinkProgram = Window::invalidFunctionID [static, private]

Definition at line 255 of file OSGSHLChunk.h.

Referenced by SHLChunk(), and updateProgram().

UInt32 SHLChunk::_funcGetInfoLog = Window::invalidFunctionID [static, private]

Definition at line 256 of file OSGSHLChunk.h.

Referenced by SHLChunk(), and updateProgram().

UInt32 SHLChunk::_funcUseProgramObject = Window::invalidFunctionID [static, private]

UInt32 SHLChunk::_funcGetObjectParameteriv = Window::invalidFunctionID [static, private]

Definition at line 259 of file OSGSHLChunk.h.

Referenced by SHLChunk(), and updateProgram().

UInt32 SHLChunk::_funcGetObjectParameterfv = Window::invalidFunctionID [static, private]

Definition at line 260 of file OSGSHLChunk.h.

Referenced by SHLChunk().

UInt32 SHLChunk::_funcGetUniformLocation = Window::invalidFunctionID [static, private]

UInt32 SHLChunk::_funcBindAttribLocation = Window::invalidFunctionID [static, private]

Definition at line 263 of file OSGSHLChunk.h.

Referenced by SHLChunk().

UInt32 SHLChunk::_funcGetAttribLocation = Window::invalidFunctionID [static, private]

Definition at line 264 of file OSGSHLChunk.h.

Referenced by SHLChunk().

UInt32 SHLChunk::_funcUniform1i = Window::invalidFunctionID [static, private]

UInt32 SHLChunk::_funcUniform1iv = Window::invalidFunctionID [static, private]

Definition at line 267 of file OSGSHLChunk.h.

Referenced by getFuncUniform1iv(), SHLChunk(), and updateParameters().

UInt32 SHLChunk::_funcUniform2iv = Window::invalidFunctionID [static, private]

Definition at line 268 of file OSGSHLChunk.h.

Referenced by getFuncUniform2iv(), and SHLChunk().

UInt32 SHLChunk::_funcUniform3iv = Window::invalidFunctionID [static, private]

Definition at line 269 of file OSGSHLChunk.h.

Referenced by getFuncUniform3iv(), and SHLChunk().

UInt32 SHLChunk::_funcUniform4iv = Window::invalidFunctionID [static, private]

Definition at line 270 of file OSGSHLChunk.h.

Referenced by getFuncUniform4iv(), and SHLChunk().

UInt32 SHLChunk::_funcUniform1f = Window::invalidFunctionID [static, private]

Definition at line 272 of file OSGSHLChunk.h.

Referenced by getFuncUniform1f(), SHLChunk(), and updateParameters().

UInt32 SHLChunk::_funcUniform1fv = Window::invalidFunctionID [static, private]

Definition at line 273 of file OSGSHLChunk.h.

Referenced by getFuncUniform1fv(), SHLChunk(), and updateParameters().

UInt32 SHLChunk::_funcUniform2fv = Window::invalidFunctionID [static, private]

Definition at line 274 of file OSGSHLChunk.h.

Referenced by getFuncUniform2fv(), SHLChunk(), and updateParameters().

UInt32 SHLChunk::_funcUniform3fv = Window::invalidFunctionID [static, private]

Definition at line 275 of file OSGSHLChunk.h.

Referenced by getFuncUniform3fv(), SHLChunk(), updateCameraPosition(), and updateParameters().

UInt32 SHLChunk::_funcUniform4fv = Window::invalidFunctionID [static, private]

Definition at line 276 of file OSGSHLChunk.h.

Referenced by getFuncUniform4fv(), SHLChunk(), and updateParameters().

UInt32 SHLChunk::_funcUniformMatrix4fv = Window::invalidFunctionID [static, private]

UInt32 SHLChunk::_funcGetUniformiv = Window::invalidFunctionID [static, private]

Definition at line 280 of file OSGSHLChunk.h.

Referenced by getFuncGetUniformiv(), and SHLChunk().

UInt32 SHLChunk::_funcGetUniformfv = Window::invalidFunctionID [static, private]

Definition at line 281 of file OSGSHLChunk.h.

Referenced by getFuncGetUniformfv(), and SHLChunk().

Int32 SHLChunk::_clusterId = -1 [static, private]

Definition at line 283 of file OSGSHLChunk.h.

Referenced by setClusterId(), and updateClusterId().

Definition at line 337 of file OSGSHLChunk.h.

Referenced by checkOSGParameters(), and updateOSGParameters().

Definition at line 339 of file OSGSHLChunk.h.

Referenced by checkOSGParameters().

Definition at line 343 of file OSGSHLChunk.h.

Referenced by addParameterCallback(), and checkOSGParameters().

Definition at line 345 of file OSGSHLChunk.h.

Referenced by setParameterCallback(), and updateOSGParameters().

Initial value:

 
    (Inherited::MTInfluenceMask) | 
    (static_cast<BitVector>(0x0) << Inherited::NextFieldId)

Reimplemented from osg::ShaderChunkBase.

Definition at line 116 of file OSGSHLChunkBase.h.

bool osg::SHLChunkBase::_sfCgFrontEnd [protected, inherited]

bool osg::SHLChunkBase::_sfPointSize [protected, inherited]

GLenum osg::SHLChunkBase::_mfProgramParameterNames [protected, inherited]

UInt32 osg::SHLChunkBase::_sfGLId [protected, inherited]

std::string osg::ShaderChunkBase::_sfVertexProgram [protected, inherited]

std::string osg::ShaderChunkBase::_sfFragmentProgram [protected, inherited]

std::string osg::ShaderChunkBase::_sfGeometryProgram [protected, inherited]

bool osg::StateChunkBase::_sfIgnore [protected, inherited]

const BitVector Attachment::InternalFieldMask = (1 << Attachment::InternalFieldId) [static, inherited]

const BitVector Attachment::ParentsFieldMask = (1 << Attachment::ParentsFieldId) [static, inherited]

SFBool osg::Attachment::_sfInternal [protected, inherited]

const BitVector osg::FieldContainer::NextFieldMask [static, inherited]

Initial value:

 
                    (TypeTraits<BitVector>::One << NextFieldId)

Definition at line 75 of file OSGFieldContainerImpl.h.

const bool osg::FieldContainer::isNodeCore = false [static, inherited]

Reimplemented in osg::NodeCore.

Definition at line 181 of file OSGFieldContainerImpl.h.

UInt32 osg::FieldContainer::_shares [protected, inherited]

Definition at line 199 of file OSGFieldContainerImpl.h.


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 11:28:22 2008 for OpenSG by  doxygen 1.5.5