From 7eb7bbdb84916eec374af9b249154ca1ca1eb988 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 2 Aug 2006 21:09:25 +0000 Subject: [PATCH] Updated wrappers --- examples/osgtext/osgtext.cpp | 10 ++++++++++ src/osgWrappers/osg/Matrixd.cpp | 2 ++ src/osgWrappers/osg/Matrixf.cpp | 2 ++ src/osgWrappers/osgTerrain/DataSet.cpp | 1 + src/osgWrappers/osgText/Font.cpp | 7 ------- src/osgWrappers/osgText/Text.cpp | 18 ++++++++++++++---- 6 files changed, 29 insertions(+), 11 deletions(-) diff --git a/examples/osgtext/osgtext.cpp b/examples/osgtext/osgtext.cpp index 89814e5da..daa864bd5 100644 --- a/examples/osgtext/osgtext.cpp +++ b/examples/osgtext/osgtext.cpp @@ -419,6 +419,16 @@ osg::Group* create3DText(const osg::Vec3& center,float radius) text4->setText("SCREEN"); geode->addDrawable(text4); + /////////////////////////////////////////////// + // Added to show osgText state set malfunction + osg::StateSet *textStateSet = new osg::StateSet(); + textStateSet->setMode(GL_BLEND, osg::StateAttribute::ON | osg::StateAttribute::PROTECTED); + textStateSet->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::ON | osg::StateAttribute::PROTECTED); + // This works: + //geode->setStateSet(textStateSet); + // This doesn't work: + text4->setStateSet(textStateSet); + osg::ShapeDrawable* shape = new osg::ShapeDrawable(new osg::Sphere(center,characterSize*0.2f)); shape->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::ON); geode->addDrawable(shape); diff --git a/src/osgWrappers/osg/Matrixd.cpp b/src/osgWrappers/osg/Matrixd.cpp index 5386e2f62..24a606a97 100644 --- a/src/osgWrappers/osg/Matrixd.cpp +++ b/src/osgWrappers/osg/Matrixd.cpp @@ -84,6 +84,8 @@ BEGIN_VALUE_REFLECTOR(osg::Matrixd) I_Method1(osg::Vec4d, preMult, IN, const osg::Vec4d &, v); I_Method1(osg::Vec4f, postMult, IN, const osg::Vec4f &, v); I_Method1(osg::Vec4d, postMult, IN, const osg::Vec4d &, v); + I_Method1(void, set, IN, const osg::Quat &, q); + I_Method1(void, get, IN, osg::Quat &, q); I_Method1(void, setRotate, IN, const osg::Quat &, q); I_Method0(osg::Quat, getRotate); I_Method3(void, setTrans, IN, osg::Matrixd::value_type, tx, IN, osg::Matrixd::value_type, ty, IN, osg::Matrixd::value_type, tz); diff --git a/src/osgWrappers/osg/Matrixf.cpp b/src/osgWrappers/osg/Matrixf.cpp index 1cce03508..d4f70c7d3 100644 --- a/src/osgWrappers/osg/Matrixf.cpp +++ b/src/osgWrappers/osg/Matrixf.cpp @@ -84,6 +84,8 @@ BEGIN_VALUE_REFLECTOR(osg::Matrixf) I_Method1(osg::Vec4d, preMult, IN, const osg::Vec4d &, v); I_Method1(osg::Vec4f, postMult, IN, const osg::Vec4f &, v); I_Method1(osg::Vec4d, postMult, IN, const osg::Vec4d &, v); + I_Method1(void, set, IN, const osg::Quat &, q); + I_Method1(void, get, IN, osg::Quat &, q); I_Method1(void, setRotate, IN, const osg::Quat &, q); I_Method0(osg::Quat, getRotate); I_Method3(void, setTrans, IN, osg::Matrixf::value_type, tx, IN, osg::Matrixf::value_type, ty, IN, osg::Matrixf::value_type, tz); diff --git a/src/osgWrappers/osgTerrain/DataSet.cpp b/src/osgWrappers/osgTerrain/DataSet.cpp index e8e2dde0a..5aaaf04b0 100644 --- a/src/osgWrappers/osgTerrain/DataSet.cpp +++ b/src/osgWrappers/osgTerrain/DataSet.cpp @@ -409,6 +409,7 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::DataSet::SourceData) I_Method1(void, readImage, IN, osgTerrain::DataSet::DestinationData &, destination); I_Method1(void, readHeightField, IN, osgTerrain::DataSet::DestinationData &, destination); I_Method1(void, readModels, IN, osgTerrain::DataSet::DestinationData &, destination); + I_Method3(float, getInterpolatedValue, IN, GDALRasterBand *, band, IN, double, x, IN, double, y); END_REFLECTOR BEGIN_VALUE_REFLECTOR(osgTerrain::DataSet::SpatialProperties) diff --git a/src/osgWrappers/osgText/Font.cpp b/src/osgWrappers/osgText/Font.cpp index 402196bfa..c2813cdaa 100644 --- a/src/osgWrappers/osgText/Font.cpp +++ b/src/osgWrappers/osgText/Font.cpp @@ -100,8 +100,6 @@ BEGIN_OBJECT_REFLECTOR(osgText::Font::Glyph) I_Method1(void, setTexture, IN, osgText::Font::GlyphTexture *, texture); I_Method0(osgText::Font::GlyphTexture *, getTexture); I_Method0(const osgText::Font::GlyphTexture *, getTexture); - I_Method0(osg::StateSet *, getStateSet); - I_Method0(const osg::StateSet *, getStateSet); I_Method2(void, setTexturePosition, IN, int, posX, IN, int, posY); I_Method0(int, getTexturePositionX); I_Method0(int, getTexturePositionY); @@ -116,7 +114,6 @@ BEGIN_OBJECT_REFLECTOR(osgText::Font::Glyph) I_Property(const osg::Vec2 &, HorizontalBearing); I_Property(const osg::Vec2 &, MaxTexCoord); I_Property(const osg::Vec2 &, MinTexCoord); - I_ReadOnlyProperty(osg::StateSet *, StateSet); I_Property(osgText::Font::GlyphTexture *, Texture); I_ReadOnlyProperty(int, TexturePositionX); I_ReadOnlyProperty(int, TexturePositionY); @@ -129,16 +126,12 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgText::Font::GlyphTexture) I_Constructor0(); I_Method0(const char *, className); I_Method1(int, compare, IN, const osg::StateAttribute &, rhs); - I_Method1(void, setStateSet, IN, osg::StateSet *, stateset); - I_Method0(osg::StateSet *, getStateSet); - I_Method0(const osg::StateSet *, getStateSet); I_Method1(void, setGlyphImageMargin, IN, unsigned int, margin); I_Method0(unsigned int, getGlyphImageMargin); I_Method3(bool, getSpaceForGlyph, IN, osgText::Font::Glyph *, glyph, IN, int &, posX, IN, int &, posY); I_Method3(void, addGlyph, IN, osgText::Font::Glyph *, glyph, IN, int, posX, IN, int, posY); I_Method1(void, apply, IN, osg::State &, state); I_Property(unsigned int, GlyphImageMargin); - I_Property(osg::StateSet *, StateSet); END_REFLECTOR BEGIN_ENUM_REFLECTOR(osgText::KerningType) diff --git a/src/osgWrappers/osgText/Text.cpp b/src/osgWrappers/osgText/Text.cpp index af1caf4d1..443c315d5 100644 --- a/src/osgWrappers/osgText/Text.cpp +++ b/src/osgWrappers/osgText/Text.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -31,7 +30,7 @@ #undef OUT #endif -TYPE_NAME_ALIAS(std::map< osg::ref_ptr< osg::StateSet > COMMA osgText::Text::GlyphQuads >, osgText::Text::TextureGlyphQuadMap); +TYPE_NAME_ALIAS(std::map< osg::ref_ptr< osgText::Font::GlyphTexture > COMMA osgText::Text::GlyphQuads >, osgText::Text::TextureGlyphQuadMap); BEGIN_ENUM_REFLECTOR(osgText::Text::CharacterSizeMode) I_EnumLabel(osgText::Text::OBJECT_COORDS); @@ -179,7 +178,7 @@ BEGIN_OBJECT_REFLECTOR(osgText::Text) I_Method1(bool, supports, IN, const osg::PrimitiveFunctor &, x); I_Method1(void, accept, IN, osg::PrimitiveFunctor &, pf); I_MethodWithDefaults1(void, releaseGLObjects, IN, osg::State *, state, 0); - I_Method1(const osgText::Text::GlyphQuads *, getGlyphQuads, IN, osg::StateSet *, stateSet); + I_Method1(const osgText::Text::GlyphQuads *, getGlyphQuads, IN, osgText::Font::GlyphTexture *, texture); I_Method0(const osgText::Text::TextureGlyphQuadMap &, getTextureGlyphQuadMap); I_Method0(osg::BoundingBox, computeBound); I_Property(osgText::Text::AlignmentType, Alignment); @@ -245,7 +244,18 @@ BEGIN_VALUE_REFLECTOR(osgText::Text::GlyphQuads) I_ReadOnlyProperty(osgText::Text::GlyphQuads::TexCoords &, TexCoords); END_REFLECTOR -STD_MAP_REFLECTOR(std::map< osg::ref_ptr< osg::StateSet > COMMA osgText::Text::GlyphQuads >); +BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgText::Font::GlyphTexture >) + I_Constructor0(); + I_Constructor1(IN, osgText::Font::GlyphTexture *, ptr); + I_Constructor1(IN, const osg::ref_ptr< osgText::Font::GlyphTexture > &, rp); + I_Method0(osgText::Font::GlyphTexture *, get); + I_Method0(bool, valid); + I_Method0(osgText::Font::GlyphTexture *, release); + I_Method1(void, swap, IN, osg::ref_ptr< osgText::Font::GlyphTexture > &, rp); + I_ReadOnlyProperty(osgText::Font::GlyphTexture *, ); +END_REFLECTOR + +STD_MAP_REFLECTOR(std::map< osg::ref_ptr< osgText::Font::GlyphTexture > COMMA osgText::Text::GlyphQuads >); STD_VECTOR_REFLECTOR(std::vector< osgText::Font::Glyph * >);