FF3DDeviceOutputAgent.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of Micole Architecture
00003  *
00004  * Copyright (C) 2007 Micole partners
00005  *
00006  * Micole Architecture is free software: you can redistribute it 
00007  * and/or modify it under the terms of the GNU Lesser General 
00008  * Public License as published by the Free Software Foundation, 
00009  * either version 3 of the License, or (at your option) any 
00010  * later version.
00011  *
00012  * Micole Architecture is distributed in the hope that it will be 
00013  * useful, * but WITHOUT ANY WARRANTY; without even the implied 
00014  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00015  * PURPOSE.  See the GNU Lesser General Public License for more 
00016  * details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with Micole Architecture.  If not, see
00020  * <http://www.gnu.org/licenses/>.
00021  */
00022 
00023 #ifndef FF3DDEVICEOUTPUTAGENT_H
00024 #define FF3DDEVICEOUTPUTAGENT_H
00025 #include "micolelib.h"
00026 
00027 #include <Child.h>
00028 #include "FF3DForceModel.h"
00029 #include "ReachinMicoleApplication.h"
00030 #include "MicoleAgent.h"
00031 #include "playback.h"
00032 
00074 class MICOLELIB_API FF3DDeviceOutputAgent : public Child, public MicoleAgent
00075 {
00076         public:
00081                 FF3DDeviceOutputAgent();
00082                 virtual ~FF3DDeviceOutputAgent();
00083                 Playback* pb;
00084                 FILE* log;
00085 
00092                 void setForceModel(FF3DForceModel * fm) 
00093                 {
00094                         if (_fm = fm) //dangerous code
00095                                 return;
00096                         if (_fm) //if _fm is not null
00097                         {
00098                                 //i that possible?
00099                                 delete(_fm);
00100                         }
00101                         _fm = fm;
00102 /*                      
00103                         //this code must be a joke:
00104                         if (fm != NULL)
00105                         {
00106                                 _fm = fm;
00107                         }
00108                         else
00109                         {
00110                                 _fm = NULL;
00111                         }*/
00112                 }
00113 
00117         struct FF3DDeviceOutputAgentCollider : public Collider
00118         {
00119                 FF3DDeviceOutputAgent *_parent;
00120 
00121                 virtual void collide( CollisionState *cs)
00122                 { 
00123                         Child::Collider::collide( cs ); 
00124                         //Vec3f haptic_position = cs->getFinger(); 
00125                         //if( haptic_position * haptic_position < 0.1 ) { 
00126                         if (_parent->_fm)
00127                                 cs->addAbsoluteLocalFM( _parent->_fm );
00128                                 //cs->addAbsoluteGlobalFM( _parent->_fm ); }
00129                 }
00130                         //} 
00131         };
00132 
00133         protected:
00137                 virtual void handlePointForceModel ( MicoleBus *app, int argc, const char **argv );
00141                 virtual void handleLinearForceModel ( MicoleBus *app, int argc, const char **argv );
00145                 virtual void handlePlanarForceModel ( MicoleBus *app, int argc, const char **argv );
00149                 virtual void handleNoForceModel ( MicoleBus *app, int argc, const char **argv );
00153                 virtual void handleSphericalForceModel ( MicoleBus *app, int argc, const char **argv );
00157                 virtual void handleDiscForceModel ( MicoleBus *app, int argc, const char **argv );
00161                 virtual void handlePicobHgForceModel ( MicoleBus *app, int argc, const char **argv );
00165                 virtual void handlePicobGForceModel ( MicoleBus *app, int argc, const char **argv );
00166 
00167         private:
00168                 FF3DForceModel * _fm; 
00169                 Transform * _transform; 
00170 }; // end of FF3D
00172 
00173 #endif

Generated on Tue Oct 16 17:10:42 2007 for Micole by  doxygen 1.4.7