Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

glcamera.h

00001 /***************************************************************************
00002                           glcamera.h  -  description
00003                              -------------------
00004     begin                : Tue May 13 2003
00005     copyright            : (C) 2003 by Jacques Gasselin de Richebourg
00006     email                : jacquesgasselin@hotmail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU Lesser General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef GLCAMERA_H
00019 #define GLCAMERA_H
00020 
00021 
00022 #include <GL/gl.h>
00023 #include <GL/glu.h>
00024 #include "gllocalcoordinatesystem.h"
00025 #include "glgeometricobject.h"
00026 #include "glsphere.h"
00027 #include "glcube.h"
00028 #include "glfrustrum.h"
00029 #include "glrendermode.h"
00030 
00035 namespace GLScene
00036 {
00037      
00038    class GLCamera: public GLLocalCoordinateSystem, public GLGeometricObject
00039    {
00040       bool perspective;
00041 
00042       //perspective values
00043       GLfloat fov;
00044       GLfloat aspect;
00045 
00046       //orthogonal values
00047       GLfloat xMin, xMax;
00048       GLfloat yMin, yMax;
00049 
00050       //z clipping planes
00051       GLfloat zFar, zNear;
00052       
00053       GLVector focusPoint;
00054       GeometryPtr viewVolume;
00055       
00056    public:
00057 
00058       SML_TAG(camera);
00059 
00060       static const bool ortho;
00061       static const bool persp;
00062       
00063       GLCamera(GLfloat);
00064       GLCamera(const GLCamera&);
00065       virtual ~GLCamera();
00066 
00067       virtual GLVector getVectorToFurthestPoint(const GLVector&)
00068       { return GLVector(0,0,0); }
00069       virtual GLVector getVectorToNearestPoint(const GLVector&)
00070       { return GLVector(0,0,0); }
00071 
00072       virtual bool intersection( GLGeometricObject* obj ) { return obj->intersection(viewVolume); };
00073       virtual bool inclusion( GLGeometricObject* ) { return false;};
00074       
00075       void compileVertexArray() { };
00076       void render( void ) { };
00077       void renderForSelection(GLuint&) { };
00078 
00079    //   void loadFromStream(std::istream&) {};
00080    //   void saveToStream(std::ostream&) {};
00081 
00082       //perspective values
00083       void setFOV(GLfloat);
00084       GLfloat getFOV();
00085       void setAspect(GLfloat);
00086       
00087       //ortogonal values
00088       void setXRange(GLfloat, GLfloat);
00089       void setYRange(GLfloat, GLfloat);
00090       
00091       void setZRange(GLfloat, GLfloat);
00092       
00093       GLVector& getFocusPoint();
00094       const GLVector& getFront();
00095       const GLVector& getUp();
00096       const GLVector& getSide();
00097 
00098       void zoom(GLfloat); // zoom in with fov
00099       void approach(GLfloat); // move closer to/farther from target
00100       void pan(GLfloat x, GLfloat y);
00101       void rotate(GLfloat p, GLfloat y, GLfloat r);
00102       void rotateAboutFocus(GLfloat p, GLfloat y, GLfloat r);
00103       void lookAt(GLVector pos);
00104 
00105       void setFocusPoint(const GLVector&);
00106       void setFrontAndUp(const GLVector&, const GLVector&);
00107       
00109       void setViewMode(bool);
00110       bool getViewMode();
00111 
00112       void use();
00113 
00114       private:
00115 
00116       void updateViewVolume();   
00117       
00118    };
00119 
00120 };
00121 
00122 #endif

Generated on Wed Feb 4 23:11:33 2004 by doxygen 1.3.3