#define TRUE 1 #define FALSE 0 /* Z bounds */ #define ZMAX 500.0 /* Farthest back things get */ #define ZMIN (-100.0) /* closest things get before perspective blows up */ #define ZDEPTH (ZMAX-ZMIN) /* length of total Z space */ #define ZSMALL (ZMIN+1.0) /* fudge factor to keep perspective in bounds */ /* total number of colors */ #define COLORS 256 /* Number of colors in ramp of a single star */ #define ZCOLS 32 /* Number of different color ramps */ #define ZRAMPS (COLORS/ZCOLS) /* number of stars */ int scount = 333; /* 3-D star positions */ double *x, *y, *z; /* Color of stars */ char *color; int sw, sh; double cenx,ceny; int total_frames = 50; make_ramp(int start, int colors, int rmax, int gmax, int bmax) { int i; for (i=0; i ZSMALL) { /* set color to match z */ SetColor(color[i]+(ZMAX-zz)*(ZCOLS/ZDEPTH)); zscale = -ZMIN/(zz-ZMIN); /* find perspective shrink factor */ Dot(cenx+x[i]*zscale,ceny+y[i]*zscale); } } } move_stars() /* Move all the stars towards viewer */ { int i; double dist = ZDEPTH/total_frames; for (i=0; i