diff --git a/include/osg/BindImageTexture b/include/osg/BindImageTexture index 0d7e64b69..3734d32c2 100644 --- a/include/osg/BindImageTexture +++ b/include/osg/BindImageTexture @@ -10,7 +10,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ -/// author: Julien Valentin 2017 (mp3butcher@hotmail.com) +/// author: Julien Valentin 2017 (mp3butcher@hotmail.com) #ifndef _GLImageUnitBinding_H #define _GLImageUnitBinding_H @@ -29,7 +29,7 @@ namespace osg class OSG_EXPORT BindImageTexture : public osg::StateAttribute { public: /** Type of access that will be performed on the texture image. */ - enum ImageAccess + enum Access { NOT_USED = 0, READ_ONLY = GL_READ_ONLY_ARB, @@ -40,7 +40,7 @@ class OSG_EXPORT BindImageTexture : public osg::StateAttribute { BindImageTexture( GLuint imageunit = 0, osg::Texture* target = 0, - ImageAccess access = READ_ONLY, + Access access = READ_ONLY, GLenum format = GL_RGBA8, int level = 0, bool layered = GL_FALSE, @@ -67,27 +67,27 @@ class OSG_EXPORT BindImageTexture : public osg::StateAttribute { META_StateAttribute(osg,BindImageTexture, BINDIMAGETEXTURE) - void setImageUnit(GLuint i) { _imageunit=i; } - GLuint getImageUnit() const { return _imageunit; } + inline void setImageUnit(GLuint i) { _imageunit=i; } + inline GLuint getImageUnit() const { return _imageunit; } - void setLevel(GLint i) { _level=i; } - GLint getLevel() const { return _level; } + inline void setLevel(GLint i) { _level=i; } + inline GLint getLevel() const { return _level; } - void setIsLayered(GLboolean i) { _layered=i; } - GLboolean getIsLayered() const { return _layered; } + inline void setIsLayered(GLboolean i) { _layered=i; } + inline GLboolean getIsLayered() const { return _layered; } - void setLayer(GLint i) { _layer=i; } - GLint getLayer() const { return _layer; } + inline void setLayer(GLint i) { _layer=i; } + inline GLint getLayer() const { return _layer; } - void setAccess(ImageAccess i) { _access=i; } - GLenum getAccess()const { return _access; } + inline void setAccess(Access i) { _access=i; } + inline Access getAccess() const { return _access; } - void setFormat(GLenum i) { _format=i; } - GLenum getFormat()const { return _format; } + inline void setFormat(GLenum i) { _format=i; } + inline GLenum getFormat() const { return _format; } - void setTexture(osg::Texture* target) { _target=target; } - osg::Texture* getTexture() { return _target.get();} - const osg::Texture* getTexture() const { return _target.get();} + inline void setTexture(osg::Texture* target) { _target=target; } + inline osg::Texture* getTexture() { return _target.get();} + inline const osg::Texture* getTexture() const { return _target.get();} virtual void apply(osg::State&state) const; @@ -102,11 +102,10 @@ class OSG_EXPORT BindImageTexture : public osg::StateAttribute { GLint _level; GLboolean _layered; GLint _layer; - GLenum _access; + Access _access; GLenum _format; }; } #endif - diff --git a/src/osgWrappers/serializers/osg/BindImageTexture.cpp b/src/osgWrappers/serializers/osg/BindImageTexture.cpp new file mode 100644 index 000000000..4d9e60709 --- /dev/null +++ b/src/osgWrappers/serializers/osg/BindImageTexture.cpp @@ -0,0 +1,30 @@ +#include +#include +#include +#include + +#define ADD_GLBOOL_SERIALIZER(PROP, DEF) \ + wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, GLboolean >( \ + #PROP, ((int)(DEF)), &MyClass::get##PROP, &MyClass::set##PROP), osgDB::BaseSerializer::RW_BOOL ) + +REGISTER_OBJECT_WRAPPER( BindImageTexture, + new osg::BindImageTexture, + osg::BindImageTexture, + "osg::Object osg::StateAttribute osg::BindImageTexture" ) +{ + +ADD_OBJECT_SERIALIZER( Texture, osg::Texture, NULL); +ADD_UINT_SERIALIZER(ImageUnit,0); +ADD_GLINT_SERIALIZER(Level,0); +ADD_GLBOOL_SERIALIZER(IsLayered,GL_FALSE); +ADD_GLINT_SERIALIZER(Layer,0); +BEGIN_ENUM_SERIALIZER( Access, NOT_USED ); + ADD_ENUM_VALUE( NOT_USED ); + ADD_ENUM_VALUE( READ_ONLY ); + ADD_ENUM_VALUE( WRITE_ONLY ); + ADD_ENUM_VALUE( READ_WRITE ); +END_ENUM_SERIALIZER(); +ADD_GLENUM_SERIALIZER(Format,GLenum,GL_RGBA8); + +} +