proj home

Files   Classes   Functions   Hierarchy  

zpr.h

Go to the documentation of this file.
00001 #ifndef ZPR_H
00002 #define ZPR_H
00003 
00004 #include <cassert>
00005 #include <cmath>
00006 using namespace std;
00007 
00008 #include <GL/gl.h>
00009 
00010 #include <fnobj.h>
00011 #include <typedefs.h>
00012 
00013 
00014 
00015 
00074 class zpr
00075 {
00077   void motionzpr(intc x, intc y);
00079   void mousezpr(intc button, intc state, intc x, intc y);
00081   void reshapezpr(intc w, intc h);
00082 public:
00083 
00085   static zpr * global;
00086 
00088   GLdouble left;
00090   GLdouble right;
00092   GLdouble bottom;
00094   GLdouble top;
00096   GLdouble zNear;
00098   GLdouble zFar;
00099 
00101   int width;
00103   int height;
00104 
00107   zpr();
00108 
00110   void readModelView();
00113   void readProjection();
00115   void readScreenDimensions();
00117   void update()
00118   {
00119     readScreenDimensions();
00120     readModelView();
00121     readProjection();
00122   }
00123 
00125   void write();
00127   void writeDefault();
00131   void writefromXaxis();
00132 
00134   int  mouseX;
00136   int  mouseY;
00138   bool mouseLeft;
00140   bool mouseMiddle;
00142   bool mouseRight;
00143 
00145   GLdouble mouseXworld;
00147   GLdouble mouseYworld;
00149   GLdouble mouseZworld;
00150 
00152   GLdouble matrix[16];
00154   GLdouble matrixI[16];
00155 
00156 
00159   fnobj0<void>* mousecallback;
00160 
00162   static void motion(int x, int y);
00164   static void mouse(int button, int state, int x, int y);
00166   static void reshape(int width_, int height_);
00167 
00169   void readMouse
00170   (
00171     GLdouble *px,
00172     GLdouble *py,
00173     GLdouble *pz,
00174     intc x,
00175     intc y
00176   ) const;
00177 
00179   static double vlen(GLdouble x,GLdouble y,GLdouble z) 
00180     { return sqrt(x*x+y*y+z*z); }
00181 
00183   void printInfo() const;
00184 };
00185 
00195 class zprGLmatrix
00196 {
00197 public:
00198 
00200   GLdouble * matrix;
00201 
00203   zprGLmatrix(GLdouble* matrix_)
00204     : matrix(matrix_) {}
00205 
00207   GLdouble access( uintc r, uintc k) const
00208     { return matrix[4*k+r]; }
00209 
00211   static void invertMatrix(GLdouble *out, GLdouble const *m );
00212 
00214   static GLdouble zero;
00215 
00217   void print() const;
00219   void printTranspose() const;
00220 
00221 };
00222 
00223 
00224 #endif
00225 

Generated on Fri Mar 4 00:49:32 2011 for Chelton Evans Source by  doxygen 1.5.8