#include #if ((OSG_VERSION_MAJOR==1) && (OSG_VERSION_MINOR < 3)) #else // 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 #include #include #include #include #include #include #include #include #include #include #include "held_ptr.hpp" using namespace boost::python; namespace { class Tessellator : public osgUtil::Tessellator { public: Tessellator(PyObject * p) : osgUtil::Tessellator(), _self(p) { Py_XINCREF(_self); } ~Tessellator() { Py_XDECREF(_self); } PyObject* self() { return _self; } private: PyObject * _self; }; } // namespace namespace PyOSGUtil { void init_Tessellator() { { class_ tessellator("Tessellator"); scope tessellator_scope(tessellator); tessellator .def("setBoundaryOnly", &osgUtil::Tessellator::setBoundaryOnly) .def("getBoundaryOnly", &osgUtil::Tessellator::getBoundaryOnly) .def("setWindingType", &osgUtil::Tessellator::setWindingType) .def("getWindingType", &osgUtil::Tessellator::getWindingType) .def("setTessellationType", &osgUtil::Tessellator::setTessellationType) .def("getTessellationType", &osgUtil::Tessellator::getTessellationType) .def("retessellatePolygons", &osgUtil::Tessellator::retessellatePolygons) .def("getContours", &osgUtil::Tessellator::getContours) .def("beginTessellation", &osgUtil::Tessellator::beginTessellation) .def("beginContour", &osgUtil::Tessellator::beginContour) .def("addVertex", &osgUtil::Tessellator::addVertex) .def("endContour", &osgUtil::Tessellator::endContour) .def("endTessellation", &osgUtil::Tessellator::endTessellation) .def("reset", &osgUtil::Tessellator::reset) ; # define OSG_ENUM_WINDING(VALUE) \ (winding.value(#VALUE, osgUtil::Tessellator::VALUE), \ tessellator.def(#VALUE, object(osgUtil::Tessellator::VALUE))) enum_ winding("WindingType"); OSG_ENUM_WINDING(TESS_WINDING_ODD); OSG_ENUM_WINDING(TESS_WINDING_NONZERO); OSG_ENUM_WINDING(TESS_WINDING_POSITIVE); OSG_ENUM_WINDING(TESS_WINDING_NEGATIVE); OSG_ENUM_WINDING(TESS_WINDING_ABS_GEQ_TWO); # define OSG_ENUM_TESSELLATION(VALUE) \ (tessellation.value(#VALUE, osgUtil::Tessellator::VALUE), \ tessellator.def(#VALUE, object(osgUtil::Tessellator::VALUE))) enum_ tessellation("TessellationType"); OSG_ENUM_TESSELLATION(TESS_TYPE_GEOMETRY); // tessellate everything in the geometry object OSG_ENUM_TESSELLATION(TESS_TYPE_DRAWABLE); // tessellate each polygon, triangles & quads drawables in geometry separately OSG_ENUM_TESSELLATION(TESS_TYPE_POLYGONS); // tessellate ONLY polygon drawables in geometry separately } { class_, bases, boost::noncopyable> tessellator("Tessellator_base", no_init); tessellator // .def(init<>()) .def("self", &Tessellator::self) ; } } } #endif // else // #if ((OSG_VERSION_MAJOR==1) & (OSG_VERSION_MINOR < 3))