BarrierNode.h

00001 /***************************************************************************
00002  *   Copyright (c) 2010   Art Tevs                                         *
00003  *                                                                         *
00004  *   This library is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU Lesser General Public License as        *
00006  *   published by the Free Software Foundation; either version 3 of        *
00007  *   the License, or (at your option) any later version.                   *
00008  *                                                                         *
00009  *   This library is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU Lesse General Public License for more details.                    *
00013  *                                                                         *
00014  *   The full license is in LICENSE file included with this distribution.  *
00015  ***************************************************************************/
00016 #ifndef _C_BARRIER__H_
00017 #define _C_BARRIER__H_
00018 
00019 //-------------------------------------------------------------------------
00020 // Includes
00021 //-------------------------------------------------------------------------
00022 #include <osgPPU/Export.h>
00023 #include <osgPPU/Unit.h>
00024 #include <osg/NodeVisitor>
00025 #include <osg/Group>
00026 
00027 namespace osgPPU
00028 {
00029     /**
00030     * Helper class to block cycle traversion throught the nodes
00031     **/
00032     class BarrierNode : public osg::Node
00033     {
00034         public:
00035             BarrierNode() : osg::Node() {}
00036             ~BarrierNode(){}
00037     
00038             //! The barrier node do just block the traversion, hence childs are not traversed
00039             void traverse (osg::NodeVisitor &nv){}
00040     
00041             //! The barrier node do just block the traversion, hence childs are not traversed
00042             void ascend (osg::NodeVisitor &nv){}
00043 
00044             //! Since traversion is blocked, we should allow the computation of bounding sphere    
00045             inline osg::BoundingSphere  computeBound() const {return osg::BoundingSphere();}
00046 
00047             //! Get the node, which was previously the child
00048             inline osg::Node* getBlockedChild() { return _child; }
00049             inline const osg::Node* getBlockedChild() const { return _child; }
00050 
00051             //! Set child which is now blocked
00052             inline void setBlockedChild(osg::Node* child) { _child = child; }
00053             
00054             //! Get the node, which was previously the parent
00055             inline osg::Group* getBlockedParent() {return _parent;}
00056 
00057             //! Set parent which is now blocked
00058             inline void setBlockedParent(osg::Group* parent){_parent = parent;}
00059 
00060         private:
00061             osg::Node* _child;
00062             osg::Group* _parent;
00063     };
00064 
00065 }; // end namespace
00066 
00067 #endif

Back to Homepage of osgPPU

Copyright (C) 2008 by Art Tevs (LGPL)