Skip to content

Instantly share code, notes, and snippets.

@casallas
Created December 6, 2011 15:51
Show Gist options
  • Save casallas/1438661 to your computer and use it in GitHub Desktop.
Save casallas/1438661 to your computer and use it in GitHub Desktop.
Index: include/osgwTools/TransparencyUtils.h
===================================================================
--- include/osgwTools/TransparencyUtils.h (revision 390)
+++ include/osgwTools/TransparencyUtils.h (working copy)
@@ -112,6 +112,15 @@
return( true );
}
+
+/** \brief Returns True if the given StateSet is configured like one of our transparent StateSets.
+ \It returns True if the Node has a StateSet, and the StateSet has the following signature:
+ \li A BlendColor StateAttribute
+ \li A BlendFunc StateAttribute
+ \li GL_BLEND is enabled
+ \li Rendering hint set to TRANSPARENT_BIN
+ */
+OSGWTOOLS_EXPORT bool isTransparent( const osg::StateSet* stateSet );
/** \brief Restores opacity by undoing the effects of a prior call to transparentEnable.
If the Node or Drawable isn't transparent (as defined by the isTransparent call),
@@ -170,17 +179,8 @@
return( true );
}
-/** \brief Returns True if the given StateSet is configured like one of our transparent StateSets.
-\It returns True if the Node has a StateSet, and the StateSet has the following signature:
-\li A BlendColor StateAttribute
-\li A BlendFunc StateAttribute
-\li GL_BLEND is enabled
-\li Rendering hint set to TRANSPARENT_BIN
-*/
-OSGWTOOLS_EXPORT bool isTransparent( const osg::StateSet* stateSet );
-
/** \brief Finds StateSets with nominal transparency and marks the transparent state as PROTECTED
The function runs this Node visitor on scene graphs (for example, loaded models) that already potentially
@casallas
Copy link
Author

casallas commented Dec 6, 2011

Need to declare isTransparent before calling in on the osgwTools::transparentDisable template, else you would get a message like this on clang:

/tmp/homebrew-osgworks-2.0-PtlR/osgw2/include/osgwTools/TransparencyUtils.h:138:10: error: 
      call to function 'isTransparent' that is neither visible in the template
      definition nor found by argument-dependent lookup
    if( !isTransparent( nodeOrDrawable->getStateSet() ) )
         ^
/tmp/homebrew-osgworks-2.0-PtlR/osgw2/src/osgwTools/TransparencyUtils.cpp:136:5: note: 
      in instantiation of function template specialization
      'osgwTools::transparentDisable<osg::Node>' requested here
    transparentDisable( &node );
    ^
/tmp/homebrew-osgworks-2.0-PtlR/osgw2/src/osgwTools/TransparencyUtils.cpp:34:6: note: 
      'isTransparent' should be declared prior to the call site or in namespace
      'osg'
bool isTransparent( const osg::StateSet* stateSet )
     ^
In file included from /tmp/homebrew-osgworks-2.0-PtlR/osgw2/src/osgwTools/TransparencyUtils.cpp:21:
/tmp/homebrew-osgworks-2.0-PtlR/osgw2/include/osgwTools/TransparencyUtils.h:138:10: error: 
      call to function 'isTransparent' that is neither visible in the template
      definition nor found by argument-dependent lookup
    if( !isTransparent( nodeOrDrawable->getStateSet() ) )
         ^
/tmp/homebrew-osgworks-2.0-PtlR/osgw2/src/osgwTools/TransparencyUtils.cpp:144:5: note: 
      in instantiation of function template specialization
      'osgwTools::transparentDisable<osg::Geode>' requested here
    transparentDisable( &geode );
    ^
/tmp/homebrew-osgworks-2.0-PtlR/osgw2/src/osgwTools/TransparencyUtils.cpp:34:6: note: 
      'isTransparent' should be declared prior to the call site or in namespace
      'osg'
bool isTransparent( const osg::StateSet* stateSet )
     ^
In file included from /tmp/homebrew-osgworks-2.0-PtlR/osgw2/src/osgwTools/TransparencyUtils.cpp:21:
/tmp/homebrew-osgworks-2.0-PtlR/osgw2/include/osgwTools/TransparencyUtils.h:138:10: error: 
      call to function 'isTransparent' that is neither visible in the template
      definition nor found by argument-dependent lookup
    if( !isTransparent( nodeOrDrawable->getStateSet() ) )
         ^
/tmp/homebrew-osgworks-2.0-PtlR/osgw2/src/osgwTools/TransparencyUtils.cpp:149:9: note: 
      in instantiation of function template specialization
      'osgwTools::transparentDisable<osg::Drawable>' requested here
        transparentDisable( geode.getDrawable( idx ) );
        ^
/tmp/homebrew-osgworks-2.0-PtlR/osgw2/src/osgwTools/TransparencyUtils.cpp:34:6: note: 
      'isTransparent' should be declared prior to the call site or in namespace
      'osg'
bool isTransparent( const osg::StateSet* stateSet )
     ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment