From 6017b810eb7315a5721d41be11bbf536cd2e3216 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 17 Apr 2005 11:30:33 +0000 Subject: [PATCH] From Marco Jez, osgWrappers updates to latest changes in core osg. --- src/osgWrappers/osg/ColorMask.cpp | 2 +- src/osgWrappers/osg/Plane.cpp | 4 +++ src/osgWrappers/osg/Program.cpp | 22 +++++++++++++++ src/osgWrappers/osg/Quat.cpp | 4 +++ src/osgWrappers/osg/Shader.cpp | 5 +++- src/osgWrappers/osg/State.cpp | 36 ++++-------------------- src/osgWrappers/osg/StateAttribute.cpp | 3 +- src/osgWrappers/osg/StateSet.cpp | 17 +++++++---- src/osgWrappers/osg/TextureRectangle.cpp | 2 ++ src/osgWrappers/osg/Uniform.cpp | 9 ++++-- src/osgWrappers/osg/Vec2d.cpp | 4 +-- src/osgWrappers/osg/Vec2f.cpp | 4 +-- src/osgWrappers/osg/Vec3d.cpp | 4 +-- src/osgWrappers/osg/Vec3f.cpp | 4 +-- src/osgWrappers/osg/Vec4d.cpp | 4 +-- src/osgWrappers/osg/Vec4f.cpp | 4 +-- 16 files changed, 75 insertions(+), 53 deletions(-) diff --git a/src/osgWrappers/osg/ColorMask.cpp b/src/osgWrappers/osg/ColorMask.cpp index 6eb226924..8f84e8703 100644 --- a/src/osgWrappers/osg/ColorMask.cpp +++ b/src/osgWrappers/osg/ColorMask.cpp @@ -40,7 +40,7 @@ BEGIN_OBJECT_REFLECTOR(osg::ColorMask) Property(bool, AlphaMask); Property(bool, BlueMask); Property(bool, GreenMask); - ReadOnlyProperty(bool, RedMask); + Property(bool, RedMask); ReadOnlyProperty(osg::StateAttribute::Type, Type); END_REFLECTOR diff --git a/src/osgWrappers/osg/Plane.cpp b/src/osgWrappers/osg/Plane.cpp index e570b1563..8e2bae6df 100644 --- a/src/osgWrappers/osg/Plane.cpp +++ b/src/osgWrappers/osg/Plane.cpp @@ -16,7 +16,11 @@ #include #include +#include + BEGIN_VALUE_REFLECTOR(osg::Plane) + ReaderWriter(osgIntrospection::StdReaderWriter); // user-defined + Comparator(osgIntrospection::PartialOrderComparator); // user-defined Constructor0(); Constructor1(IN, const osg::Plane &, pl); Constructor4(IN, float, a, IN, float, b, IN, float, c, IN, float, d); diff --git a/src/osgWrappers/osg/Program.cpp b/src/osgWrappers/osg/Program.cpp index 3a3a63995..91222c5d3 100644 --- a/src/osgWrappers/osg/Program.cpp +++ b/src/osgWrappers/osg/Program.cpp @@ -15,6 +15,7 @@ #include #include #include +#include BEGIN_OBJECT_REFLECTOR(osg::GL2Extensions) BaseType(osg::Referenced); @@ -157,6 +158,9 @@ BEGIN_OBJECT_REFLECTOR(osg::Program) MethodWithDefaults1(void, releaseGLObjects, IN, osg::State *, state, 0); Method0(void, dirtyProgram); Method1(bool, addShader, IN, osg::Shader *, shader); + Method0(unsigned int, getNumShaders); + Method1(osg::Shader *, getShader, IN, unsigned int, i); + Method1(const osg::Shader *, getShader, IN, unsigned int, i); Method1(bool, removeShader, IN, osg::Shader *, shader); Method2(void, bindAttribLocation, IN, GLuint, index, IN, const char *, name); Method0(const osg::Program::AttribBindingList &, getAttribBindingList); @@ -165,10 +169,28 @@ BEGIN_OBJECT_REFLECTOR(osg::Program) Method1(void, setName, IN, const std::string &, name); Method1(void, setName, IN, const char *, name); Method0(const std::string &, getName); + Method1(osg::Program::PerContextProgram *, getPCP, IN, unsigned int, contextID); ReadOnlyProperty(const osg::Program::AttribBindingList &, AttribBindingList); Property(const std::string &, Name); + ArrayProperty_GA(osg::Shader *, Shader, Shaders, unsigned int, bool); ReadOnlyProperty(osg::StateAttribute::Type, Type); END_REFLECTOR +BEGIN_OBJECT_REFLECTOR(osg::Program::PerContextProgram) + BaseType(osg::Referenced); + Constructor2(IN, const osg::Program *, program, IN, unsigned int, contextID); + Method0(GLuint, getHandle); + Method0(void, requestLink); + Method0(void, linkProgram); + Method0(bool, needsLink); + Method0(bool, isLinked); + Method1(void, getInfoLog, IN, std::string &, infoLog); + Method0(void, useProgram); + Method1(void, apply, IN, const osg::Uniform &, uniform); + Method1(GLint, getUniformLocation, IN, const std::string &, name); + Method1(GLint, getAttribLocation, IN, const std::string &, name); + ReadOnlyProperty(GLuint, Handle); +END_REFLECTOR + STD_MAP_REFLECTOR(std::map< std::string COMMA GLuint >); diff --git a/src/osgWrappers/osg/Quat.cpp b/src/osgWrappers/osg/Quat.cpp index 22b762537..52a2df7ed 100644 --- a/src/osgWrappers/osg/Quat.cpp +++ b/src/osgWrappers/osg/Quat.cpp @@ -17,9 +17,13 @@ #include #include +#include + TYPE_NAME_ALIAS(double, osg::Quat::value_type); BEGIN_VALUE_REFLECTOR(osg::Quat) + ReaderWriter(osgIntrospection::StdReaderWriter); // user-defined + Comparator(osgIntrospection::PartialOrderComparator); // user-defined Constructor0(); Constructor4(IN, osg::Quat::value_type, x, IN, osg::Quat::value_type, y, IN, osg::Quat::value_type, z, IN, osg::Quat::value_type, w); Constructor1(IN, const osg::Vec4f &, v); diff --git a/src/osgWrappers/osg/Shader.cpp b/src/osgWrappers/osg/Shader.cpp index 06e269815..3b0ce52c5 100644 --- a/src/osgWrappers/osg/Shader.cpp +++ b/src/osgWrappers/osg/Shader.cpp @@ -16,10 +16,12 @@ BEGIN_ENUM_REFLECTOR(osg::Shader::Type) EnumLabel(osg::Shader::VERTEX); EnumLabel(osg::Shader::FRAGMENT); + EnumLabel(osg::Shader::UNDEFINED); END_REFLECTOR BEGIN_OBJECT_REFLECTOR(osg::Shader) BaseType(osg::Object); + Constructor0(); ConstructorWithDefaults2(IN, osg::Shader::Type, type, , IN, const char *, sourceText, 0); ConstructorWithDefaults2(IN, const osg::Shader &, rhs, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY); Method0(osg::Object *, cloneType); @@ -28,6 +30,7 @@ BEGIN_OBJECT_REFLECTOR(osg::Shader) Method0(const char *, libraryName); Method0(const char *, className); Method1(int, compare, IN, const osg::Shader &, rhs); + Method1(bool, setType, IN, osg::Shader::Type, t); Method1(void, setShaderSource, IN, const char *, sourceText); Method1(bool, loadShaderSourceFromFile, IN, const char *, fileName); Method0(const std::string &, getShaderSource); @@ -42,7 +45,7 @@ BEGIN_OBJECT_REFLECTOR(osg::Shader) Method0(const std::string &, getName); Property(const std::string &, Name); ReadOnlyProperty(const std::string &, ShaderSource); - ReadOnlyProperty(osg::Shader::Type, Type); + PropertyWithReturnType(osg::Shader::Type, Type, bool); ReadOnlyProperty(const char *, Typename); END_REFLECTOR diff --git a/src/osgWrappers/osg/State.cpp b/src/osgWrappers/osg/State.cpp index d1e3280aa..1aab7c9b5 100644 --- a/src/osgWrappers/osg/State.cpp +++ b/src/osgWrappers/osg/State.cpp @@ -13,20 +13,12 @@ #include #include #include +#include #include #include #include -#include #include -TYPE_NAME_ALIAS(std::pair< const osg::StateAttribute * COMMA osg::StateAttribute::OverrideValue >, osg::State::AttributePair); - -TYPE_NAME_ALIAS(std::vector< osg::State::AttributePair >, osg::State::AttributeVec); - -TYPE_NAME_ALIAS(std::vector< osg::StateAttribute::GLModeValue >, osg::State::ValueVec); - -TYPE_NAME_ALIAS(std::map< std::string COMMA osg::ref_ptr< osg::Uniform > >, osg::State::UniformMap); - BEGIN_OBJECT_REFLECTOR(osg::State) BaseType(osg::Referenced); Constructor0(); @@ -109,6 +101,10 @@ BEGIN_OBJECT_REFLECTOR(osg::State) Method1(void, disableVertexAttribPointersAboveAndIncluding, IN, unsigned int, index); Method1(void, dirtyVertexAttribPointersAboveAndIncluding, IN, unsigned int, index); Method0(bool, isVertexBufferObjectSupported); + Method1(void, setLastAppliedProgramObject, IN, const osg::Program::PerContextProgram *, program); + Method0(const osg::Program::PerContextProgram *, getLastAppliedProgramObject); + Method1(GLint, getUniformLocation, IN, const std::string &, name); + Method1(GLint, getAttribLocation, IN, const std::string &, name); Method1(void, setContextID, IN, unsigned int, contextID); Method0(unsigned int, getContextID); Method1(void, setFrameStamp, IN, osg::FrameStamp *, fs); @@ -122,7 +118,6 @@ BEGIN_OBJECT_REFLECTOR(osg::State) Method1(bool, checkGLErrors, IN, const char *, str); Method1(bool, checkGLErrors, IN, osg::StateAttribute::GLMode, mode); Method1(bool, checkGLErrors, IN, const osg::StateAttribute *, attribute); - Method1(const osg::Uniform *, findUniform, IN, const std::string &, name); ReadOnlyProperty(bool, AbortRendering); WriteOnlyProperty(bool *, AbortRenderingPtr); PropertyWithReturnType(unsigned int, ActiveTextureUnit, bool); @@ -136,29 +131,10 @@ BEGIN_OBJECT_REFLECTOR(osg::State) IndexedProperty2(bool, GlobalDefaultTextureModeValue, unsigned int, unit, osg::StateAttribute::GLMode, mode); ReadOnlyProperty(const osg::Matrix &, InitialInverseViewMatrix); WriteOnlyProperty(const osg::RefMatrix *, InitialViewMatrix); + Property(const osg::Program::PerContextProgram *, LastAppliedProgramObject); ReadOnlyProperty(const osg::Matrix &, ModelViewMatrix); ReadOnlyProperty(const osg::Matrix &, ProjectionMatrix); Property(bool, ReportGLErrors); ReadOnlyProperty(osg::Polytope, ViewFrustum); END_REFLECTOR -BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osg::Uniform >) - Constructor0(); - Constructor1(IN, osg::Uniform *, t); - Constructor1(IN, const osg::ref_ptr< osg::Uniform > &, rp); - Method0(bool, valid); - Method0(osg::Uniform *, get); - Method0(const osg::Uniform *, get); - Method0(osg::Uniform *, take); - Method0(osg::Uniform *, release); - ReadOnlyProperty(osg::Uniform *, ); -END_REFLECTOR - -STD_MAP_REFLECTOR(std::map< std::string COMMA osg::ref_ptr< osg::Uniform > >); - -STD_PAIR_REFLECTOR(std::pair< const osg::StateAttribute * COMMA osg::StateAttribute::OverrideValue >); - -STD_VECTOR_REFLECTOR(std::vector< osg::State::AttributePair >); - -STD_VECTOR_REFLECTOR(std::vector< osg::StateAttribute::GLModeValue >); - diff --git a/src/osgWrappers/osg/StateAttribute.cpp b/src/osgWrappers/osg/StateAttribute.cpp index b7c7de8d9..3137b40da 100644 --- a/src/osgWrappers/osg/StateAttribute.cpp +++ b/src/osgWrappers/osg/StateAttribute.cpp @@ -66,7 +66,7 @@ BEGIN_ENUM_REFLECTOR(osg::StateAttribute::Type) EnumLabel(osg::StateAttribute::VERTEXPROGRAM); EnumLabel(osg::StateAttribute::FRAGMENTPROGRAM); EnumLabel(osg::StateAttribute::POINTSPRITE); - EnumLabel(osg::StateAttribute::PROGRAMOBJECT); + EnumLabel(osg::StateAttribute::PROGRAM); EnumLabel(osg::StateAttribute::VALIDATOR); EnumLabel(osg::StateAttribute::VIEWMATRIXEXTRACTOR); EnumLabel(osg::StateAttribute::OSGNV_PARAMETER_BLOCK); @@ -76,7 +76,6 @@ BEGIN_ENUM_REFLECTOR(osg::StateAttribute::Type) EnumLabel(osg::StateAttribute::OSGNVCG_PROGRAM); EnumLabel(osg::StateAttribute::OSGNVSLANG_PROGRAM); EnumLabel(osg::StateAttribute::OSGNVPARSE_PROGRAM_PARSER); - EnumLabel(osg::StateAttribute::PROGRAM); END_REFLECTOR BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::StateAttribute) diff --git a/src/osgWrappers/osg/StateSet.cpp b/src/osgWrappers/osg/StateSet.cpp index 67bd182de..5b78343f5 100644 --- a/src/osgWrappers/osg/StateSet.cpp +++ b/src/osgWrappers/osg/StateSet.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include #include @@ -100,9 +99,6 @@ BEGIN_OBJECT_REFLECTOR(osg::StateSet) Method1(void, setUniformList, IN, osg::StateSet::UniformList &, al); Method0(osg::StateSet::UniformList &, getUniformList); Method0(const osg::StateSet::UniformList &, getUniformList); - Method1(void, setProgram, IN, osg::Program *, program); - Method0(osg::Program *, getProgram); - Method0(const osg::Program *, getProgram); Method1(void, setRenderingHint, IN, int, hint); Method0(int, getRenderingHint); MethodWithDefaults3(void, setRenderBinDetails, IN, int, binNum, , IN, const std::string &, binName, , IN, osg::StateSet::RenderBinMode, mode, osg::StateSet::USE_RENDERBIN_DETAILS); @@ -121,7 +117,6 @@ BEGIN_OBJECT_REFLECTOR(osg::StateSet) Property(int, BinNumber); Property(osg::StateSet::ModeList &, ModeList); - Property(osg::Program *, Program); Property(osg::StateSet::RenderBinMode, RenderBinMode); Property(int, RenderingHint); Property(osg::StateSet::TextureAttributeList &, TextureAttributeList); @@ -142,6 +137,18 @@ BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osg::StateAttribute >) ReadOnlyProperty(osg::StateAttribute *, ); END_REFLECTOR +BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osg::Uniform >) + Constructor0(); + Constructor1(IN, osg::Uniform *, t); + Constructor1(IN, const osg::ref_ptr< osg::Uniform > &, rp); + Method0(bool, valid); + Method0(osg::Uniform *, get); + Method0(const osg::Uniform *, get); + Method0(osg::Uniform *, take); + Method0(osg::Uniform *, release); + ReadOnlyProperty(osg::Uniform *, ); +END_REFLECTOR + STD_MAP_REFLECTOR_WITH_TYPES(std::map< osg::StateAttribute::GLMode COMMA osg::StateAttribute::GLModeValue >, osg::StateAttribute::GLMode, osg::StateAttribute::Values); STD_MAP_REFLECTOR(std::map< osg::StateAttribute::TypeMemberPair COMMA osg::StateSet::RefAttributePair >); diff --git a/src/osgWrappers/osg/TextureRectangle.cpp b/src/osgWrappers/osg/TextureRectangle.cpp index ea47464fe..ab419cd06 100644 --- a/src/osgWrappers/osg/TextureRectangle.cpp +++ b/src/osgWrappers/osg/TextureRectangle.cpp @@ -42,6 +42,8 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::TextureRectangle) Method1(void, setSubloadCallback, IN, osg::TextureRectangle::SubloadCallback *, cb); Method0(osg::TextureRectangle::SubloadCallback *, getSubloadCallback); Method0(const osg::TextureRectangle::SubloadCallback *, getSubloadCallback); + Method5(void, copyTexImage2D, IN, osg::State &, state, IN, int, x, IN, int, y, IN, int, width, IN, int, height); + Method7(void, copyTexSubImage2D, IN, osg::State &, state, IN, int, xoffset, IN, int, yoffset, IN, int, x, IN, int, y, IN, int, width, IN, int, height); Method1(void, apply, IN, osg::State &, state); Property(osg::Image *, Image); Property(osg::TextureRectangle::SubloadCallback *, SubloadCallback); diff --git a/src/osgWrappers/osg/Uniform.cpp b/src/osgWrappers/osg/Uniform.cpp index de7737089..08697a0a7 100644 --- a/src/osgWrappers/osg/Uniform.cpp +++ b/src/osgWrappers/osg/Uniform.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -44,6 +45,7 @@ END_REFLECTOR BEGIN_OBJECT_REFLECTOR(osg::Uniform) BaseType(osg::Object); + Constructor0(); Constructor2(IN, const char *, name, IN, osg::Uniform::Type, type); ConstructorWithDefaults2(IN, const osg::Uniform &, rhs, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY); Method0(osg::Object *, cloneType); @@ -51,6 +53,8 @@ BEGIN_OBJECT_REFLECTOR(osg::Uniform) Method1(bool, isSameKindAs, IN, const osg::Object *, obj); Method0(const char *, libraryName); Method0(const char *, className); + Method1(bool, setType, IN, osg::Uniform::Type, t); + Method1(bool, setName, IN, const std::string &, name); Method0(const std::string &, getName); Method0(const osg::Uniform::Type, getType); Constructor2(IN, const char *, name, IN, float, f); @@ -95,8 +99,9 @@ BEGIN_OBJECT_REFLECTOR(osg::Uniform) Method2(bool, get, IN, bool &, b0, IN, bool &, b1); Method3(bool, get, IN, bool &, b0, IN, bool &, b1, IN, bool &, b2); Method4(bool, get, IN, bool &, b0, IN, bool &, b1, IN, bool &, b2, IN, bool &, b3); + Method2(void, apply, IN, const osg::GL2Extensions *, ext, IN, GLint, location); WriteOnlyPropertyWithReturnType(bool, , bool); - ReadOnlyProperty(const std::string &, Name); - ReadOnlyProperty(const osg::Uniform::Type, Type); + PropertyWithReturnType(const std::string &, Name, bool); + WriteOnlyPropertyWithReturnType(osg::Uniform::Type, Type, bool); END_REFLECTOR diff --git a/src/osgWrappers/osg/Vec2d.cpp b/src/osgWrappers/osg/Vec2d.cpp index d60135bdd..66fc783ef 100644 --- a/src/osgWrappers/osg/Vec2d.cpp +++ b/src/osgWrappers/osg/Vec2d.cpp @@ -9,11 +9,11 @@ #include #include -#include - #include #include +#include + TYPE_NAME_ALIAS(double, osg::Vec2d::value_type); BEGIN_VALUE_REFLECTOR(osg::Vec2d) diff --git a/src/osgWrappers/osg/Vec2f.cpp b/src/osgWrappers/osg/Vec2f.cpp index 2330b3e70..333e4cb2a 100644 --- a/src/osgWrappers/osg/Vec2f.cpp +++ b/src/osgWrappers/osg/Vec2f.cpp @@ -9,10 +9,10 @@ #include #include -#include - #include +#include + TYPE_NAME_ALIAS(float, osg::Vec2f::value_type); BEGIN_VALUE_REFLECTOR(osg::Vec2f) diff --git a/src/osgWrappers/osg/Vec3d.cpp b/src/osgWrappers/osg/Vec3d.cpp index 838a2b0c2..14476d83b 100644 --- a/src/osgWrappers/osg/Vec3d.cpp +++ b/src/osgWrappers/osg/Vec3d.cpp @@ -9,12 +9,12 @@ #include #include -#include - #include #include #include +#include + TYPE_NAME_ALIAS(double, osg::Vec3d::value_type); BEGIN_VALUE_REFLECTOR(osg::Vec3d) diff --git a/src/osgWrappers/osg/Vec3f.cpp b/src/osgWrappers/osg/Vec3f.cpp index 994376685..4d3805ec0 100644 --- a/src/osgWrappers/osg/Vec3f.cpp +++ b/src/osgWrappers/osg/Vec3f.cpp @@ -9,11 +9,11 @@ #include #include -#include - #include #include +#include + TYPE_NAME_ALIAS(float, osg::Vec3f::value_type); BEGIN_VALUE_REFLECTOR(osg::Vec3f) diff --git a/src/osgWrappers/osg/Vec4d.cpp b/src/osgWrappers/osg/Vec4d.cpp index 295257d18..112ef50ee 100644 --- a/src/osgWrappers/osg/Vec4d.cpp +++ b/src/osgWrappers/osg/Vec4d.cpp @@ -9,12 +9,12 @@ #include #include -#include - #include #include #include +#include + TYPE_NAME_ALIAS(double, osg::Vec4d::value_type); BEGIN_VALUE_REFLECTOR(osg::Vec4d) diff --git a/src/osgWrappers/osg/Vec4f.cpp b/src/osgWrappers/osg/Vec4f.cpp index fc47f32c4..b93ae3222 100644 --- a/src/osgWrappers/osg/Vec4f.cpp +++ b/src/osgWrappers/osg/Vec4f.cpp @@ -9,11 +9,11 @@ #include #include -#include - #include #include +#include + TYPE_NAME_ALIAS(float, osg::Vec4f::value_type); BEGIN_VALUE_REFLECTOR(osg::Vec4f)