// Copyright (C) 2002-2005 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 "Geode.hpp" #include "held_ptr.hpp" using namespace boost::python; namespace { DEFINE_GEODE_CAST(Billboard) } namespace PyOSG { void init_Billboard() { REGISTER_GEODE_CAST(Billboard) class_, bases > billboard("Billboard", "Billboard - a Geode which orientates its child osg::Drawable's to face\n" "the eye point. Typical uses are for trees, or particle explosions.\n", no_init); scope billboard_scope(billboard); billboard .def(init<>()) .def("setMode", &osg::Billboard::setMode, "Set the billboard rotation mode.") .def("getMode", &osg::Billboard::getMode, "Get the billboard rotation mode.") .def("setAxis", &osg::Billboard::setAxis, "Set the axis about which all the billboard's drawable rotate. Only utlized when mode==AXIAL_ROT") .def("getAxis", &osg::Billboard::getAxis, return_value_policy(), "Get the axis about which all the billboard's drawable rotate.") .def("setNormal", &osg::Billboard::setNormal, "Set the normal which defines the billboard's drawable front face, when unrotated.") .def("getNormal", &osg::Billboard::getNormal, return_value_policy(), "Get the normal of billboard's drawable front face.") .def("setPosition", &osg::Billboard::setPosition, "Set the position of specified drawable.") .def("getPosition", &osg::Billboard::getPosition, return_value_policy(), "Get the position of specified drawable.") .def("addDrawable", (bool(osg::Billboard::*)(osg::Drawable *)) &osg::Billboard::addDrawable) .def("addDrawable", (bool(osg::Billboard::*)(osg::Drawable *, const osg::Vec3&)) &osg::Billboard::addDrawable, "Add Drawable to Billboard at position pos.\n" "If gset not NULL and is not contained in Billboard then increment its \n" "reference count, and dirty the bounding box to cause it to recompute on \n" "next getBound() and return true for success. Otherwise return false.\n") .def("removeDrawable", &osg::Billboard::removeDrawable, "Remove Drawable and associated position from Billboard.\n" "If gset is contained in Billboard then remove it from the geoset\n" "list and decrement its reference count, and dirty the \n" "bounding box to cause it to recompute on next getBound() and\n" "return true for success. If gset is not found then return false\n" "and do not the reference count of gset is left unchanged.") ; // TODO Not implemented yet : getPositionList (probably not needed) enum_ mode("Mode"); # define OSG_ENUM(VALUE) \ (mode.value(#VALUE, osg::Billboard::VALUE), \ billboard.def(#VALUE, object(osg::Billboard::VALUE))) OSG_ENUM(POINT_ROT_EYE); OSG_ENUM(POINT_ROT_WORLD); OSG_ENUM(AXIAL_ROT); scope(); } } // namespace PyOSG