/usr/share/openscenegraph/examples/osgvirtualprogram/VirtualProgram.h is in openscenegraph-examples 3.0.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #ifndef _VIRTUAL_PROGRAM__
#define _VIRTUAL_PROGRAM__ 1
#include<string>
#include<map>
#include<osg/Shader>
#include<osg/Program>
////////////////////////////////////////////////////////////////////////////////
namespace osgCandidate {
////////////////////////////////////////////////////////////////////////////////
class VirtualProgram: public osg::Program
{
public:
VirtualProgram( unsigned int mask = 0xFFFFFFFFUL );
virtual ~VirtualProgram( void );
VirtualProgram( const VirtualProgram& VirtualProgram,
const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY );
META_StateAttribute( osgCandidate, VirtualProgram, Type( PROGRAM ) )
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
virtual int compare(const StateAttribute& sa) const
{
// check the types are equal and then create the rhs variable
// used by the COMPARE_StateAttribute_Parameter macros below.
COMPARE_StateAttribute_Types(VirtualProgram,sa)
// compare each parameter in turn against the rhs.
COMPARE_StateAttribute_Parameter(_mask)
COMPARE_StateAttribute_Parameter(_shaderMap)
return 0; // passed all the above comparison macros, must be equal.
}
/** If enabled, activate our program in the GL pipeline,
* performing any rebuild operations that might be pending. */
virtual void apply(osg::State& state) const;
osg::Shader* getShader ( const std::string & shaderSemantic,
osg::Shader::Type type );
osg::Shader* setShader ( const std::string & shaderSemantic,
osg::Shader * shader );
protected:
typedef std::vector< osg::ref_ptr< osg::Shader > > ShaderList;
typedef std::pair< std::string, osg::Shader::Type > ShaderSemantic;
typedef std::map< ShaderSemantic, osg::ref_ptr<osg::Shader> > ShaderMap;
typedef std::map< ShaderList, osg::ref_ptr<osg::Program> > ProgramMap;
mutable ProgramMap _programMap;
ShaderMap _shaderMap;
unsigned int _mask;
}; // class VirtualProgram
////////////////////////////////////////////////////////////////////////////////
} // namespace osgCandidate
////////////////////////////////////////////////////////////////////////////////
#endif
|