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.2 2008/04/17 15:59:00 martius 00031 * OSG2 port finished 00032 * 00033 * Revision 1.1.2.1 2008/04/09 08:58:20 martius 00034 * motion blur moved to old stuff 00035 * 00036 * Revision 1.2 2006/07/14 12:23:35 martius 00037 * selforg becomes HEAD 00038 * 00039 * Revision 1.1.2.1 2006/04/27 16:18:24 robot3 00040 * motionblurcallback for the simulation 00041 * 00042 * * 00043 ***************************************************************************/ 00044 #ifndef __MOTIONBLURCALLBACK_H 00045 #define __MOTIONBLURCALLBACK_H 00046 00047 #include <osgProducer/OsgSceneHandler> 00048 #include "globaldata.h" 00049 00050 namespace lpzrobots { 00051 00052 /** a class that enables motion blur for the scenegraph 00053 * should be called in the main simulation loop 00054 */ 00055 class MotionBlurDrawCallback: public osgProducer::OsgSceneHandler::Callback 00056 { 00057 public: 00058 /** globalData.odeConfig.motionPersistence - determines the level of motion blur, 00059 * between 0.0 and 1.0, for example: 00060 * heavy motion blur is set by globalData.odeConfig.motionPersistance=0.25 00061 * light motuib blur is set by globalData.odeConfig.motionPersistence=0.1 00062 */ 00063 MotionBlurDrawCallback(GlobalData& global); 00064 00065 virtual void operator()(osgProducer::OsgSceneHandler &handler, Producer::Camera &camera); 00066 00067 private: 00068 bool cleared_; 00069 double t0_; 00070 double persistence_; 00071 GlobalData& globalData; // the global environment variables 00072 }; 00073 00074 } 00075 00076 #endif