// 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. // // TODO RangeList (stl) #include #include #include #include #include #include #include #include #include #include "Group.hpp" #include "held_ptr.hpp" using namespace osg; using namespace boost::python; namespace { DEFINE_GROUP_CAST(LOD) } namespace PyOSG { void init_LOD() { REGISTER_GROUP_CAST(LOD) class_, bases > lod("LOD", "LOD - Level Of Detail group node which allows switching between children\n" "depending on distance from eye point.\n" "Typical uses are for load balancing - objects further away from\n" "the eye point are rendered at a lower level of detail, and at times\n" "of high stress on the graphics pipeline lower levels of detail can\n" "also be chosen.\n" "The children are ordered from most detailed (for close up views) to the least \n" "(see from a distance), and a set of ranges are used to decide which LOD is used \n" "at different view distances, the criteria used is child 'i' is used when \n" "range[i]()) .def("addChild", (bool (LOD::*)(Node *)) &LOD::addChild) .def("addChild", (bool (LOD::*)(Node *, float, float)) &LOD::addChild) .def("removeChild", &LOD::removeChild) .def("setCenterMode", &LOD::setCenterMode) .def("getCenterMode", &LOD::getCenterMode) .def("setCenter", &LOD::setCenter, "Sets the object-space point which defines the center of the LOD. \n" "center is affected by any transforms in the hierarchy above the LOD.\n") .def("getCenter", &LOD::getCenter, return_value_policy(), "return the LOD center point.\n") .def("setRange", &LOD::setRange, "Sets the value of range list element index to range which\n" "is a floating point distance specified in world coordinates.\n" "Range list automatically expands to accommodate values beyond\n" "the current getNumRanges().\n") .def("getMinRange", &LOD::getMinRange, "returns the min visible range for specified child.") .def("getMaxRange", &LOD::getMaxRange, "returns the max visible range for specified child.") .def("getNumRanges", &LOD::getNumRanges, "returns the number of ranges currently set.\n") ; # define OSG_ENUM_MODE(VALUE) \ (mode.value(#VALUE, LOD::VALUE), \ lod.def(#VALUE, object(LOD::VALUE))) enum_ mode("CenterMode"); OSG_ENUM_MODE(USE_BOUNDING_SPHERE_CENTER); OSG_ENUM_MODE(USER_DEFINED_CENTER); scope(); } }