コード例 #1
0
void register_Vec4_class(){

    { //::xfx::Vec4
        typedef bp::class_< xfx::Vec4 > Vec4_exposer_t;
        Vec4_exposer_t Vec4_exposer = Vec4_exposer_t( "Vec4", bp::init< >() );
        bp::scope Vec4_scope( Vec4_exposer );
        Vec4_exposer.def( bp::init< float >(( bp::arg("v") )) );
        bp::implicitly_convertible< float, xfx::Vec4 >();
        Vec4_exposer.def( bp::init< xfx::Vec4 const & >(( bp::arg("v") )) );
        Vec4_exposer.def( bp::init< float, float, float, float >(( bp::arg("vx"), bp::arg("vy"), bp::arg("vz"), bp::arg("vw") )) );
        { //::xfx::Vec4::Clip
        
            typedef void ( *clip_function_type )( ::xfx::Vec4 & );
            
            Vec4_exposer.def( 
                "clip"
                , clip_function_type( &::xfx::Vec4::Clip )
                , ( bp::arg("v") ) );
        
        }
        { //::xfx::Vec4::Dot
        
            typedef float ( *dot_function_type )( ::xfx::Vec4 const &,::xfx::Vec4 const & );
            
            Vec4_exposer.def( 
                "dot"
                , dot_function_type( &::xfx::Vec4::Dot )
                , ( bp::arg("u"), bp::arg("v") ) );
        
        }
        { //::xfx::Vec4::Lerp
        
            typedef ::xfx::Vec4 ( *lerp_function_type )( ::xfx::Vec4 const &,::xfx::Vec4 const &,float const & );
            
            Vec4_exposer.def( 
                "lerp"
                , lerp_function_type( &::xfx::Vec4::Lerp )
                , ( bp::arg("u"), bp::arg("v"), bp::arg("t") ) );
        
        }
        { //::xfx::Vec4::Normalize
        
            typedef void ( ::xfx::Vec4::*normalize_function_type )(  ) ;
            
            Vec4_exposer.def( 
                "normalize"
                , normalize_function_type( &::xfx::Vec4::Normalize ) );
        
        }
        { //::xfx::Vec4::Rand
        
            typedef ::xfx::Vec4 ( *rand_function_type )(  );
            
            Vec4_exposer.def( 
                "rand"
                , rand_function_type( &::xfx::Vec4::Rand ) );
        
        }
        { //::xfx::Vec4::ToString
        
            typedef ::xfx::String ( ::xfx::Vec4::*__repr___function_type )(  ) const;
            
            Vec4_exposer.def( 
                "__repr__"
                , __repr___function_type( &::xfx::Vec4::ToString ) );
        
        }
        Vec4_exposer.def( bp::self *= bp::other< float >() );
        Vec4_exposer.def( bp::self *= bp::self );
        Vec4_exposer.def( bp::self += bp::self );
        Vec4_exposer.def( -bp::self );
        Vec4_exposer.def( bp::self -= bp::self );
        Vec4_exposer.def( bp::self /= bp::other< float >() );
        { //::xfx::Vec4::operator=
        
            typedef ::xfx::Vec4 & ( ::xfx::Vec4::*assign_function_type )( ::xfx::Vec4 const & ) ;
            
            Vec4_exposer.def( 
                "assign"
                , assign_function_type( &::xfx::Vec4::operator= )
                , ( bp::arg("v") )
                , bp::return_self< >() );
        
        }
        { //::xfx::Vec4::xyzw
        
            typedef void ( ::xfx::Vec4::*xyzw_function_type )( float,float,float,float ) ;
            
            Vec4_exposer.def( 
                "xyzw"
                , xyzw_function_type( &::xfx::Vec4::xyzw )
                , ( bp::arg("_x"), bp::arg("_y"), bp::arg("_z"), bp::arg("_w") ) );
        
        }
        Vec4_exposer.def_readwrite( "w", &xfx::Vec4::w );
        Vec4_exposer.def_readwrite( "x", &xfx::Vec4::x );
        Vec4_exposer.def_readwrite( "y", &xfx::Vec4::y );
        Vec4_exposer.def_readwrite( "z", &xfx::Vec4::z );
        Vec4_exposer.staticmethod( "clip" );
        Vec4_exposer.staticmethod( "dot" );
        Vec4_exposer.staticmethod( "lerp" );
        Vec4_exposer.staticmethod( "rand" );
        { //property "normalized"[fget=::xfx::Vec4::GetNormalized]
        
            typedef ::xfx::Vec4 ( ::xfx::Vec4::*fget )(  ) const;
            
            Vec4_exposer.add_property( 
                "normalized"
                , fget( &::xfx::Vec4::GetNormalized )
                , "get property, built on top of \"xfx::Vec4 xfx::Vec4::GetNormalized() const [member function]\"" );
        
        }
        { //property "len_sq"[fget=::xfx::Vec4::LenSq]
        
            typedef float ( ::xfx::Vec4::*fget )(  ) const;
            
            Vec4_exposer.add_property( 
                "len_sq"
                , fget( &::xfx::Vec4::LenSq )
                , "get property, built on top of \"float xfx::Vec4::LenSq() const [member function]\"" );
        
        }
        { //property "len"[fget=::xfx::Vec4::Len]
        
            typedef float ( ::xfx::Vec4::*fget )(  ) const;
            
            Vec4_exposer.add_property( 
                "len"
                , fget( &::xfx::Vec4::Len )
                , "get property, built on top of \"float xfx::Vec4::Len() const [member function]\"" );
        
        }
        Vec4_exposer.def( bp::self != bp::self );
        Vec4_exposer.def( bp::self * bp::other< float >() );
        Vec4_exposer.def( bp::other< float >() * bp::self );
        Vec4_exposer.def( bp::self + bp::self );
        Vec4_exposer.def( bp::self - bp::self );
        Vec4_exposer.def( bp::self / bp::other< float >() );
        Vec4_exposer.def( bp::self == bp::self );
        bp::register_ptr_to_python< boost::shared_ptr< xfx::Vec4 const > >( );
        bp::implicitly_convertible< boost::shared_ptr< xfx::Vec4 >, boost::shared_ptr< xfx::Vec4 const > >( );
    }

}
コード例 #2
0
ファイル: Vec2d.pypp.cpp プロジェクト: cmbruns/osgpyplusplus
void register_Vec2d_class(){

    { //::osg::Vec2d
        typedef bp::class_< osg::Vec2d > Vec2d_exposer_t;
        Vec2d_exposer_t Vec2d_exposer = Vec2d_exposer_t( "Vec2d", "\n General purpose double pair, uses include representation of\n texture coordinates.\n No support yet added for double * Vec2d - is it necessary?\n Need to define a non-member non-friend operator* etc.\n BTW: Vec2d * double is okay\n", bp::init< >("\n Constructor that sets all components of the vector to zero\n") );
        bp::scope Vec2d_scope( Vec2d_exposer );
        bp::scope().attr("num_components") = (int)osg::Vec2d::num_components;
        Vec2d_exposer.def( bp::init< double, double >(( bp::arg("x"), bp::arg("y") )) );
        Vec2d_exposer.def( bp::init< osg::Vec2f const & >(( bp::arg("vec") )) );
        bp::implicitly_convertible< osg::Vec2f const &, osg::Vec2d >();
        { //::osg::Vec2d::isNaN
        
            typedef bool ( ::osg::Vec2d::*isNaN_function_type )(  ) const;
            
            Vec2d_exposer.def( 
                "isNaN"
                , isNaN_function_type( &::osg::Vec2d::isNaN )
                , "\n Returns true if at least one component has value NaN.\n" );
        
        }
        { //::osg::Vec2d::length
        
            typedef double ( ::osg::Vec2d::*length_function_type )(  ) const;
            
            Vec2d_exposer.def( 
                "length"
                , length_function_type( &::osg::Vec2d::length )
                , "\n Length of the vector = sqrt( vec . vec )\n" );
        
        }
        { //::osg::Vec2d::length2
        
            typedef double ( ::osg::Vec2d::*length2_function_type )(  ) const;
            
            Vec2d_exposer.def( 
                "length2"
                , length2_function_type( &::osg::Vec2d::length2 )
                , "\n Length squared of the vector = vec . vec\n" );
        
        }
        { //::osg::Vec2d::normalize
        
            typedef double ( ::osg::Vec2d::*normalize_function_type )(  ) ;
            
            Vec2d_exposer.def( 
                "normalize"
                , normalize_function_type( &::osg::Vec2d::normalize )
                , "\n Normalize the vector so that it has length unity.\n Returns the previous length of the vector.\n" );
        
        }
        Vec2d_exposer.def( "as__scope_osg_scope_Vec2f", &osg::Vec2d::operator ::osg::Vec2f  );
        Vec2d_exposer.def( bp::self != bp::self );
        Vec2d_exposer.def( bp::self * bp::self );
        Vec2d_exposer.def( bp::self * bp::other< double >() );
        Vec2d_exposer.def( bp::self *= bp::other< double >() );
        Vec2d_exposer.def( bp::self + bp::self );
        Vec2d_exposer.def( bp::self += bp::self );
        Vec2d_exposer.def( bp::self - bp::self );
        Vec2d_exposer.def( -bp::self );
        Vec2d_exposer.def( bp::self -= bp::self );
        Vec2d_exposer.def( bp::self / bp::other< double >() );
        Vec2d_exposer.def( bp::self /= bp::other< double >() );
        Vec2d_exposer.def( bp::self < bp::self );
        Vec2d_exposer.def( bp::self == bp::self );
        { //::osg::Vec2d::operator[]
        
            typedef double & ( ::osg::Vec2d::*__getitem___function_type )( int ) ;
            
            Vec2d_exposer.def( 
                "__getitem__"
                , __getitem___function_type( &::osg::Vec2d::operator[] )
                , ( bp::arg("i") )
                , bp::return_value_policy< bp::copy_non_const_reference >() );
        
        }
        { //::osg::Vec2d::operator[]
        
            typedef double ( ::osg::Vec2d::*__getitem___function_type )( int ) const;
            
            Vec2d_exposer.def( 
                "__getitem__"
                , __getitem___function_type( &::osg::Vec2d::operator[] )
                , ( bp::arg("i") ) );
        
        }
        { //::osg::Vec2d::set
        
            typedef void ( ::osg::Vec2d::*set_function_type )( double,double ) ;
            
            Vec2d_exposer.def( 
                "set"
                , set_function_type( &::osg::Vec2d::set )
                , ( bp::arg("x"), bp::arg("y") ) );
        
        }
        { //::osg::Vec2d::valid
        
            typedef bool ( ::osg::Vec2d::*valid_function_type )(  ) const;
            
            Vec2d_exposer.def( 
                "valid"
                , valid_function_type( &::osg::Vec2d::valid )
                , "\n Returns true if all components have values that are not NaN.\n" );
        
        }
        { //property "x"[fget=::osg::Vec2d::x]
        
            typedef double & ( ::osg::Vec2d::*fget )(  ) ;
            
            Vec2d_exposer.add_property( 
                "x"
                , bp::make_function( 
                      fget( &::osg::Vec2d::x )
                    , bp::return_value_policy< bp::copy_non_const_reference >() )  );
        
        }
        { //property "x"[fget=::osg::Vec2d::x]
        
            typedef double ( ::osg::Vec2d::*fget )(  ) const;
            
            Vec2d_exposer.add_property( 
                "x"
                , fget( &::osg::Vec2d::x ) );
        
        }
        { //property "y"[fget=::osg::Vec2d::y]
        
            typedef double & ( ::osg::Vec2d::*fget )(  ) ;
            
            Vec2d_exposer.add_property( 
                "y"
                , bp::make_function( 
                      fget( &::osg::Vec2d::y )
                    , bp::return_value_policy< bp::copy_non_const_reference >() )  );
        
        }
        { //property "y"[fget=::osg::Vec2d::y]
        
            typedef double ( ::osg::Vec2d::*fget )(  ) const;
            
            Vec2d_exposer.add_property( 
                "y"
                , fget( &::osg::Vec2d::y ) );
        
        }
        Vec2d_exposer.def( bp::self_ns::str( bp::self ) );
        Vec2d_exposer.def( bp::self_ns::str(bp::self) );
        Vec2d_exposer.def(bp::indexing::container_suite<
                                    osg::Vec2d, 
                                    bp::indexing::all_methods, 
                                    OsgVec_algorithms<osg::Vec2d, osg::Vec2d::value_type, osg::Vec2d::num_components> >());
    }

}
コード例 #3
0
void register_Vec3f_class(){

    { //::osg::Vec3f
        typedef bp::class_< osg::Vec3f > Vec3f_exposer_t;
        Vec3f_exposer_t Vec3f_exposer = Vec3f_exposer_t( "Vec3f", "\n General purpose float triple for use as vertices, vectors and normals.\n Provides general math operations from addition through to cross products.\n No support yet added for float * Vec3f - is it necessary?\n Need to define a non-member non-friend operator*  etc.\n Vec3f * float is okay\n", bp::init< >("\n Constructor that sets all components of the vector to zero\n") );
        bp::scope Vec3f_scope( Vec3f_exposer );
        bp::scope().attr("num_components") = (int)osg::Vec3f::num_components;
        Vec3f_exposer.def( bp::init< float, float, float >(( bp::arg("x"), bp::arg("y"), bp::arg("z") )) );
        Vec3f_exposer.def( bp::init< osg::Vec2f const &, float >(( bp::arg("v2"), bp::arg("zz") )) );
        { //::osg::Vec3f::isNaN
        
            typedef bool ( ::osg::Vec3f::*isNaN_function_type)(  ) const;
            
            Vec3f_exposer.def( 
                "isNaN"
                , isNaN_function_type( &::osg::Vec3f::isNaN )
                , "\n Returns true if at least one component has value NaN.\n" );
        
        }
        { //::osg::Vec3f::length
        
            typedef float ( ::osg::Vec3f::*length_function_type)(  ) const;
            
            Vec3f_exposer.def( 
                "length"
                , length_function_type( &::osg::Vec3f::length )
                , "\n Length of the vector = sqrt( vec . vec )\n" );
        
        }
        { //::osg::Vec3f::length2
        
            typedef float ( ::osg::Vec3f::*length2_function_type)(  ) const;
            
            Vec3f_exposer.def( 
                "length2"
                , length2_function_type( &::osg::Vec3f::length2 )
                , "\n Length squared of the vector = vec . vec\n" );
        
        }
        { //::osg::Vec3f::normalize
        
            typedef float ( ::osg::Vec3f::*normalize_function_type)(  ) ;
            
            Vec3f_exposer.def( 
                "normalize"
                , normalize_function_type( &::osg::Vec3f::normalize )
                , "\n Normalize the vector so that it has length unity.\n Returns the previous length of the vector.\n" );
        
        }
        Vec3f_exposer.def( bp::self != bp::self );
        Vec3f_exposer.def( bp::self * bp::self );
        Vec3f_exposer.def( bp::self * bp::other< float >() );
        Vec3f_exposer.def( bp::self *= bp::other< float >() );
        Vec3f_exposer.def( bp::self + bp::self );
        Vec3f_exposer.def( bp::self += bp::self );
        Vec3f_exposer.def( bp::self - bp::self );
        Vec3f_exposer.def( -bp::self );
        Vec3f_exposer.def( bp::self -= bp::self );
        Vec3f_exposer.def( bp::self / bp::other< float >() );
        Vec3f_exposer.def( bp::self /= bp::other< float >() );
        Vec3f_exposer.def( bp::self < bp::self );
        Vec3f_exposer.def( bp::self == bp::self );
        { //::osg::Vec3f::operator[]
        
            typedef float & ( ::osg::Vec3f::*__getitem___function_type)( int ) ;
            
            Vec3f_exposer.def( 
                "__getitem__"
                , __getitem___function_type( &::osg::Vec3f::operator[] )
                , ( bp::arg("i") )
                , bp::return_value_policy< bp::copy_non_const_reference >() );
        
        }
        { //::osg::Vec3f::operator[]
        
            typedef float ( ::osg::Vec3f::*__getitem___function_type)( int ) const;
            
            Vec3f_exposer.def( 
                "__getitem__"
                , __getitem___function_type( &::osg::Vec3f::operator[] )
                , ( bp::arg("i") ) );
        
        }
        Vec3f_exposer.def( bp::self ^ bp::self );
        { //::osg::Vec3f::set
        
            typedef void ( ::osg::Vec3f::*set_function_type)( float,float,float ) ;
            
            Vec3f_exposer.def( 
                "set"
                , set_function_type( &::osg::Vec3f::set )
                , ( bp::arg("x"), bp::arg("y"), bp::arg("z") ) );
        
        }
        { //::osg::Vec3f::set
        
            typedef void ( ::osg::Vec3f::*set_function_type)( ::osg::Vec3f const & ) ;
            
            Vec3f_exposer.def( 
                "set"
                , set_function_type( &::osg::Vec3f::set )
                , ( bp::arg("rhs") ) );
        
        }
        { //::osg::Vec3f::valid
        
            typedef bool ( ::osg::Vec3f::*valid_function_type)(  ) const;
            
            Vec3f_exposer.def( 
                "valid"
                , valid_function_type( &::osg::Vec3f::valid )
                , "\n Returns true if all components have values that are not NaN.\n" );
        
        }
        { //property "x"[fget=::osg::Vec3f::x]
        
            typedef float & ( ::osg::Vec3f::*fget)(  ) ;
            
            Vec3f_exposer.add_property( 
                "x"
                , bp::make_function( 
                      fget( &::osg::Vec3f::x )
                    , bp::return_value_policy< bp::copy_non_const_reference >() )  );
        
        }
        { //property "x"[fget=::osg::Vec3f::x]
        
            typedef float ( ::osg::Vec3f::*fget)(  ) const;
            
            Vec3f_exposer.add_property( 
                "x"
                , fget( &::osg::Vec3f::x ) );
        
        }
        { //property "y"[fget=::osg::Vec3f::y]
        
            typedef float & ( ::osg::Vec3f::*fget)(  ) ;
            
            Vec3f_exposer.add_property( 
                "y"
                , bp::make_function( 
                      fget( &::osg::Vec3f::y )
                    , bp::return_value_policy< bp::copy_non_const_reference >() )  );
        
        }
        { //property "y"[fget=::osg::Vec3f::y]
        
            typedef float ( ::osg::Vec3f::*fget)(  ) const;
            
            Vec3f_exposer.add_property( 
                "y"
                , fget( &::osg::Vec3f::y ) );
        
        }
        { //property "z"[fget=::osg::Vec3f::z]
        
            typedef float & ( ::osg::Vec3f::*fget)(  ) ;
            
            Vec3f_exposer.add_property( 
                "z"
                , bp::make_function( 
                      fget( &::osg::Vec3f::z )
                    , bp::return_value_policy< bp::copy_non_const_reference >() )  );
        
        }
        { //property "z"[fget=::osg::Vec3f::z]
        
            typedef float ( ::osg::Vec3f::*fget)(  ) const;
            
            Vec3f_exposer.add_property( 
                "z"
                , fget( &::osg::Vec3f::z ) );
        
        }
        Vec3f_exposer.def( bp::self * bp::other< osg::Matrixf >() );
        Vec3f_exposer.def( bp::self * bp::other< osg::Matrixd >() );
        Vec3f_exposer.def( bp::self * bp::other< osg::Vec4d >() );
        Vec3f_exposer.def( bp::self * bp::other< osg::Vec4f >() );
        Vec3f_exposer.def( bp::self_ns::str( bp::self ) );
        Vec3f_exposer.def( bp::self_ns::str(bp::self) );
        Vec3f_exposer.def(bp::indexing::container_suite<
                            osg::Vec3f, 
                            bp::indexing::all_methods, 
                            OsgVec_algorithms<osg::Vec3f, osg::Vec3f::value_type, osg::Vec3f::num_components> >());
    }

}