SWE
/import/home/rettenbs/src/SWE/src/opengl/camera.h
00001 #ifndef CAMERA_H
00002 #define CAMERA_H
00003 // =====================================================================
00004 // This file is part of SWE_CUDA (see file SWE_Block.cu for details).
00005 // 
00006 // Copyright (C) 2010,2011 Tobias Schnabel
00007 // Copyright (C) 2012      Sebastian Rettenberger
00008 // 
00009 // SWE_CUDA is free software: you can redristribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // SWE_CUDA is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with SWE_CUDA.  If not, see <http://www.gnu.org/licenses/>.
00021 // =====================================================================
00022 #include <SDL/SDL.h>
00023 #include <SDL/SDL_opengl.h>
00024 
00025 class Camera {
00026 public:
00027         Camera(const char* window_title);
00028         // Set modelview matrix
00029         void setCamera();
00030 
00031         // Change viewing properties
00032         void reset();
00033 
00034         void viewDistance( float viewDistance );
00035         void orient( float angX, float angY );
00036         void zoomIn( float scaleFactor );
00037         void zoomOut( float scaleFactor );
00038         void startPanning(int xPos, int yPos);
00039         void panning(int newX, int newY);
00040 
00041         // Update framebuffer
00042         void displayImage();
00043 
00044 private:
00045         float view_distance;
00046 
00047         // Position of the camera
00048         float cameraX;
00049         float cameraY;
00050         float cameraZ;
00051 
00052         // Position of the object
00053         GLdouble objectX;
00054         GLdouble objectY;
00055         GLdouble objectZ;
00056 
00057         // Zoom factor
00058         float zoomfactor;
00059         float angleX, angleY;
00060 
00061         // Helper variables
00062         unsigned int frames;
00063         unsigned int lastTime;
00064         unsigned int oldMouseX, oldMouseY;
00065         unsigned int newMouseX, newMouseY;
00066         
00067         // Window title
00068         const char* win_title;
00069         void rotateObject();
00070 };
00071 
00072 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends