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 <osgProducer/OsgSceneHandler> 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 MotionBlurDrawCallback: public osgProducer::OsgSceneHandler::Callback 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 MotionBlurDrawCallback(GlobalData& global); 00050 00051 virtual void operator()(osgProducer::OsgSceneHandler &handler, Producer::Camera &camera); 00052 00053 private: 00054 bool cleared_; 00055 double t0_; 00056 double persistence_; 00057 GlobalData& globalData; // the global environment variables 00058 }; 00059 00060 } 00061 00062 #endif