00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00043 GLfloat fov;
00044 GLfloat aspect;
00045
00046
00047 GLfloat xMin, xMax;
00048 GLfloat yMin, yMax;
00049
00050
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
00080
00081
00082
00083 void setFOV(GLfloat);
00084 GLfloat getFOV();
00085 void setAspect(GLfloat);
00086
00087
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);
00099 void approach(GLfloat);
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