#include #if ((OSG_VERSION_MAJOR==1) && (OSG_VERSION_MINOR < 3)) // 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 Tesselator : public osgUtil::Tesselator { public: Tesselator(PyObject * p) : osgUtil::Tesselator(), _self(p) { Py_XINCREF(_self); } ~Tesselator() { Py_XDECREF(_self); } PyObject* self() { return _self; } private: PyObject * _self; }; } // namespace namespace PyOSGUtil { void init_Tesselator() { { class_ tesselator("Tesselator"); scope tesselator_scope(tesselator); tesselator .def("setBoundaryOnly", &osgUtil::Tesselator::setBoundaryOnly) .def("getBoundaryOnly", &osgUtil::Tesselator::getBoundaryOnly) .def("setWindingType", &osgUtil::Tesselator::setWindingType) .def("getWindingType", &osgUtil::Tesselator::getWindingType) .def("setTesselationType", &osgUtil::Tesselator::setTesselationType) .def("getTesselationType", &osgUtil::Tesselator::getTesselationType) .def("retesselatePolygons", &osgUtil::Tesselator::retesselatePolygons) .def("getContours", &osgUtil::Tesselator::getContours) .def("beginTesselation", &osgUtil::Tesselator::beginTesselation) .def("beginContour", &osgUtil::Tesselator::beginContour) .def("addVertex", &osgUtil::Tesselator::addVertex) .def("endContour", &osgUtil::Tesselator::endContour) .def("endTesselation", &osgUtil::Tesselator::endTesselation) .def("reset", &osgUtil::Tesselator::reset) ; # define OSG_ENUM_WINDING(VALUE) \ (winding.value(#VALUE, osgUtil::Tesselator::VALUE), \ tesselator.def(#VALUE, object(osgUtil::Tesselator::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_TESSELATION(VALUE) \ (tesselation.value(#VALUE, osgUtil::Tesselator::VALUE), \ tesselator.def(#VALUE, object(osgUtil::Tesselator::VALUE))) enum_ tesselation("TesselationType"); OSG_ENUM_TESSELATION(TESS_TYPE_GEOMETRY); // tesselate everything in the geometry object OSG_ENUM_TESSELATION(TESS_TYPE_DRAWABLE); // tesselate each polygon, triangles & quads drawables in geometry separately OSG_ENUM_TESSELATION(TESS_TYPE_POLYGONS); // tesselate ONLY polygon drawables in geometry separately } { class_, bases, boost::noncopyable> tesselator("Tesselator_base", no_init); tesselator // .def(init<>()) .def("self", &Tesselator::self) ; } } } #endif //#if ((OSG_VERSION_MAJOR==1) & (OSG_VERSION_MINOR < 3))