| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /****************************************************************************** 00002 * VRS - The Virtual Rendering System 00003 * Copyright (C) 2003 Computer Graphics Systems Group at the 00004 * Hasso-Plattner-Institute (HPI), Potsdam, Germany. 00005 * 00006 * This library is free software; you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2.1 of the License, or (at 00009 * your option) any later version. This library is distributed in the hope 00010 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied 00011 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Lesser General Public License for more details. You should have received 00013 * a copy of the GNU Lesser+ General Public License along with this library; if 00014 * not, write to the FreeSoftware Foundation, Inc., 59 Temple Place, Suite 330, 00015 * Boston, MA, 02111-1307, USA. 00016 ******************************************************************************/ 00017 00018 // $Id: approachnavigation.h 6014 2007-08-09 07:51:16Z Konstantin_Baumann $ 00019 // $Date: 2007-08-09 09:51:16 +0200 (Thu, 09 Aug 2007) $ 00020 // $Revision: 6014 $ 00021 // $State$ 00022 // $Author: Konstantin_Baumann $ 00023 // 00024 // $Log$ 00025 // Revision 1.13 2005/01/03 01:43:10 klimetschek 00026 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00027 // - removed vrs.vcproj 00028 // minor things: 00029 // - added all glutexamples to vrs4glut.sln 00030 // - fixed some problems in glutexamples 00031 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00032 // 00033 // Revision 1.12 2004/10/28 14:16:00 basch 00034 // Class comment changed (Doxygen style) 00035 // 00036 // Revision 1.11 2004/09/06 16:14:52 buchholz 00037 // time synchronized with canvas clock 00038 // 00039 // Revision 1.10 2004/03/12 16:28:41 baumann 00040 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00041 // 00042 // Revision 1.9 2004/02/04 16:11:44 baumann 00043 // code cleanup 00044 // 00045 // Revision 1.8 2003/07/06 16:27:29 buchholz 00046 // Regular movements (onTimer() method) will now be executed multiple times or left out according to the current time. In this way, the movement speed does not longer depend on the regularity of time events. 00047 // 00048 // Revision 1.7 2003/07/04 09:53:50 baumgarten 00049 // removed lookAt (it's a member of the base class already) 00050 // 00051 // Revision 1.6 2003/04/09 15:11:09 buchholz 00052 // some comments added 00053 // 00054 // Revision 1.5 2003/02/24 13:22:55 buchholz 00055 // bugfix: added destructor, that sets the static "activeNavigation_" to 0. 00056 // 00057 // Revision 1.4 2003/02/24 12:45:20 buchholz 00058 // - handle return type changed to BehaviorNode::InvalidationHint 00059 // - added: "launch" feature for plane navigation 00060 // - some bugs fixed 00061 // - navigation conflict management (using common base class (navigation.h will follow) 00062 // 00063 // Revision 1.3 2003/02/24 10:05:57 baumann 00064 // changed return type of BehaviorNode::handle() and Manipulator::drag*() 00065 // from "int" to "BehaviorNode::InvalidationHint" 00066 // 00067 // Revision 1.2 2003/02/19 21:24:07 kirsch 00068 // cleaned up includes 00069 // 00070 // Revision 1.1 2003/02/19 15:13:26 buchholz 00071 // some navigation classes 00072 // 00073 00074 #ifndef VRS_SG_APPROACHNAVIGATION_H 00075 #define VRS_SG_APPROACHNAVIGATION_H 00076 00077 #include <vrs/sg/navigation.h> 00078 #include <vrs/vector.h> 00079 #include <vrs/sg/inputevent.h> 00080 #include <vrs/lookat.h> 00081 #include <vrs/sg/canvas.h> 00082 #include <vrs/directioninterpolator.h> 00083 #include <vrs/engine.h> 00084 #include <vrs/rayrequest.h> 00085 #include <vrs/sg/timeevent.h> 00086 #include <vrs/sg/inputevent.h> 00087 00088 namespace VRS { 00089 00090 00095 class VRS_CORE_API ApproachNavigation : public Navigation { 00096 00097 public: 00098 ApproachNavigation( 00099 const Vector& onPlane, 00100 double minHeight, 00101 double accelerate, 00102 LookAt* target, 00103 InputEvent::Button button, 00104 InputEvent::Modifier must_modifier = InputEvent::NoModifier, 00105 InputEvent::Modifier must_not_modifier = InputEvent::NoModifier 00106 ); 00115 virtual ~ApproachNavigation(); 00116 00117 void setNavMode(Navigation::NavMode mode); 00118 00119 void setAcceleration(double acceleration); 00120 double getAcceleration() const; 00126 virtual BehaviorNode::InvalidationHint dragStart(int x, int y, ButtonEvent*); 00127 virtual BehaviorNode::InvalidationHint dragMotion(int x, int y, MotionEvent*); 00128 virtual BehaviorNode::InvalidationHint dragEnd(int x, int y, ButtonEvent*); 00129 BehaviorNode::InvalidationHint onTimer(TimeEvent* e); 00130 virtual BehaviorNode::InvalidationHint handle(Event* e); 00132 00133 VRS_TYPEINFO(ApproachNavigation, Manipulator); 00134 00135 private: 00136 00137 void performRayRequest(int x, int y, Canvas* canv); 00138 00139 SO<DirectionInterpolator> interpol_; 00140 int doubleClickTimeout_; 00141 SO<RayRequest> request_; 00142 SO<Engine> engine_; 00143 int animProgress_; 00144 bool approaching_; 00145 00146 Vector onPlane_; 00147 Vector target_; 00148 double minHeight_; 00149 Vector direction_; 00150 double speed_; 00151 double acceleration_; 00152 double heightFactor_; 00153 00154 double minDist_; 00155 bool targetReached_; 00156 00157 double lastLambda_; 00158 double rotationSpeed_; 00159 double rotationAttenuation_; 00160 00161 double elapsedTime_; 00162 }; 00163 00164 00165 inline double ApproachNavigation::getAcceleration() const { return acceleration_; } 00166 00167 } // namespace VRS 00168 00169 #endif // VRS_SG_APPROACHNAVIGATION_H