Futher work on supporting update and event callbacks in StateSet, Uniform and StateAttribute

This commit is contained in:
Robert Osfield
2005-04-25 13:37:12 +00:00
parent 78f88247f8
commit e24cfa0370
13 changed files with 432 additions and 50 deletions

View File

@@ -276,6 +276,7 @@ class OSG_EXPORT Node : public Object
ParentList _parents;
friend class osg::Group;
friend class osg::Drawable;
friend class osg::StateSet;
ref_ptr<NodeCallback> _updateCallback;
unsigned int _numChildrenRequiringUpdateTraversal;

View File

@@ -45,8 +45,8 @@ class OSG_EXPORT Shader : public osg::Object
UNDEFINED = -1
};
Shader();
Shader( Type type, const char* sourceText = 0 );
Shader( Type type = UNDEFINED);
Shader( Type type, const std::string& source );
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
Shader(const Shader& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
@@ -56,12 +56,17 @@ class OSG_EXPORT Shader : public osg::Object
int compare(const Shader& rhs) const;
bool setType( Type t );
/** Load the Shader's source code text from a string. */
void setShaderSource( const char* sourceText );
void setShaderSource( const std::string& sourceText );
/** Read shader source from file and then constructor shader of specified type.
* Return the resulting Shader or 0 if no valid shader source code be read.*/
static Shader* readShaderFile( Type type, const std::string& fileName );
/** Load the Shader's source code text from a file. */
bool loadShaderSourceFromFile( const char* fileName );
bool loadShaderSourceFromFile( const std::string& fileName );
/** Query the shader's source code text */
inline const std::string& getShaderSource() const { return _shaderSource; }

View File

@@ -282,7 +282,7 @@ class OSG_EXPORT StateAttribute : public Object
};
/** Set the UpdateCallback which allows users to attach customize the updating of an object during the update traversal.*/
void setUpdateCallback(Callback* uc) { _updateCallback = uc; }
void setUpdateCallback(Callback* uc);
/** Get the non const UpdateCallback.*/
Callback* getUpdateCallback() { return _updateCallback.get(); }
@@ -292,7 +292,7 @@ class OSG_EXPORT StateAttribute : public Object
/** Set the EventCallback which allows users to attach customize the updating of an object during the Event traversal.*/
void setEventCallback(Callback* ec) { _eventCallback = ec; }
void setEventCallback(Callback* ec);
/** Get the non const EventCallback.*/
Callback* getEventCallback() { return _eventCallback.get(); }

View File

@@ -454,6 +454,8 @@ class OSG_EXPORT StateSet : public Object
ParentList _parents;
friend class osg::Node;
friend class osg::Drawable;
friend class osg::Uniform;
friend class osg::StateAttribute;
ModeList _modeList;
AttributeList _attributeList;

View File

@@ -280,7 +280,7 @@ class OSG_EXPORT Uniform : public Object
};
/** Set the UpdateCallback which allows users to attach customize the updating of an object during the update traversal.*/
void setUpdateCallback(Callback* uc) { _updateCallback = uc; }
void setUpdateCallback(Callback* uc);
/** Get the non const UpdateCallback.*/
Callback* getUpdateCallback() { return _updateCallback.get(); }
@@ -290,7 +290,7 @@ class OSG_EXPORT Uniform : public Object
/** Set the EventCallback which allows users to attach customize the updating of an object during the Event traversal.*/
void setEventCallback(Callback* ec) { _eventCallback = ec; }
void setEventCallback(Callback* ec);
/** Get the non const EventCallback.*/
Callback* getEventCallback() { return _eventCallback.get(); }