00001 /*************************************************************************** 00002 * callback class for motion blur * 00003 * the param globalData.odeConfig.motionPersistence determines * 00004 * the level of motion blur * 00005 * * 00006 ***************************************************************************/ 00007 /*************************************************************************** 00008 * Copyright (C) 2005-2011 LpzRobots development team * 00009 * Georg Martius <georg dot martius at web dot de> * 00010 * Frank Guettler <guettler at informatik dot uni-leipzig dot de * 00011 * Frank Hesse <frank at nld dot ds dot mpg dot de> * 00012 * Ralf Der <ralfder at mis dot mpg dot de> * 00013 * * 00014 * This program is free software; you can redistribute it and/or modify * 00015 * it under the terms of the GNU General Public License as published by * 00016 * the Free Software Foundation; either version 2 of the License, or * 00017 * (at your option) any later version. * 00018 * * 00019 * This program is distributed in the hope that it will be useful, * 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00022 * GNU General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU General Public License * 00025 * along with this program; if not, write to the * 00026 * Free Software Foundation, Inc., * 00027 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00028 * * 00029 ***************************************************************************/ 00030 #ifndef __MOTIONBLURCALLBACK_H 00031 #define __MOTIONBLURCALLBACK_H 00032 00033 #include <osgViewer/Viewer> 00034 #include "globaldata.h" 00035 00036 namespace lpzrobots { 00037 00038 /** a class that enables motion blur for the scenegraph 00039 * should be called in the main simulation loop 00040 */ 00041 class MotionBlurOperation: public osg::Operation 00042 { 00043 public: 00044 /** globalData.odeConfig.motionPersistence - determines the level of motion blur, 00045 * between 0.0 and 1.0, for example: 00046 * heavy motion blur is set by globalData.odeConfig.motionPersistance=0.25 00047 * light motuib blur is set by globalData.odeConfig.motionPersistence=0.1 00048 */ 00049 MotionBlurOperation(GlobalData& global): 00050 osg::Operation("MotionBlur",true), 00051 cleared_(false), 00052 persistence_(global.odeConfig.motionPersistence) 00053 { 00054 } 00055 00056 virtual void operator () (osg::Object* object); 00057 00058 private: 00059 bool cleared_; 00060 double t0_; 00061 double persistence_; 00062 }; 00063 00064 } // namespace 00065 00066 00067 #endif