// 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 "CollectOccludersVisitor.hpp" using namespace boost::python; namespace PyOSG { class_CollectOccludersVisitor * CollectOccludersVisitorClass = NULL; void init_CollectOccludersVisitor() { CollectOccludersVisitorClass = new class_CollectOccludersVisitor("CollectOccludersVisitor", "Visitor for type safe operations on osg::Node's.\n" "Based on GOF's Visitor pattern. The CollectOccludersVisitor \n" "is useful for developing type safe operations to nodes\n" "in the scene graph (as per Visitor pattern), and adds to this\n" "support for optional scene graph traversal to allow\n" "operations to be applied to whole scenes at once. The Visitor\n" "pattern uses a technique of double dispatch as a mechanism to\n" "called the appropriate apply(..) method of the CollectOccludersVisitor. To\n" "use this feature one must use the Node::accept(CollectOccludersVisitor) which\n" "is extended in each Node subclass, rather than the CollectOccludersVisitor\n" "apply directly. So use root->accept(myVisitor); instead of\n" "myVisitor.apply(*root). The later method will bypass the double\n" "dispatch and the appropriate CollectOccludersVisitor::apply(..) method will\n" "not be called.", no_init); scope nodevisitor_class(*CollectOccludersVisitorClass); (*CollectOccludersVisitorClass) //.def(init<>()) //.def(init()) //.def(init()) .def("reset", &osg::CollectOccludersVisitor::reset) .def("getDistanceToEyePoint", &osg::CollectOccludersVisitor::getDistanceToEyePoint) .def("getDistanceFromEyePoint", &osg::CollectOccludersVisitor::getDistanceFromEyePoint) #if 0 .def("setTraversalNumber", &osg::CollectOccludersVisitor::setTraversalNumber) .def("getTraversalNumber", &osg::CollectOccludersVisitor::getTraversalNumber) .def("setFrameStamp", &osg::CollectOccludersVisitor::setFrameStamp) .def("getFrameStamp", &osg::CollectOccludersVisitor::getFrameStamp, return_value_policy()) .def("setTraversalMask", &osg::CollectOccludersVisitor::setTraversalMask) .def("getTraversalMask", &osg::CollectOccludersVisitor::getTraversalMask) .def("setNodeMaskOverride", &osg::CollectOccludersVisitor::setNodeMaskOverride, "Set the NodeMaskOverride mask." "Used in validNodeMask() to determine whether to operate on a node or its " "subgraph, by OR'ing CollectOccludersVisitor::_nodeMaskOverride with the Node's own Node::_nodeMask." "Typically used to force on nodes which may have" "been switched off by their own Node::_nodeMask.*/" ) .def("getNodeMaskOverride", &osg::CollectOccludersVisitor::getNodeMaskOverride, "Get the NodeMaskOverride mask.*/" ) #endif #if 0 // FIXME Can't use because of private destructor of Node - need to fix .def("validNodeMask", &osg::CollectOccludersVisitor::validNodeMask, "Method to called by Node and its subclass' Node::accept() method, if the result is true" "to be used to cull operations of nodes and their subgraphs." "Return true if the result of a bit wise and of the CollectOccludersVisitor::_traversalMask" "with the bit or between NodeVistor::_nodeMaskOverride and the Node::_nodeMask." "default values for _traversalMask is 0xffffffff, _nodeMaskOverride is 0x0," "and osg::Node::_nodeMask is 0xffffffff. */" ) #endif #if 0 .def("setTraversalMode", &osg::CollectOccludersVisitor::setTraversalMode, "Set the traversal mode for Node::traverse() to use when " "deciding which children of a node to traverse. If a" "CollectOccludersVisitor has been attached via setTraverseVisitor()" "and the new mode is not TRAVERSE_VISITOR then the attached" "visitor is detached. Default mode is TRAVERSE_NONE.*/" ) .def("getTraversalMode", &osg::CollectOccludersVisitor::getTraversalMode, "Get the traversal mode.*/" ) .def("traverse", &osg::CollectOccludersVisitor::traverse, "Method for handling traversal of a nodes." "If you intend to use the visitor for actively traversing " "the scene graph then make sure the accept() methods call" "this method unless they handle traversal directly.*/" ) .def("pushOntoNodePath", &osg::CollectOccludersVisitor::pushOntoNodePath, "Method called by osg::Node::accept() method before" "a call the CollectOccludersVisitor::apply(..). The back of the list will," "therefore, be the current node being visited inside the apply(..)," "and the rest of the list will be the parental sequence of nodes " "from the top most node applied down the graph to the current node." "Note, the user does not typically call pushNodeOnPath() as it" "will be called automatically by the Node::accept() method.*/" ) .def("popFromNodePath", &osg::CollectOccludersVisitor::popFromNodePath, "Method callby osg::Node::accept() method after" "a call the CollectOccludersVisitor::apply(..)." "Note, the user does not typically call pushNodeOnPath() as it" "will be called automatically by the Node::accept() method.*/" ) .def("getNodePath", (osg::NodePath&(osg::CollectOccludersVisitor::*)())&osg::CollectOccludersVisitor::getNodePath, return_value_policy(), "Get the non const NodePath from the top most node applied down" "to the current Node being visited.*/" ) #endif // .def("getLocalToWorldMatrix", &osg::CollectOccludersVisitor::getLocalToWorldMatrix, // "Get the Local To World Matrix from the NodePath for specified Transform::Mode, and u.*/" // ) // .def("getWorldToLocalMatrix", &osg::CollectOccludersVisitor::getWorldToLocalMatrix, // "Get the World To Local Matrix from the NodePath for specified Transform::Mode.*/" // ) // .def("getEyePoint", &osg::CollectOccludersVisitor::getEyePoint) // .def("__str__", &CollectOccludersVisitor_str) // .def("__repr__", &CollectOccludersVisitor_repr) ; } } // namespace PyOSG