00001 /*************************************************************************** 00002 * Copyright (C) 2005-2011 LpzRobots development team * 00003 * Georg Martius <georg dot martius at web dot de> * 00004 * Frank Guettler <guettler at informatik dot uni-leipzig dot de * 00005 * Frank Hesse <frank at nld dot ds dot mpg dot de> * 00006 * Ralf Der <ralfder at mis dot mpg dot de> * 00007 * * 00008 * This program is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU General Public License as published by * 00010 * the Free Software Foundation; either version 2 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program; if not, write to the * 00020 * Free Software Foundation, Inc., * 00021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00022 * * 00023 ***************************************************************************/ 00024 00025 #include <osgViewer/Viewer> 00026 #include <osg/Group> 00027 00028 namespace lpzrobots { 00029 00030 /** Viewer holds a single view on to a single scene 00031 that supports the rendering of offscreen RRT (render to texture) cameras 00032 at any time (without sync) 00033 */ 00034 class LPZViewer : public osgViewer::Viewer { 00035 public: 00036 00037 LPZViewer(); 00038 00039 LPZViewer(osg::ArgumentParser& arguments); 00040 00041 LPZViewer(const osgViewer::Viewer& viewer, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); 00042 00043 virtual ~LPZViewer(); 00044 00045 /// is there a need to do an offscreen rendering? 00046 bool needForOffScreenRendering(); 00047 00048 /** call this function to render the off screen scene. 00049 If no off screen nodes are supplied than nothing is done 00050 */ 00051 virtual void renderOffScreen(); 00052 00053 /** set the group that contains the offscreen scene (usually RTT cameras) 00054 If no group is set or the group is empty than nothing 00055 is done in renderOffscreen(); 00056 */ 00057 virtual void setOffScreenData(osg::Group* offscreen); 00058 00059 protected: 00060 virtual void offScreenRenderingTraversals(); 00061 osg::Group* offScreenGroup; 00062 00063 void lpzviewerConstructorInit(); 00064 00065 }; 00066 00067 }