1 #ifndef _GRAFIC_H 2 #define _GRAFIC_H 3 4 #define MAX_LIST 4 5 #define MAXISO 5 6 7 #define C_ON (1 << 0) 8 #define C_EDIT (1 << 1) 9 #define C_VOL (1 << 2) 10 #define C_UPDATE (1 << 3) 11 #define C_FREEZE (1 << 4) 12 #define C_CAP (1 << 5) 13 #define C_REDO (1 << 6) 14 #define C_HIDE (1 << 7) 15 16 /* view modes */ 17 #define S_BDRY (1<<0) 18 #define S_FILL (1<<1) 19 #define S_COLOR (1<<2) 20 #define S_MAP (1<<3) 21 #define S_MATERIAL (1<<4) 22 #define S_ALTITUDE (1<<5) 23 #define S_DISPL (1<<6) 24 25 #define MONO 0 26 #define LEFT 1 27 #define RIGHT 2 28 29 enum {WIRE = S_BDRY, 30 HIDDEN = S_BDRY + S_FILL, 31 DEPTH = S_BDRY + S_COLOR, 32 FILL = S_FILL + S_COLOR, 33 SHADED = S_BDRY + S_FILL + S_COLOR, 34 SIZEMAP= S_BDRY + S_FILL + S_MAP 35 }; 36 enum {LTria, LQuad, LTets, LHexa, LEdges, LPoint}; 37 enum {PERSPECTIVE, CAMERA, ORTHO}; 38 enum {X_AXIS=0, Y_AXIS, Z_AXIS}; 39 enum {VECTOR,CONE}; 40 41 /* items */ 42 #define S_AXIS (1<<0) 43 #define S_BOX (1<<1) 44 #define S_GRID (1<<2) 45 #define S_GEOM (1<<3) 46 #define S_ISO (1<<4) 47 #define S_PALETTE (1<<5) 48 #define S_NUMP (1<<6) 49 #define S_NUMF (1<<7) 50 51 /* type */ 52 #define S_FLAT (1<<0) /* render with facet normals */ 53 #define S_SCISSOR (1<<1) /* scissoring mode */ 54 #define S_FOLLOW (1<<2) /* picking mode */ 55 #define S_NORMAL (1<<3) 56 #define S_OPPOS (1<<4) 57 #define S_DECO (1<<5) 58 #define S_PATH (1<<6) 59 #define S_RESET (1<<7) 60 61 /* iso-values */ 62 #define MAX_ISO 5 63 #define S_ISOLINE (1<<1) 64 #define S_ISOSURF (1<<2) 65 #define S_STREAML (1<<3) 66 #define S_STREAMR (1<<4) 67 #define S_VECTOR (1<<5) 68 #define S_CRITP (1<<6) 69 #define S_PARTICLE (1<<7) 70 71 #define MAX_PRT 10 72 #define MAX_LST 1024 73 #define MAX_CPT 5000 74 #define HSIZ 0.03 75 76 77 typedef struct sperspective { 78 float fovy,depth; 79 float matrix[16],alpha,gamma; 80 int rubix,rubfx,rubiy,rubfy; 81 ubyte pmode,rubber; 82 } Persp; 83 typedef Persp * pPersp; 84 85 typedef struct triangle { 86 float a[3],b[3],c[3]; 87 float va,vb,vc; 88 float na[3],nb[3],nc[3]; 89 } triangle; 90 91 typedef struct material { 92 float amb[4],emi[4],dif[4],spe[4],shininess; 93 float ext[6]; 94 GLint list; 95 int depmat[MAX_LIST]; 96 int ref,sort; 97 char name[128]; 98 ubyte flag; 99 } Material ; 100 typedef Material * pMaterial; 101 102 typedef struct _cell { 103 int id; 104 int x,y; 105 float min,max; 106 float value; 107 float step; 108 char* info; 109 char* format; 110 } cell; 111 112 typedef struct transform { 113 float pos[3]; /* current mouse position */ 114 float angle,axis[3]; /* rotation angle + axis */ 115 float panx,pany,opanx,opany; /* screen translation */ 116 float matrix[16],oldmat[16]; /* transformation matrix */ 117 float rot[16],tra[16]; 118 int mstate,mbutton,manim; 119 } Transform; 120 typedef Transform * pTransform; 121 122 typedef struct cube { 123 pTransform cubetr; 124 float cmi[3],cma[3]; 125 ubyte active; 126 } Cube; 127 typedef Cube *pCube; 128 129 typedef struct clip { 130 pTransform cliptr; 131 double eqn[4]; 132 ubyte active; 133 } Clip; 134 typedef Clip *pClip; 135 136 137 typedef struct camera { 138 GLfloat eye[3]; /* Position of the camera */ 139 GLfloat speed[3],spmod,altinc; 140 int vecup; 141 } Camera; 142 typedef Camera * pCamera; 143 144 /* scene parameters */ 145 typedef struct sparam { 146 float back[4],line[4],edge[4],sunpos[4],clip[6]; 147 float cm,dpi,coeff,cumtim,cumpertime,maxtime,timdep,pertime,dt; 148 float eyesep,linewidth,isowidth,pointsize; 149 short xi,yi,xs,ys; 150 int nbmat; 151 char pscolor[10]; 152 ubyte sunp,linc,advtim,nbpart; 153 } Param; 154 155 /* trajectoire */ 156 typedef struct straj { 157 int np; 158 float *pt; 159 float *tg; 160 float sec; 161 GLuint tlist; 162 } Trajet; 163 164 /* streamlines */ 165 typedef struct sstream { 166 double size,norm; 167 float xmin,xmax,ymin,ymax,zmin,zmax; 168 float *listp; 169 float stpt[4][3],stcol[4]; 170 int stnp,stiso[4]; 171 short nbstl; 172 ubyte typtrack; 173 } Stream; 174 typedef Stream * pStream; 175 176 typedef struct strgrd { 177 pTransform strtr; 178 GLuint grid; 179 ubyte active; 180 } Strgrd; 181 typedef Strgrd * pStrgrd; 182 183 typedef struct spart { 184 double cb[4]; 185 float pos[MAX_PRT+1][3],col[MAX_PRT+1][3],size,norm,ct,step; 186 int nsdep,cur; 187 ubyte flag; 188 } Particle; 189 typedef Particle *pParticle; 190 191 192 typedef struct siso { 193 float val[MAXISO+2]; 194 float col[MAXISO+2]; 195 ubyte palette,ptyp; 196 } Iso; 197 198 typedef struct scene { 199 pTransform view; 200 pClip clip; 201 pCube cube; 202 pPersp persp; 203 pCamera camera; 204 pMaterial material; 205 pStream stream; 206 /*pStrgrd stg;*/ 207 Param par; 208 Trajet path; 209 Iso iso; 210 211 float dmin,dmax; /* scene size */ 212 float shrink; /* shrink value */ 213 float cx,cy,cz; /* center of scene */ 214 215 GLuint dlist[MAX_LIST]; /* display lists */ 216 GLuint mlist[MAX_LIST]; /* metric lists */ 217 GLuint ilist[MAX_LIST]; /* iso-surfaces */ 218 GLuint clist[MAX_LIST]; 219 GLuint cmlist[MAX_LIST]; /* clipped elts */ 220 GLuint vlist[MAX_LIST]; /* vector list */ 221 GLuint *slist,cplist; /* streamlines */ 222 GLuint glist,nlist; /* geometry lists */ 223 GLuint grid; 224 GLuint picklist; 225 226 int *matsort; 227 short idwin,idmesh; /* window, mesh id */ 228 short master,slave; 229 230 ubyte item; /* display items */ 231 ubyte mode; /* render mode */ 232 ubyte type; 233 ubyte isotyp; 234 ubyte picked; 235 } Scene; 236 typedef Scene * pScene; 237 238 239 #endif 240