Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

waterGL.h

Go to the documentation of this file.
00001 //***************************************************************************
00002 #ifndef WATERGL_H
00003 #define WATERGL_H
00004 //***************************************************************************
00005 #include <math.h>
00006 #include <stdio.h>
00007 #include <stdlib.h>
00008 #include <GL/glu.h>
00009 #ifdef __GNUG__
00010 #include <vector.h>
00011 using namespace std;
00012 #else
00013 #include <vector>
00014 #endif
00015 //***************************************************************************
00016 typedef struct _ImageRec {
00017                         unsigned short imagic;
00018                         unsigned short type;
00019                         unsigned short dim;
00020                         unsigned short xsize, ysize, zsize;
00021                         unsigned int min, max;
00022                         unsigned int wasteBytes;
00023                         char name[80];
00024                         unsigned long colorMap;
00025                         FILE *file;
00026                         unsigned char *tmp, *tmpR, *tmpG, *tmpB;
00027                         unsigned long rleEnd;
00028                         unsigned int *rowStart;
00029                         int *rowSize;
00030                 } ImageRec;
00031 //***************************************************************************
00032 class WaterGL
00033 {
00034 
00035         private:
00036                 int rgb;
00037                 int translate;
00038                 int mesh;
00039                 float ttrans[2];
00040                 float amplitude;
00041                 float freq;
00042                 float phase;
00043                 float xMove, yMove;
00044                 int ox, oy;
00045                 GLuint displayList;
00046                 GLuint waterTextureName;
00047 
00048         void bwtorgba(unsigned char *b,unsigned char *l,int n);
00049         void rgbtorgba(unsigned char *r,unsigned char *g,unsigned char *b,unsigned char *l,int n);
00050         void rgbatorgba(unsigned char *r,unsigned char *g,unsigned char *b,unsigned char *a,unsigned char *l,int n);
00051         void ConvertShort(unsigned short *array, unsigned int length);
00052         void ConvertUint(unsigned *array, unsigned int length);
00053         ImageRec *ImageOpen(char *fileName);
00054         void ImageClose(ImageRec *image);
00055         void ImageGetRow(ImageRec *image, unsigned char *buf, int y, int z);
00056 
00057         public:
00058                 WaterGL();
00059                 WaterGL(char *filename);
00060                 ~WaterGL();
00061                 void myInit(char *filename);
00062                 void ffunc(void) { freq *= 2.f; }
00063                 void Ffunc(void) { freq /= 2.f; }
00064                 void mfunc(void) { mesh ^= 1; }
00065                 void wire(void);
00066                 void up(void) { amplitude += .01; }
00067                 void down(void) { amplitude -= .01; }
00068                 void left(void) { phase -= .00001; }
00069                 void right(void) { phase += .00001; }
00070                 void draw_mesh(void);
00071                 void draw_mesh( vector<float> coords );
00072                 void set_speed( float xTrans, float yTrans );
00073 
00074                 void init(char *filename);
00075                 void animate(void);
00076                 void display(void);
00077                 void display( vector<float> coords );
00078                 unsigned *read_texture(char *name, int *width, int *height, int *components);
00079 };
00080 //***************************************************************************
00081 #endif // WATERGL_H
00082 //***************************************************************************

Generated on Sun Jun 16 17:36:42 2002 for Anirudh's Vortex-Wake Simulation Code by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001