| 51 |
} |
} |
| 52 |
|
|
| 53 |
void display(){ // called on glutPostRedisplay |
void display(){ // called on glutPostRedisplay |
| 54 |
int i, j, h, ioff, q; |
int i, h, ioff, q; |
| 55 |
float r, g, b, k, y; |
float r, g, b, k, y, j, tmp; |
| 56 |
double num, logmx, logmn; |
double num, logmx, logmn; |
| 57 |
char str[MAX]; |
char str[MAX]; |
| 58 |
|
|
| 91 |
} |
} |
| 92 |
} |
} |
| 93 |
|
|
| 94 |
if( scaledepth && xz || scaledepth && yz ) ymax=totaldepth; |
if( scaledepth && xz || scaledepth && yz ) ymax=NY; |
| 95 |
ioff=0; h=0; // ioff will count both i&j b/c data is 1D |
tmp=(float)ymax/totaldepth; |
| 96 |
for( j=0; j<ymax; j++ ){ // cycles through y values |
j=0; ioff=0; h=0; // ioff will count both i&j b/c data is 1D |
| 97 |
|
|
| 98 |
|
while ( j<ymax ){ // cycles through y values |
| 99 |
for( i=0; i<xmax; i++ ){ // cycles through x values |
for( i=0; i<xmax; i++ ){ // cycles through x values |
| 100 |
r=g=b=0; // set color values to black |
r=g=b=0; // set color values to black |
| 101 |
if( data[q][ioff]==0 ); // if data=0, values stay black |
if( data[q][ioff]==0 ); // if data=0, values stay black |
| 125 |
|
|
| 126 |
glColor3f( r, g, b ); // put r, g, b into effect |
glColor3f( r, g, b ); // put r, g, b into effect |
| 127 |
if( scaledepth && xz || scaledepth && yz ) |
if( scaledepth && xz || scaledepth && yz ) |
| 128 |
glRectf( i, j, i+1, j+depths[h] ); |
glRectf( i, j, i+1, j+(depths[h]*tmp) ); |
| 129 |
else |
else |
| 130 |
glRectf( i, j, i+1, j+1 ); // draws a square for data value |
glRectf( i, j, i+1, j+1 ); // draws a square for data value |
| 131 |
ioff++; |
ioff++; |
| 132 |
} |
} |
| 133 |
if( scaledepth && xz || scaledepth && yz ){ |
if( scaledepth && xz || scaledepth && yz ){ |
| 134 |
j+=depths[h]-1; |
j+=(depths[h]*tmp); |
| 135 |
h++; |
h++; |
| 136 |
} |
} |
| 137 |
|
else j++; |
| 138 |
} |
} |
| 139 |
|
|
| 140 |
glColor3f( 1, 1, 1 ); // set color to white |
glColor3f( 1, 1, 1 ); // set color to white |
| 219 |
|
|
| 220 |
void key( unsigned char key, int x, int y ){ // called on key press |
void key( unsigned char key, int x, int y ){ // called on key press |
| 221 |
int i, tmp; |
int i, tmp; |
| 222 |
|
char fn[MAX]; |
| 223 |
|
|
| 224 |
switch(key){ |
switch(key){ |
| 225 |
case 'q': exit(0); // quits on 'q' |
case 'q': exit(0); // quits on 'q' |
| 226 |
break; |
break; |
| 227 |
case 'r': count=0; // resets back to first time |
case 'r': count=0; // resets back to first time |
| 228 |
ilev=1; // and first level |
ilev=1; // and first level |
| 229 |
|
xz=yz=0; |
| 230 |
break; |
break; |
| 231 |
case 'a': anim=(anim+1)%2; // turns anim on/off |
case 'a': anim=(anim+1)%2; // turns anim on/off |
| 232 |
break; |
break; |
| 239 |
case 'z': if( xz || yz ){ |
case 'z': if( xz || yz ){ |
| 240 |
scaledepth=( scaledepth+1 )%2; |
scaledepth=( scaledepth+1 )%2; |
| 241 |
scalecount++; |
scalecount++; |
| 242 |
if( scalecount==1 ) |
if( scalecount==1 ){ |
| 243 |
readdepths( ".darwinview/depths" ); |
printf( "Please enter filename containing depth data: " ); |
| 244 |
|
scanf( "%s", fn ); |
| 245 |
|
readdepths( fn ); |
| 246 |
|
} |
| 247 |
} |
} |
| 248 |
break; |
break; |
| 249 |
} |
} |
| 429 |
FILE* fp; |
FILE* fp; |
| 430 |
int i, j; |
int i, j; |
| 431 |
|
|
| 432 |
fp=fopen( ".darwinview/jet.h", "r" ); // opens file containing values |
fp=fopen( "jet.dat", "r" ); // opens file containing values |
| 433 |
for( i=0; i<64; i++ ) // reads in 64 sets of r, g, b values |
for( i=0; i<64; i++ ) // reads in 64 sets of r, g, b values |
| 434 |
for( j=0; j<3; j++ ) |
for( j=0; j<3; j++ ) |
| 435 |
fscanf( fp, "%f", &jet[i][j] ); |
fscanf( fp, "%f", &jet[i][j] ); |
| 544 |
fclose( fp ); |
fclose( fp ); |
| 545 |
|
|
| 546 |
xmax=NX; ymax=NY; |
xmax=NX; ymax=NY; |
| 547 |
|
|
| 548 |
readjet(); // stores color values |
readjet(); // stores color values |
| 549 |
readnames( filename ); // gets list of filenames to read from |
readnames( filename ); // gets list of filenames to read from |
| 550 |
global(); // calculates max and min for all data |
global(); // calculates max and min for all data |