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

adsosurf.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * $Id: adsosurf.h,v 1.9 2003/07/16 11:39:41 schou Exp $
00003  * Author: Jakob Schou Jensen <schou@sourceforge.net>
00004  * Licence: GPL
00005  *
00006  * Description: Adso surface
00007  *
00008  ****************************************************************************/
00009 
00015 #ifndef SURF_H
00016 #define SURF_H
00017 #include <stdlib.h>
00018 #include <adsobase.h>
00019 #include <GL/gl.h>
00020 #include <adsomath.h>
00021 #include <adsoheightmap.h>
00022 #include <adsobase.h>
00023 
00024 #define ADSO_DRAW_TRIANGLES 1
00025 #define ADSO_DRAW_WIREFRAME 2
00026 #define ADSO_DRAW_NORMALS 3
00027 #define ADSO_DRAW_COORDS 4
00028 
00029 
00030 // Draw Context
00031 class AdsoDC {
00032  public:
00033   float frustum[6][4];
00034   v3f viewDir;
00035   v3f viewPos;
00036   float viewAngle;
00037 
00038   void setFrustum();
00039   int checkBoundPoints(int count, v3f *points);
00040 
00041   AdsoDC(){
00042     viewDir = v3f(1.0,1.0,1.0);
00043     viewAngle = (float)M_PI;
00044   }
00045 };
00046 
00047 #define ADSOSURF_T1 0
00048 #define ADSOSURF_T2 1
00049 
00055 class AdsoSurf {
00056  public:
00063   int type; 
00064   int count; 
00065   int v_count; 
00066   int *offs; 
00067   int *len; 
00068   void *vl; 
00069 
00072   v3f cullNorm;
00073   float cullNormAngle;
00074   v3f *boundPoints;
00075   int nBoundPoints;
00077 
00078   //void *getTri(){ return &vl[0]; }
00079   int triCount(){ return len[0]; } 
00080 
00081   //void *getStrip(int i){ return &vl[i+1]; }
00082   int stripLen(int i){ return len[i+1]; } 
00083   int stripCount(){ return count-1; } 
00084 
00085   int verticeCount(){ return v_count; }
00086 
00087   void draw(int method, AdsoDC *dc);
00088 
00089   int load(FILE *file);
00090   int save(FILE *file);
00091 
00092   void init(int c, int s, int t){
00093     type = t;
00094     if(t==ADSOSURF_T2) vl = (void*)new vntt3f[s];
00095     else vl = (void*)new vnt3f[s];
00096     offs = new int[c];
00097     len = new int[c];
00098     count = c;
00099     v_count = s;
00100   }
00101 
00102   AdsoSurf(int c, int s, int t){
00103     type = t;
00104     if(t==ADSOSURF_T2) vl = (void*)new vntt3f[s];
00105     else vl = (void*)new vnt3f[s];
00106     offs = new int[c];
00107     len = new int[c];
00108     count = c;
00109     v_count = s;
00110     cullNorm = v3f(1.0,1.0,1.0); 
00111     cullNormAngle = (float)M_PI;
00112     boundPoints = 0;
00113     nBoundPoints = 0;
00114   }
00115 
00116   AdsoSurf(){
00117     type = ADSOSURF_T1;
00118     count = 0; 
00119     v_count = 0; 
00120     cullNorm = v3f(1.0,1.0,1.0); 
00121     cullNormAngle = (float)M_PI;
00122     boundPoints = 0;
00123     nBoundPoints = 0;
00124   }
00125 };
00126 
00138 class AdsoHierSurf {
00139  public:
00140   int count; 
00141   AdsoSurf *surf; 
00142   AdsoHeightMap *heightMap;
00143 
00144   void draw(int method, AdsoDC *dc);
00145 
00146   int load(FILE *file);
00147   int save(FILE *file);
00148 
00149   void setHeightMap(AdsoHeightMap *hm){
00150     heightMap = hm;
00151   }
00152 
00153   AdsoHierSurf(int surfCount) {
00154     surf = new AdsoSurf[surfCount];
00155     count = surfCount;
00156     heightMap = 0;
00157   }
00158 
00159   AdsoHierSurf(){count=0;surf=0;heightMap=0;}
00160 };
00161 
00167 class AdsoSurfBuild {
00168  public:
00169   Set<Set<vnt3f> *> strips;
00170   Set<vnt3f> tris;
00171   Set<v3f> boundPoints;
00172   v3f cullNorm;
00173   float cullNormAngle;
00174 
00175   AdsoSurfBuild(){};
00176 };
00177 
00178 #endif
00179 

Generated on Mon Jul 21 10:44:47 2003 for Rover by doxygen 1.3.2