From 86f312cae93d6a09164b592ef1d5d1e72d6d79e7 Mon Sep 17 00:00:00 2001 From: Paul MARTZ Date: Fri, 27 May 2011 14:32:36 +0000 Subject: [PATCH] 2.8 branch: From Ryan Pavlik, updates to osgWrappers for changes to osgText and libosg's Texture2DMultisample support. --- src/osgWrappers/genwrapper.conf | 9 +- src/osgWrappers/osg/FrameBufferObject.cpp | 5 + src/osgWrappers/osg/Texture2DMultisample.cpp | 179 ++++++++++++++++ src/osgWrappers/osgText/Text.cpp | 202 +++++++++++-------- 4 files changed, 303 insertions(+), 92 deletions(-) create mode 100644 src/osgWrappers/osg/Texture2DMultisample.cpp diff --git a/src/osgWrappers/genwrapper.conf b/src/osgWrappers/genwrapper.conf index 562e06332..3e3c8a9f6 100644 --- a/src/osgWrappers/genwrapper.conf +++ b/src/osgWrappers/genwrapper.conf @@ -237,11 +237,12 @@ end ############################################################################# -# Doxygen fails to detect that /osg::Texture(1D|2D|3D|Rectangle)/ and -# osgText::Font::GlyphTexture are not-abstract class, so we need -# to specify that manually +# Doxygen fails to detect that +# /osg::Texture(1D|2D|2DMultisample|3D|Rectangle)/ and +# osgText::Font::GlyphTexture are not-abstract class, so we need to +# specify that manually -configure reflector /osg::Texture(1D|2D|3D|Rectangle)/ +configure reflector /osg::Texture(1D|2D|2DMultisample|3D|Rectangle)/ object-type end diff --git a/src/osgWrappers/osg/FrameBufferObject.cpp b/src/osgWrappers/osg/FrameBufferObject.cpp index 0e2f3103b..44f2d9359 100644 --- a/src/osgWrappers/osg/FrameBufferObject.cpp +++ b/src/osgWrappers/osg/FrameBufferObject.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -89,6 +90,10 @@ BEGIN_VALUE_REFLECTOR(osg::FrameBufferAttachment) ____FrameBufferAttachment__Texture2D_P1__int, "", ""); + I_ConstructorWithDefaults2(IN, osg::Texture2DMultisample *, target, , IN, int, level, 0, + ____FrameBufferAttachment__Texture2DMultisample_P1__int, + "", + ""); I_ConstructorWithDefaults3(IN, osg::Texture3D *, target, , IN, int, zoffset, , IN, int, level, 0, ____FrameBufferAttachment__Texture3D_P1__int__int, "", diff --git a/src/osgWrappers/osg/Texture2DMultisample.cpp b/src/osgWrappers/osg/Texture2DMultisample.cpp new file mode 100644 index 000000000..0568cccd4 --- /dev/null +++ b/src/osgWrappers/osg/Texture2DMultisample.cpp @@ -0,0 +1,179 @@ +// *************************************************************************** +// +// Generated automatically by genwrapper. +// Please DO NOT EDIT this file! +// +// *************************************************************************** + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +// Must undefine IN and OUT macros defined in Windows headers +#ifdef IN +#undef IN +#endif +#ifdef OUT +#undef OUT +#endif + +BEGIN_OBJECT_REFLECTOR(osg::Texture2DMultisample) + I_DeclaringFile("osg/Texture2DMultisample"); + I_BaseType(osg::Texture); + I_Constructor0(____Texture2DMultisample, + "", + ""); + I_Constructor2(IN, GLsizei, numSamples, IN, GLboolean, fixedsamplelocations, + ____Texture2DMultisample__GLsizei__GLboolean, + "", + ""); + I_ConstructorWithDefaults2(IN, const osg::Texture2DMultisample &, text, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY, + ____Texture2DMultisample__C5_Texture2DMultisample_R1__C5_CopyOp_R1, + "Copy constructor using CopyOp to manage deep vs shallow copy. ", + ""); + I_Method0(osg::Object *, cloneType, + Properties::VIRTUAL, + __osg_Object_P1__cloneType, + "Clone the type of an attribute, with Object* return type. ", + "Must be defined by derived classes. "); + I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, x, + Properties::VIRTUAL, + __osg_Object_P1__clone__C5_osg_CopyOp_R1, + "Clone an attribute, with Object* return type. ", + "Must be defined by derived classes. "); + I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj, + Properties::VIRTUAL, + __bool__isSameKindAs__C5_osg_Object_P1, + "Return true if this and obj are of the same kind of object. ", + ""); + I_Method0(const char *, libraryName, + Properties::VIRTUAL, + __C5_char_P1__libraryName, + "Return the name of the attribute's library. ", + ""); + I_Method0(const char *, className, + Properties::VIRTUAL, + __C5_char_P1__className, + "Return the name of the attribute's class type. ", + ""); + I_Method0(osg::StateAttribute::Type, getType, + Properties::VIRTUAL, + __Type__getType, + "Return the Type identifier of the attribute's class type. ", + ""); + I_Method1(int, compare, IN, const osg::StateAttribute &, rhs, + Properties::VIRTUAL, + __int__compare__C5_StateAttribute_R1, + "Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. ", + ""); + I_Method0(GLenum, getTextureTarget, + Properties::VIRTUAL, + __GLenum__getTextureTarget, + "", + ""); + I_Method2(void, setTextureSize, IN, int, width, IN, int, height, + Properties::NON_VIRTUAL, + __void__setTextureSize__int__int, + "Sets the texture width and height. ", + "If width or height are zero, calculate the respective value from the source image size. "); + I_Method1(void, setNumSamples, IN, int, samples, + Properties::NON_VIRTUAL, + __void__setNumSamples__int, + "", + ""); + I_Method2(void, setImage, IN, unsigned, face, IN, osg::Image *, image, + Properties::VIRTUAL, + __void__setImage__unsigned__Image_P1, + "Sets the texture image for the specified face. ", + ""); + I_Method1(osg::Image *, getImage, IN, unsigned, face, + Properties::VIRTUAL, + __Image_P1__getImage__unsigned, + "Gets the texture image for the specified face. ", + ""); + I_Method1(const osg::Image *, getImage, IN, unsigned, face, + Properties::VIRTUAL, + __C5_Image_P1__getImage__unsigned, + "Gets the const texture image for specified face. ", + ""); + I_Method0(unsigned int, getNumImages, + Properties::VIRTUAL, + __unsigned_int__getNumImages, + "Gets the number of images that can be assigned to this Texture. ", + ""); + I_Method1(void, allocateMipmap, IN, osg::State &, state, + Properties::VIRTUAL, + __void__allocateMipmap__State_R1, + "Allocate mipmap levels of the texture by subsequent calling of glTexImage* function. ", + ""); + I_Method1(void, setTextureWidth, IN, int, width, + Properties::NON_VIRTUAL, + __void__setTextureWidth__int, + "", + ""); + I_Method1(void, setTextureHeight, IN, int, height, + Properties::NON_VIRTUAL, + __void__setTextureHeight__int, + "", + ""); + I_Method0(int, getTextureWidth, + Properties::VIRTUAL, + __int__getTextureWidth, + "", + ""); + I_Method0(int, getTextureHeight, + Properties::VIRTUAL, + __int__getTextureHeight, + "", + ""); + I_Method0(int, getTextureDepth, + Properties::VIRTUAL, + __int__getTextureDepth, + "", + ""); + I_Method1(void, apply, IN, osg::State &, state, + Properties::VIRTUAL, + __void__apply__State_R1, + "Bind the texture object. ", + "If the texture object hasn't already been compiled, create the texture mipmap levels. "); + I_ProtectedMethod0(void, computeInternalFormat, + Properties::VIRTUAL, + Properties::CONST, + __void__computeInternalFormat, + "", + ""); + I_ArrayProperty(osg::Image *, Image, + __Image_P1__getImage__unsigned, + __void__setImage__unsigned__Image_P1, + __unsigned_int__getNumImages, + 0, + 0, + 0); + I_SimpleProperty(int, NumSamples, + 0, + __void__setNumSamples__int); + I_SimpleProperty(int, TextureDepth, + __int__getTextureDepth, + 0); + I_SimpleProperty(int, TextureHeight, + __int__getTextureHeight, + __void__setTextureHeight__int); + I_SimpleProperty(GLenum, TextureTarget, + __GLenum__getTextureTarget, + 0); + I_SimpleProperty(int, TextureWidth, + __int__getTextureWidth, + __void__setTextureWidth__int); + I_SimpleProperty(osg::StateAttribute::Type, Type, + __Type__getType, + 0); +END_REFLECTOR + diff --git a/src/osgWrappers/osgText/Text.cpp b/src/osgWrappers/osgText/Text.cpp index e446843a7..f60a6dd65 100644 --- a/src/osgWrappers/osgText/Text.cpp +++ b/src/osgWrappers/osgText/Text.cpp @@ -28,7 +28,92 @@ #undef OUT #endif -TYPE_NAME_ALIAS(std::map< osg::ref_ptr< osgText::Font::GlyphTexture > COMMA osgText::Text::GlyphQuads >, osgText::Text::TextureGlyphQuadMap) +TYPE_NAME_ALIAS(std::vector< osgText::Font::Glyph * >, osgText::Text::GlyphQuads::Glyphs) + +TYPE_NAME_ALIAS(std::vector< unsigned int >, osgText::Text::GlyphQuads::LineNumbers) + +TYPE_NAME_ALIAS(std::vector< osg::Vec2 >, osgText::Text::GlyphQuads::Coords2) + +TYPE_NAME_ALIAS(std::vector< osg::Vec3 >, osgText::Text::GlyphQuads::Coords3) + +TYPE_NAME_ALIAS(std::vector< osg::Vec2 >, osgText::Text::GlyphQuads::TexCoords) + +TYPE_NAME_ALIAS(std::vector< osg::Vec4 >, osgText::Text::GlyphQuads::ColorCoords) + +BEGIN_VALUE_REFLECTOR(osgText::Text::GlyphQuads) + I_DeclaringFile("osgText/Text"); + I_Constructor0(____GlyphQuads, + "", + ""); + I_Method0(osgText::Text::GlyphQuads::Glyphs, getGlyphs, + Properties::NON_VIRTUAL, + __Glyphs__getGlyphs, + "", + ""); + I_Method0(const osgText::Text::GlyphQuads::Glyphs, getGlyphs, + Properties::NON_VIRTUAL, + __C5_Glyphs__getGlyphs, + "", + ""); + I_Method0(osgText::Text::GlyphQuads::Coords2 &, getCoords, + Properties::NON_VIRTUAL, + __Coords2_R1__getCoords, + "", + ""); + I_Method0(const osgText::Text::GlyphQuads::Coords2 &, getCoords, + Properties::NON_VIRTUAL, + __C5_Coords2_R1__getCoords, + "", + ""); + I_Method1(osgText::Text::GlyphQuads::Coords3 &, getTransformedCoords, IN, unsigned int, contexID, + Properties::NON_VIRTUAL, + __Coords3_R1__getTransformedCoords__unsigned_int, + "", + ""); + I_Method1(const osgText::Text::GlyphQuads::Coords3 &, getTransformedCoords, IN, unsigned int, contexID, + Properties::NON_VIRTUAL, + __C5_Coords3_R1__getTransformedCoords__unsigned_int, + "", + ""); + I_Method0(osgText::Text::GlyphQuads::TexCoords &, getTexCoords, + Properties::NON_VIRTUAL, + __TexCoords_R1__getTexCoords, + "", + ""); + I_Method0(const osgText::Text::GlyphQuads::TexCoords &, getTexCoords, + Properties::NON_VIRTUAL, + __C5_TexCoords_R1__getTexCoords, + "", + ""); + I_Method0(osgText::Text::GlyphQuads::LineNumbers &, getLineNumbers, + Properties::NON_VIRTUAL, + __LineNumbers_R1__getLineNumbers, + "", + ""); + I_Method0(const osgText::Text::GlyphQuads::LineNumbers &, getLineNumbers, + Properties::NON_VIRTUAL, + __C5_LineNumbers_R1__getLineNumbers, + "", + ""); + I_SimpleProperty(osgText::Text::GlyphQuads::Coords2 &, Coords, + __Coords2_R1__getCoords, + 0); + I_SimpleProperty(osgText::Text::GlyphQuads::Glyphs, Glyphs, + __Glyphs__getGlyphs, + 0); + I_SimpleProperty(osgText::Text::GlyphQuads::LineNumbers &, LineNumbers, + __LineNumbers_R1__getLineNumbers, + 0); + I_SimpleProperty(osgText::Text::GlyphQuads::TexCoords &, TexCoords, + __TexCoords_R1__getTexCoords, + 0); + I_PublicMemberProperty(osgText::Text::GlyphQuads::Glyphs, _glyphs); + I_PublicMemberProperty(osgText::Text::GlyphQuads::Coords2, _coords); + I_PublicMemberProperty(osg::buffered_object< osgText::Text::GlyphQuads::Coords3 >, _transformedCoords); + I_PublicMemberProperty(osgText::Text::GlyphQuads::TexCoords, _texcoords); + I_PublicMemberProperty(osgText::Text::GlyphQuads::LineNumbers, _lineNumbers); + I_PublicMemberProperty(osgText::Text::GlyphQuads::ColorCoords, _colorCoords); +END_REFLECTOR BEGIN_ENUM_REFLECTOR(osgText::Text::BackdropType) I_DeclaringFile("osgText/Text"); @@ -50,6 +135,7 @@ BEGIN_ENUM_REFLECTOR(osgText::Text::BackdropImplementation) I_EnumLabel(osgText::Text::NO_DEPTH_BUFFER); I_EnumLabel(osgText::Text::DEPTH_RANGE); I_EnumLabel(osgText::Text::STENCIL_BUFFER); + I_EnumLabel(osgText::Text::DELAYED_DEPTH_WRITES); END_REFLECTOR BEGIN_ENUM_REFLECTOR(osgText::Text::ColorGradientMode) @@ -59,6 +145,8 @@ BEGIN_ENUM_REFLECTOR(osgText::Text::ColorGradientMode) I_EnumLabel(osgText::Text::OVERALL); END_REFLECTOR +TYPE_NAME_ALIAS(std::map< osg::ref_ptr< osgText::Font::GlyphTexture > COMMA osgText::Text::GlyphQuads >, osgText::Text::TextureGlyphQuadMap) + BEGIN_OBJECT_REFLECTOR(osgText::Text) I_DeclaringFile("osgText/Text"); I_BaseType(osgText::TextBase); @@ -124,6 +212,16 @@ BEGIN_OBJECT_REFLECTOR(osgText::Text) __C5_osg_Vec4_R1__getColor, "", ""); + I_Method0(bool, setEnableDepthWrites, + Properties::NON_VIRTUAL, + __bool__setEnableDepthWrites, + "Turns off writing to the depth buffer when rendering text. ", + "This only affects text with no backdrop or text using the DELAYED_DEPTH_WRITES implementation, since the other backdrop implementations are really only useful for backwards compatibility and are not worth updating to utilize this flag. "); + I_Method1(void, setEnableDepthWrites, IN, bool, enable, + Properties::NON_VIRTUAL, + __void__setEnableDepthWrites__bool, + "", + ""); I_Method1(void, setBackdropType, IN, osgText::Text::BackdropType, type, Properties::NON_VIRTUAL, __void__setBackdropType__BackdropType, @@ -342,6 +440,12 @@ BEGIN_OBJECT_REFLECTOR(osgText::Text) __void__drawForegroundText__osg_State_R1__C5_GlyphQuads_R1__C5_osg_Vec4_R1, "", ""); + I_ProtectedMethod2(void, drawTextWithBackdrop, IN, osg::State &, state, IN, const osg::Vec4 &, colorMultiplier, + Properties::NON_VIRTUAL, + Properties::CONST, + __void__drawTextWithBackdrop__osg_State_R1__C5_osg_Vec4_R1, + "", + ""); I_ProtectedMethod2(void, renderOnlyForegroundText, IN, osg::State &, state, IN, const osg::Vec4 &, colorMultiplier, Properties::NON_VIRTUAL, Properties::CONST, @@ -372,6 +476,12 @@ BEGIN_OBJECT_REFLECTOR(osgText::Text) __void__renderWithStencilBuffer__osg_State_R1__C5_osg_Vec4_R1, "", ""); + I_ProtectedMethod2(void, renderWithDelayedDepthWrites, IN, osg::State &, state, IN, const osg::Vec4 &, colorMultiplier, + Properties::NON_VIRTUAL, + Properties::CONST, + __void__renderWithDelayedDepthWrites__osg_State_R1__C5_osg_Vec4_R1, + "", + ""); I_ProtectedMethod10(float, bilinearInterpolate, IN, float, x1, IN, float, x2, IN, float, y1, IN, float, y2, IN, float, x, IN, float, y, IN, float, q11, IN, float, q12, IN, float, q21, IN, float, q22, Properties::NON_VIRTUAL, Properties::CONST, @@ -426,6 +536,9 @@ BEGIN_OBJECT_REFLECTOR(osgText::Text) I_SimpleProperty(const osg::Vec4 &, ColorGradientTopRight, __C5_osg_Vec4_R1__getColorGradientTopRight, 0); + I_SimpleProperty(bool, EnableDepthWrites, + 0, + __void__setEnableDepthWrites__bool); I_SimpleProperty(osg::ref_ptr< osgText::Font >, Font, 0, __void__setFont__osg_ref_ptrT1_Font_); @@ -437,93 +550,6 @@ BEGIN_OBJECT_REFLECTOR(osgText::Text) __void__setThreadSafeRefUnref__bool); END_REFLECTOR -TYPE_NAME_ALIAS(std::vector< osgText::Font::Glyph * >, osgText::Text::GlyphQuads::Glyphs) - -TYPE_NAME_ALIAS(std::vector< unsigned int >, osgText::Text::GlyphQuads::LineNumbers) - -TYPE_NAME_ALIAS(std::vector< osg::Vec2 >, osgText::Text::GlyphQuads::Coords2) - -TYPE_NAME_ALIAS(std::vector< osg::Vec3 >, osgText::Text::GlyphQuads::Coords3) - -TYPE_NAME_ALIAS(std::vector< osg::Vec2 >, osgText::Text::GlyphQuads::TexCoords) - -TYPE_NAME_ALIAS(std::vector< osg::Vec4 >, osgText::Text::GlyphQuads::ColorCoords) - -BEGIN_VALUE_REFLECTOR(osgText::Text::GlyphQuads) - I_DeclaringFile("osgText/Text"); - I_Constructor0(____GlyphQuads, - "", - ""); - I_Method0(osgText::Text::GlyphQuads::Glyphs, getGlyphs, - Properties::NON_VIRTUAL, - __Glyphs__getGlyphs, - "", - ""); - I_Method0(const osgText::Text::GlyphQuads::Glyphs, getGlyphs, - Properties::NON_VIRTUAL, - __C5_Glyphs__getGlyphs, - "", - ""); - I_Method0(osgText::Text::GlyphQuads::Coords2 &, getCoords, - Properties::NON_VIRTUAL, - __Coords2_R1__getCoords, - "", - ""); - I_Method0(const osgText::Text::GlyphQuads::Coords2 &, getCoords, - Properties::NON_VIRTUAL, - __C5_Coords2_R1__getCoords, - "", - ""); - I_Method1(osgText::Text::GlyphQuads::Coords3 &, getTransformedCoords, IN, unsigned int, contexID, - Properties::NON_VIRTUAL, - __Coords3_R1__getTransformedCoords__unsigned_int, - "", - ""); - I_Method1(const osgText::Text::GlyphQuads::Coords3 &, getTransformedCoords, IN, unsigned int, contexID, - Properties::NON_VIRTUAL, - __C5_Coords3_R1__getTransformedCoords__unsigned_int, - "", - ""); - I_Method0(osgText::Text::GlyphQuads::TexCoords &, getTexCoords, - Properties::NON_VIRTUAL, - __TexCoords_R1__getTexCoords, - "", - ""); - I_Method0(const osgText::Text::GlyphQuads::TexCoords &, getTexCoords, - Properties::NON_VIRTUAL, - __C5_TexCoords_R1__getTexCoords, - "", - ""); - I_Method0(osgText::Text::GlyphQuads::LineNumbers &, getLineNumbers, - Properties::NON_VIRTUAL, - __LineNumbers_R1__getLineNumbers, - "", - ""); - I_Method0(const osgText::Text::GlyphQuads::LineNumbers &, getLineNumbers, - Properties::NON_VIRTUAL, - __C5_LineNumbers_R1__getLineNumbers, - "", - ""); - I_SimpleProperty(osgText::Text::GlyphQuads::Coords2 &, Coords, - __Coords2_R1__getCoords, - 0); - I_SimpleProperty(osgText::Text::GlyphQuads::Glyphs, Glyphs, - __Glyphs__getGlyphs, - 0); - I_SimpleProperty(osgText::Text::GlyphQuads::LineNumbers &, LineNumbers, - __LineNumbers_R1__getLineNumbers, - 0); - I_SimpleProperty(osgText::Text::GlyphQuads::TexCoords &, TexCoords, - __TexCoords_R1__getTexCoords, - 0); - I_PublicMemberProperty(osgText::Text::GlyphQuads::Glyphs, _glyphs); - I_PublicMemberProperty(osgText::Text::GlyphQuads::Coords2, _coords); - I_PublicMemberProperty(osg::buffered_object< osgText::Text::GlyphQuads::Coords3 >, _transformedCoords); - I_PublicMemberProperty(osgText::Text::GlyphQuads::TexCoords, _texcoords); - I_PublicMemberProperty(osgText::Text::GlyphQuads::LineNumbers, _lineNumbers); - I_PublicMemberProperty(osgText::Text::GlyphQuads::ColorCoords, _colorCoords); -END_REFLECTOR - BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgText::Font >) I_DeclaringFile("osg/ref_ptr"); I_Constructor0(____ref_ptr,