| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /********************************************************************** 00002 VRS - The Virtual Rendering System 00003 Copyright (C) 2001 Computer Graphics Systems Group at the 00004 Hasso-Plattner-Institute, Potsdam, Germany. 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 This library is distributed in the hope that it will be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 See the GNU Lesser General Public License for more details. 00013 You should have received a copy of the GNU Lesser+ General Public 00014 License along with this library; if not, write to the FreeSoftware 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA, 02111-1307, USA. 00016 **********************************************************************/ 00017 // $Id: lookatmanipulator.h 6014 2007-08-09 07:51:16Z Konstantin_Baumann $ 00018 // $Date: 2007-08-09 09:51:16 +0200 (Thu, 09 Aug 2007) $ 00019 // $Revision: 6014 $ 00020 // $State$ 00021 // $Author: Konstantin_Baumann $ 00022 // 00023 // $Log$ 00024 // Revision 1.24 2005/01/20 08:36:33 maass 00025 // add panning mode. Of course there is a panemanipulator as well, but this variant changes the lookat (the camera) directly. 00026 // 00027 // Revision 1.23 2005/01/03 01:43:10 klimetschek 00028 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00029 // - removed vrs.vcproj 00030 // minor things: 00031 // - added all glutexamples to vrs4glut.sln 00032 // - fixed some problems in glutexamples 00033 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00034 // 00035 // Revision 1.22 2004/10/28 14:16:01 basch 00036 // Class comment changed (Doxygen style) 00037 // 00038 // Revision 1.21 2004/03/12 16:28:41 baumann 00039 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00040 // 00041 // Revision 1.20 2004/01/19 11:43:58 baumann 00042 // serialization mechanism improved 00043 // 00044 // Revision 1.19 2004/01/19 07:28:03 baumann 00045 // serialization mechanism improved 00046 // 00047 // Revision 1.18 2003/11/07 14:19:25 kirsch 00048 // removed leading underscore from include guards 00049 // 00050 // Revision 1.17 2003/02/24 10:05:57 baumann 00051 // changed return type of BehaviorNode::handle() and Manipulator::drag*() 00052 // from "int" to "BehaviorNode::InvalidationHint" 00053 // 00054 // Revision 1.16 2002/10/07 12:13:06 kirsch 00055 // code cleanup 00056 // 00057 // Revision 1.15 2002/07/02 15:23:48 baumann 00058 // non-persistent containers now have the prefix NonPersistent, e.g. NonPersistentArray<T> 00059 // persistent containers now have no prefix, e.g. Array<T> 00060 // 00061 // Revision 1.14 2002/05/03 15:13:08 rozinat 00062 // persistency update: constructor 'protected' 00063 // 00064 // Revision 1.13 2002/04/24 20:31:25 rozinat 00065 // persistency update: changed Array to PersistentArray 00066 // 00067 // Revision 1.12 2002/03/04 12:04:17 kersting 00068 // directory structure changes 00069 // 00070 // Revision 1.11 2002/03/03 21:44:26 kosta 00071 // VRS_TYPEINFO-macro rewritten 00072 // 00073 // Revision 1.10 2002/02/19 10:34:20 kosta 00074 // undone all changes since 2002-02-15 00075 // 00076 // Revision 1.7 2002/02/05 07:48:26 kosta 00077 // new persistency macros: 00078 // VRS_SERIALIZABLE(CLASS_NAME); 00079 // VRS_SERIALIZABLE_ABSTRACT_CLASS(CLASS_NAME); 00080 // VRS_SERIALIZABLE_NO_SO_CLASS(CLASS_NAME) 00081 // 00082 // Revision 1.6 2002/02/04 13:07:19 kosta 00083 // VRS_SERIALIZABLE macros completely rewritten 00084 // 00085 // Revision 1.5 2002/01/15 16:25:55 kosta 00086 // macros rewritten for a better namespace support 00087 // 00088 // Revision 1.4 2001/11/13 16:36:31 kirsch 00089 // changed line feed to unix style (removed control-M) 00090 // 00091 // Revision 1.3 2001/07/13 08:57:42 kersting 00092 // enum name changes 00093 // 00094 // Revision 1.2 2001/07/04 13:44:00 kersting 00095 // changes due to InputEvent enumeration changes 00096 // 00097 // Revision 1.1.1.1 2001/06/08 08:09:21 kirsch 00098 // imported alpha-version by olli 00099 // 00100 00101 00102 #ifndef VRS_LOOKATMANIPULATOR_H 00103 #define VRS_LOOKATMANIPULATOR_H 00104 00105 #include <vrs/container/array.h> 00106 #include <vrs/lookat.h> 00107 #include <vrs/vector.h> 00108 #include <vrs/sg/manipulator.h> 00109 00110 namespace VRS { 00111 00113 class VRS_CORE_API LookAtManipulator : public Manipulator { 00114 00115 public: 00116 enum Mode { Examine, Peer, Zoom, Pane }; 00117 VRS_SERIALIZABLE_CLASS_ENUM(Mode); 00118 00119 LookAtManipulator( 00120 LookAt* target, 00121 Mode mode, 00122 InputEvent::Button button, 00123 InputEvent::Modifier must_modifier = InputEvent::NoModifier, 00124 InputEvent::Modifier must_not_modifier = InputEvent::NoModifier 00125 ); 00126 00127 void setLookAt(LookAt* lookatTf); 00128 LookAt* getLookAt() const; 00129 00130 void setMode(LookAtManipulator::Mode manipmode); 00131 LookAtManipulator::Mode getMode() const; 00136 void setSensitivity(int mode, double sensitivity); 00137 double getSensitivity(int mode) const; 00141 virtual BehaviorNode::InvalidationHint dragStart(int x, int y, ButtonEvent*); 00142 virtual BehaviorNode::InvalidationHint dragMotion(int x, int y, MotionEvent*); 00143 virtual BehaviorNode::InvalidationHint dragEnd(int x, int y, ButtonEvent*); 00147 VRS_TYPEINFO(LookAtManipulator, Manipulator); 00148 VRS_SERIALIZABLE(LookAtManipulator); 00149 00150 protected: 00151 LookAtManipulator(); 00153 00154 private: 00155 SO<LookAt> lookat_; 00156 SO<Array<double> > sensitivity_; 00157 LookAtManipulator::Mode mode_; 00158 00159 int currentX_; 00160 int currentY_; 00161 double azimuth_; 00162 double altitude_; 00163 double zoom_; 00164 Vector from_; 00165 Vector to_; 00166 Vector up_; 00167 Vector left_; 00168 00169 bool initialized_; 00170 }; 00171 00172 inline void LookAtManipulator::setLookAt(LookAt* l) { lookat_ = l; modified(); } 00173 inline LookAt* LookAtManipulator::getLookAt() const { return lookat_; } 00174 00175 inline void LookAtManipulator::setSensitivity(int i, double s) { (*sensitivity_)[i] = s; modified(); } 00176 inline double LookAtManipulator::getSensitivity(int i) const { return (*sensitivity_)[i]; } 00177 00178 } // namespace VRS 00179 00180 #endif // VRS_LOOKATMANIPULATOR_H