// Copyright (C) 2002-2003 Gideon May (gideon@computer.org) // // Permission to copy, use, sell and distribute this software is granted // provided this copyright notice appears in all copies. // Permission to modify the code and to distribute modified code is granted // provided this copyright notice appears in all copies, and a notice // that the code was modified is included with the copyright notice. // // This software is provided "as is" without express or implied warranty, // and with no claim as to its suitability for any purpose. #include #include #include #include #include #include "held_ptr.hpp" using namespace boost::python; namespace PyOSG { void init_Stencil() { class_, bases > stencil("Stencil", no_init); scope stencil_scope(stencil); stencil.def(init<>()) .def("setFunction", (void (osg::Stencil::*) (osg::Stencil::Function, int, unsigned int)) &osg::Stencil::setFunction) .def("setFunction", (void (osg::Stencil::*) (osg::Stencil::Function)) &osg::Stencil::setFunction) .def("getFunction", &osg::Stencil::getFunction) .def("setFunctionRef", &osg::Stencil::setFunctionRef) .def("getFunctionRef", &osg::Stencil::getFunctionRef) .def("setFunctionMask", &osg::Stencil::setFunctionMask) .def("getFunctionMask", (unsigned int (osg::Stencil::*) () const) &osg::Stencil::getFunctionMask) .def("setOperation", &osg::Stencil::setOperation, "set the operations to apply when the various stencil and depth \n" "tests fail or pass. First parameter is to control the operation\n" "when the stencil test fails. The second parameter is to control the\n" "operation when the stencil test passes, but depth test fails. The\n" "third parameter controls the operation when both the stencil test\n" "and depth pass. Ordering of parameter is the same as if using\n" "glStencilOp(,,).") .def("setStencilFailOperation", &osg::Stencil::setStencilFailOperation) .def("getStencilFailOperation", &osg::Stencil::getStencilFailOperation) .def("setStencilPassAndDepthFailOperation", &osg::Stencil::setStencilPassAndDepthFailOperation) .def("getStencilPassAndDepthFailOperation", &osg::Stencil::getStencilPassAndDepthFailOperation) .def("setStencilPassAndDepthPassOperation", &osg::Stencil::setStencilPassAndDepthPassOperation) .def("getStencilPassAndDepthPassOperation", &osg::Stencil::getStencilPassAndDepthPassOperation) .def("setWriteMask", &osg::Stencil::setWriteMask) .def("getWriteMask", &osg::Stencil::getWriteMask) ; # define OSG_ENUM_FUNCTION(VALUE) \ (function.value(#VALUE, osg::Stencil::VALUE), \ stencil.def(#VALUE, object(osg::Stencil::VALUE))) enum_ function("Function"); OSG_ENUM_FUNCTION(NEVER); OSG_ENUM_FUNCTION(LESS); OSG_ENUM_FUNCTION(EQUAL); OSG_ENUM_FUNCTION(LEQUAL); OSG_ENUM_FUNCTION(GREATER); OSG_ENUM_FUNCTION(NOTEQUAL); OSG_ENUM_FUNCTION(GEQUAL); OSG_ENUM_FUNCTION(ALWAYS); # define OSG_ENUM_OPERATION(VALUE) \ (operation.value(#VALUE, osg::Stencil::VALUE), \ stencil.def(#VALUE, object(osg::Stencil::VALUE))) enum_ operation("Operation"); OSG_ENUM_OPERATION(KEEP); OSG_ENUM_OPERATION(ZERO); OSG_ENUM_OPERATION(REPLACE); OSG_ENUM_OPERATION(INCR); OSG_ENUM_OPERATION(DECR); OSG_ENUM_OPERATION(INVERT); } } // namespace PyOSG