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 by Robot Group Leipzig * 00009 * martius@informatik.uni-leipzig.de * 00010 * fhesse@informatik.uni-leipzig.de * 00011 * der@informatik.uni-leipzig.de * 00012 * frankguettler@gmx.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 * $Log: motionblurcallback.h,v $ 00030 * Revision 1.4 2008/09/11 15:24:01 martius 00031 * motioncallback resurrected 00032 * noContact substance 00033 * use slider center of the connecting objects for slider drawing 00034 * 00035 * Revision 1.2 2006/07/14 12:23:35 martius 00036 * selforg becomes HEAD 00037 * 00038 * Revision 1.1.2.1 2006/04/27 16:18:24 robot3 00039 * motionblurcallback for the simulation 00040 * 00041 * * 00042 ***************************************************************************/ 00043 #ifndef __MOTIONBLURCALLBACK_H 00044 #define __MOTIONBLURCALLBACK_H 00045 00046 #include <osgViewer/Viewer> 00047 #include "globaldata.h" 00048 00049 namespace lpzrobots { 00050 00051 /** a class that enables motion blur for the scenegraph 00052 * should be called in the main simulation loop 00053 */ 00054 class MotionBlurOperation: public osg::Operation 00055 { 00056 public: 00057 /** globalData.odeConfig.motionPersistence - determines the level of motion blur, 00058 * between 0.0 and 1.0, for example: 00059 * heavy motion blur is set by globalData.odeConfig.motionPersistance=0.25 00060 * light motuib blur is set by globalData.odeConfig.motionPersistence=0.1 00061 */ 00062 MotionBlurOperation(GlobalData& global): 00063 osg::Operation("MotionBlur",true), 00064 cleared_(false), 00065 persistence_(global.odeConfig.motionPersistence) 00066 { 00067 } 00068 00069 virtual void operator () (osg::Object* object); 00070 00071 private: 00072 bool cleared_; 00073 double t0_; 00074 double persistence_; 00075 }; 00076 00077 } // namespace 00078 00079 00080 #endif