|
KGLLib
|
00001 /* 00002 * Copyright (C) 2008 Rivo Laks <rivolaks@hot.ee> 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef KGLLIB_TRACKBALL_H 00019 #define KGLLIB_TRACKBALL_H 00020 00021 00022 #include "kgllib.h" 00023 00024 #include <Eigen/Geometry> 00025 00026 namespace KGLLib 00027 { 00028 class Camera; 00029 00030 class KGLLIB_EXTRAS_EXPORT TrackBall 00031 { 00032 public: 00033 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00034 00035 TrackBall(); 00036 virtual ~TrackBall(); 00037 00038 virtual void rotate(float dx, float dy); 00039 00040 Eigen::Vector3f transform(const Eigen::Vector3f& v) const; 00041 Camera transform(const Camera& c); 00042 00043 Eigen::Vector3f xAxis() const; 00044 Eigen::Vector3f yAxis() const; 00045 Eigen::Vector3f zAxis() const; 00046 00047 void rotateX(float degrees); 00048 void rotateY(float degrees); 00049 void rotateZ(float degrees); 00050 00051 void rotate(float degrees, Eigen::Vector3f axis); 00052 00053 protected: 00054 Eigen::Transform3f mMatrix; 00055 }; 00056 00057 } 00058 00059 #endif
1.7.4