00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef OPENGL_MODULE_H
00029 #define OPENGL_MODULE_H
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include "FsfCell.h"
00043
00044
00045
00046 #ifdef GLUTIO_CARBON
00047 #include <OpenGL/gl.h>
00048 #include <OpenGL/glu.h>
00049 #include <OpenGL/OpenGL.h>
00050 #include <GLUT/glut.h>
00051 #endif
00052
00053 #ifdef GLUTIO_X11
00054 #include <GL/gl.h>
00055 #include <GL/glu.h>
00056 #include <GL/glx.h>
00057 #include <GL/glut.h>
00058 #endif
00059
00060 #ifdef GLUTIO_WIN32
00061 #include <windows.h>
00062 #include <GL/gl.h>
00063 #include <GL/glu.h>
00064 #include <glut.h>
00065 #endif
00066
00067 #include <iostream>
00068
00069 namespace ogl{
00070
00073
00076
00077
00079 void registerFactories();
00080
00084 class CCamera : public fsf::CNode {
00085 private:
00086 fsf::CMutex m_csCamera;
00087
00090
00091 double m_dX,m_dY,m_dZ;
00092 double m_dRefX,m_dRefY,m_dRefZ;
00093 double m_dUpX,m_dUpY,m_dUpZ;
00095
00097 double m_dNear;
00099 double m_dFar;
00100
00103
00104 double m_dLeft;
00105 double m_dRight;
00106 double m_dBottom;
00107 double m_dTop;
00108
00109
00110 public:
00112
00113
00114 CCamera() : CNode() {}
00116 CCamera(fsf::CNode *pParent, fsf::Time tTime=0) : CNode(pParent,tTime) {}
00118 CCamera(std::string &strName, fsf::CNode *pParent, fsf::Time tTime=0) : CNode(strName,pParent,tTime) {}
00120 CCamera(const CCamera &rhs);
00122 virtual fsf::CNode *clone() const { return new CCamera(*this); }
00123
00125
00127
00128
00129 CCamera& operator=(const CCamera&);
00130
00132 void lockCamera() { m_csCamera.lock(); }
00134 void unlockCamera() { m_csCamera.unlock(); }
00135
00137 void setX(double d) { m_dX=d; }
00139 void setY(double d) { m_dY=d; }
00141 void setZ(double d) { m_dZ=d; }
00142
00144 void setRefX(double d) { m_dRefX=d; }
00146 void setRefY(double d) { m_dRefY=d; }
00148 void setRefZ(double d) { m_dRefZ=d; }
00149
00151 void setUpX(double d) { m_dUpX=d; }
00153 void setUpY(double d) { m_dUpY=d; }
00155 void setUpZ(double d) { m_dUpZ=d; }
00156
00158 void setNearDistance(double dNear) { m_dNear=dNear; }
00160 void setFarDistance(double dFar) { m_dFar=dFar; }
00161
00163 void setLeft(double dLeft) { m_dLeft=dLeft; }
00165 void setRight(double dRight) { m_dRight=dRight; }
00167 void setBottom(double dBottom) { m_dBottom=dBottom; }
00169 void setTop(double dTop) { m_dTop=dTop; }
00170
00172 void frustum(){
00173 glFrustum(m_dLeft,m_dRight,m_dBottom,m_dTop,m_dNear,m_dFar);
00174 }
00176 void ortho(){
00177 glOrtho(m_dLeft,m_dRight,m_dBottom,m_dTop,m_dNear,m_dFar);
00178 }
00180 void lookAt(){
00181 gluLookAt(m_dX,m_dY,m_dZ,
00182 m_dRefX,m_dRefY,m_dRefZ,
00183 m_dUpX,m_dUpY,m_dUpZ);
00184 }
00186
00188
00189
00190 virtual void getTypeID(std::string &str) const { str.assign("OPENGL_CAMERA"); }
00191
00193 double getX() const { return m_dX; }
00195 double getY() const { return m_dY; }
00197 double getZ() const { return m_dZ; }
00198
00200 double getRefX() const { return m_dRefX; }
00202 double getRefY() const { return m_dRefY; }
00204 double getRefZ() const { return m_dRefZ; }
00205
00207 double getUpX() const { return m_dUpX; }
00209 double getUpY() const { return m_dUpY; }
00211 double getUpZ() const { return m_dUpZ; }
00212
00214 double getNearDistance() const { return m_dNear; }
00216 double getFarDistance() const { return m_dFar; }
00217
00219 double getLeft() const { return m_dLeft; }
00221 double getRight() const { return m_dRight; }
00223 double getBottom() const { return m_dBottom; }
00225 double getTop() const { return m_dTop; }
00227 };
00228
00229
00230 }
00231
00232 #endif // OPENGL_MODULE_H