PicobgAgent.cpp

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 #include "StdAfx.h"
00024 #include "..\include\PicobgAgent.h"
00025 
00026 PicobgAgent::PicobgAgent(void): TimerAgent("PicobgAgent","ThreadedAgent",5)
00027 {
00028         _timestamp = 0;
00029 }
00030 
00031 PicobgAgent::~PicobgAgent(void)
00032 {
00033         
00034 }
00035 
00036 void PicobgAgent::onButtonDown()
00037 {
00038         /*ostringstream s;
00039         s << "OUT FF3D : point=("<<_position.x<<", "<<_position.y<<", "<<_position.z<<");";
00040                 MicoleAgent::sendMessage(s.str());*/
00041         _initPos = _position;
00042         _timestamp = getElapsedTime();
00043 }
00044 
00045 void PicobgAgent::onTimer()
00046 {
00047         if (_timestamp) {
00048 
00049                 ostringstream s;
00050 
00051                 Vec3f _finalPos = _initPos;
00052                 Vec3f deviation = Vec3f(0.1,0,0)* ((double)(getElapsedTime()-_timestamp)/1000);
00053 
00054                 _finalPos +=deviation;
00055 
00056 
00057                 s << "OUT FF3D : point=("<<_finalPos.x<<", "<<_finalPos.y<<", "<<_finalPos.z<<");";
00058                 //s << "OUT FF3D : sphere=("<<_finalPos.x<<", "<<_finalPos.y<<", "<<_finalPos.z<<", "<< 0.01 <<");";
00059                 //s << "OUT FF3D : line=(("<<_finalPos.x<<", "<<_finalPos.y<<", "<<_finalPos.z<<"),("<<(_finalPos.x+1)<<", "<<(_finalPos.y)<<", "<<_finalPos.z<<"));";
00060                 //s << "OUT FF3D : plan=(("<<_position.x<<", "<<_position.y<<", "<<_position.z<<"),("<<_grab.x<<", "<<_grab.y<<", "<<_grab.z<<"));";
00061                 //s << "OUT FF3D : disc=(("<<_position.x<<", "<<_position.y<<", "<<_position.z<<"),("<<_grab.x<<", "<<_grab.y<<", "<<_grab.z<<"),"<< 0.03 <<");";
00062                 MicoleAgent::sendMessage(s.str());
00063                 if ((getElapsedTime()-_timestamp)>2000) 
00064                 {
00065                         _timestamp = 0;
00066                         MicoleAgent::sendMessage("OUT FF3D : none;");
00067                 }
00068         }
00069 }

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