From 5383297cbe0fb150ea94de1b749fa7a32ba6910a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 5 Mar 2010 11:30:50 +0000 Subject: [PATCH] Change Shader::getPCS(..) from protected to public scope to enable isCompiled() method to be accessible in applications. Updated wrappers --- include/osg/Shader | 5 +- src/osgWrappers/introspection/osg/Shader.cpp | 54 +++++++++++++++++- .../introspection/osgDB/DatabasePager.cpp | 57 ------------------- 3 files changed, 56 insertions(+), 60 deletions(-) diff --git a/include/osg/Shader b/include/osg/Shader index 2fd9f8cad..603d48361 100644 --- a/include/osg/Shader +++ b/include/osg/Shader @@ -184,7 +184,7 @@ class OSG_EXPORT Shader : public osg::Object static Shader::Type getTypeId( const std::string& tname ); - protected: + public: /** PerContextShader (PCS) is an OSG-internal encapsulation of glShader per-GL context. */ class PerContextShader : public osg::Referenced { @@ -227,10 +227,11 @@ class OSG_EXPORT Shader : public osg::Object PerContextShader& operator=(const PerContextShader&); // disallowed }; + PerContextShader* getPCS(unsigned int contextID) const; + protected: /*methods*/ virtual ~Shader(); - PerContextShader* getPCS(unsigned int contextID) const; friend class osg::Program; bool addProgramRef( osg::Program* program ); diff --git a/src/osgWrappers/introspection/osg/Shader.cpp b/src/osgWrappers/introspection/osg/Shader.cpp index b7705e33d..77c28a3ba 100644 --- a/src/osgWrappers/introspection/osg/Shader.cpp +++ b/src/osgWrappers/introspection/osg/Shader.cpp @@ -171,6 +171,7 @@ BEGIN_OBJECT_REFLECTOR(osg::Shader) __bool__getGlShaderInfoLog__unsigned_int__std_string_R1, "Query InfoLog from a glShader. ", ""); + I_StaticMethod2(osg::Shader *, readShaderFile, IN, osg::Shader::Type, type, IN, const std::string &, fileName, __Shader_P1__readShaderFile__Type__C5_std_string_R1_S, "Read shader source from file and then constructor shader of specified type. ", @@ -191,7 +192,6 @@ BEGIN_OBJECT_REFLECTOR(osg::Shader) __Shader_Type__getTypeId__C5_std_string_R1_S, "", ""); - I_ProtectedMethod1(bool, addProgramRef, IN, osg::Program *, program, Properties::NON_VIRTUAL, Properties::NON_CONST, @@ -221,6 +221,58 @@ BEGIN_OBJECT_REFLECTOR(osg::Shader) 0); END_REFLECTOR +BEGIN_OBJECT_REFLECTOR(osg::Shader::PerContextShader) + I_DeclaringFile("osg/Shader"); + I_BaseType(osg::Referenced); + I_Constructor2(IN, const osg::Shader *, shader, IN, unsigned int, contextID, + ____PerContextShader__C5_Shader_P1__unsigned_int, + "", + ""); + I_Method0(GLuint, getHandle, + Properties::NON_VIRTUAL, + __GLuint__getHandle, + "", + ""); + I_Method0(void, requestCompile, + Properties::NON_VIRTUAL, + __void__requestCompile, + "", + ""); + I_Method1(void, compileShader, IN, osg::State &, state, + Properties::NON_VIRTUAL, + __void__compileShader__osg_State_R1, + "", + ""); + I_Method0(bool, needsCompile, + Properties::NON_VIRTUAL, + __bool__needsCompile, + "", + ""); + I_Method0(bool, isCompiled, + Properties::NON_VIRTUAL, + __bool__isCompiled, + "", + ""); + I_Method1(bool, getInfoLog, IN, std::string &, infoLog, + Properties::NON_VIRTUAL, + __bool__getInfoLog__std_string_R1, + "", + ""); + I_Method1(void, attachShader, IN, GLuint, program, + Properties::NON_VIRTUAL, + __void__attachShader__GLuint, + "Attach our glShader to a glProgram. ", + ""); + I_Method1(void, detachShader, IN, GLuint, program, + Properties::NON_VIRTUAL, + __void__detachShader__GLuint, + "Detach our glShader from a glProgram. ", + ""); + I_SimpleProperty(GLuint, Handle, + __GLuint__getHandle, + 0); +END_REFLECTOR + BEGIN_OBJECT_REFLECTOR(osg::ShaderBinary) I_DeclaringFile("osg/Shader"); I_BaseType(osg::Object); diff --git a/src/osgWrappers/introspection/osgDB/DatabasePager.cpp b/src/osgWrappers/introspection/osgDB/DatabasePager.cpp index 5e5362f78..2a9cd492f 100644 --- a/src/osgWrappers/introspection/osgDB/DatabasePager.cpp +++ b/src/osgWrappers/introspection/osgDB/DatabasePager.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -38,8 +37,6 @@ END_REFLECTOR TYPE_NAME_ALIAS(OpenThreads::Thread::ThreadPriority, osgDB::DatabasePager::ThreadPriority) -TYPE_NAME_ALIAS(std::list< osg::ref_ptr< osg::PagedLOD > >, osgDB::DatabasePager::PagedLODList) - TYPE_NAME_ALIAS(std::set< osg::ref_ptr< osg::StateSet > >, osgDB::DatabasePager::StateSetList) TYPE_NAME_ALIAS(std::vector< osg::ref_ptr< osg::Drawable > >, osgDB::DatabasePager::DrawableList) @@ -405,18 +402,6 @@ BEGIN_OBJECT_REFLECTOR(osgDB::DatabasePager) __void__removeExpiredSubgraphs__C5_osg_FrameStamp_R1, "Iterate through the active PagedLOD nodes children removing children which havn't been visited since specified expiryTime. ", "note, should be only be called from the update thread. "); - I_ProtectedMethod1(void, expiry_removeExpiredSubgraphs, IN, const osg::FrameStamp &, frameStamp, - Properties::VIRTUAL, - Properties::NON_CONST, - __void__expiry_removeExpiredSubgraphs__C5_osg_FrameStamp_R1, - "Old expiry delay based removeExpiredSubgraphs. ", - ""); - I_ProtectedMethod1(void, capped_removeExpiredSubgraphs, IN, const osg::FrameStamp &, frameStamp, - Properties::VIRTUAL, - Properties::NON_CONST, - __void__capped_removeExpiredSubgraphs__C5_osg_FrameStamp_R1, - "New capped based removeExpiredSubgraphs. ", - ""); I_ProtectedMethod1(void, addLoadedDataToSceneGraph, IN, const osg::FrameStamp &, frameStamp, Properties::NON_VIRTUAL, Properties::NON_CONST, @@ -598,46 +583,6 @@ BEGIN_OBJECT_REFLECTOR(osg::observer_ptr< osg::GraphicsContext >) 0); END_REFLECTOR -BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osg::PagedLOD >) - I_DeclaringFile("osg/ref_ptr"); - I_Constructor0(____ref_ptr, - "", - ""); - I_Constructor1(IN, osg::PagedLOD *, ptr, - Properties::NON_EXPLICIT, - ____ref_ptr__T_P1, - "", - ""); - I_Constructor1(IN, const osg::ref_ptr< osg::PagedLOD > &, rp, - Properties::NON_EXPLICIT, - ____ref_ptr__C5_ref_ptr_R1, - "", - ""); - I_Method0(osg::PagedLOD *, get, - Properties::NON_VIRTUAL, - __T_P1__get, - "", - ""); - I_Method0(bool, valid, - Properties::NON_VIRTUAL, - __bool__valid, - "", - ""); - I_Method0(osg::PagedLOD *, release, - Properties::NON_VIRTUAL, - __T_P1__release, - "", - ""); - I_Method1(void, swap, IN, osg::ref_ptr< osg::PagedLOD > &, rp, - Properties::NON_VIRTUAL, - __void__swap__ref_ptr_R1, - "", - ""); - I_SimpleProperty(osg::PagedLOD *, , - __T_P1__get, - 0); -END_REFLECTOR - BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgDB::DatabasePager >) I_DeclaringFile("osg/ref_ptr"); I_Constructor0(____ref_ptr, @@ -678,8 +623,6 @@ BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgDB::DatabasePager >) 0); END_REFLECTOR -STD_LIST_REFLECTOR(std::list< osg::ref_ptr< osg::PagedLOD > >) - STD_MAP_REFLECTOR(std::map< unsigned int COMMA osgDB::DatabasePager::DataToCompile >) STD_PAIR_REFLECTOR(std::pair< osgDB::DatabasePager::StateSetList COMMA osgDB::DatabasePager::DrawableList >)