// 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 "StateAttribute.hpp" #include "held_ptr.hpp" using namespace boost::python; namespace { osg::PolygonMode * asPolygonMode(osg::StateAttribute * self) { return dynamic_cast(self); } } namespace PyOSG { void init_PolygonMode() { register_castStateAttribute("asPolygonMode", &asPolygonMode); class_, bases > polygon("PolygonMode", no_init); scope polygon_scope(polygon); polygon.def(init<>()) .def("setMode", &osg::PolygonMode::setMode) .def("getMode", &osg::PolygonMode::getMode) .def("getFrontAndBack", &osg::PolygonMode::getFrontAndBack) ; # define OSG_ENUM_FACE(VALUE) \ (face.value(#VALUE, osg::PolygonMode::VALUE), \ polygon.def(#VALUE, object(osg::PolygonMode::VALUE))) enum_ face("Face"); OSG_ENUM_FACE(FRONT); OSG_ENUM_FACE(BACK); OSG_ENUM_FACE(FRONT_AND_BACK); # define OSG_ENUM_MODE(VALUE) \ (mode.value(#VALUE, osg::PolygonMode::VALUE), \ polygon.def(#VALUE, object(osg::PolygonMode::VALUE))) enum_ mode("Mode"); OSG_ENUM_MODE(POINT); OSG_ENUM_MODE(LINE); OSG_ENUM_MODE(FILL); } } // namespace PyOSG