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