/* Animationsgeneration fuer QJulia 1.0, in ANSI C */ /* V 0.11, 28.04.95 Mahmut Kursun */ #include #include int main(void) { FILE *fp=NULL; char output_name[255], batch_name[255], tgamap[255], temp[255]; int i, xpixel=100, ypixel=100, numberx=36; float qa=-0.44276404, qb=0.471041478, qc=0.0, qd=-0.371041778, nsurf=0.02, nqual=1.0, cx=0.0, cy=0.0, cz=0.0, xwid=3.0, ywid=3.0, yaw=0.0, pit=0.0, lx=-1.0, ly=-1.0, lz=-1.0, backtopa=0.1, backtopb=0.1, backtopc=0.0, backbota=0.5, backbotb=0.1, backbotc=0.1; printf ("Animationsgenerator fuer QJulia\n\n"); fprintf(stderr, "Enter the number of Frames: "); fscanf(stdin, "%d", &numberx); fprintf(stderr, "Enter up to 5 letters of the output file: "); fscanf(stdin, "%s", output_name); fprintf(stderr, "\nEnter the name of the batch file: "); fscanf(stdin, "%s", batch_name); fprintf(stderr, "\nEnter the name of the Tgamap [map08.tga]: "); fscanf(stdin, "%s", tgamap); for (i = 1; i <= numberx ; i++) { if (*output_name) { fclose(fp); sprintf(temp, "%s%3.3d.par", output_name, i); fp = fopen(temp, "w"); if (fp == NULL) { puts ("*** Can't open output file - parameter ***\n"); exit (2); } } else fp = stdout; fprintf (fp,"\nOUTPUT_TGAFILE sampl%3.3d.tga\n", i); fprintf (fp,"XWIDTH_PIXELS %d\n", xpixel); fprintf (fp,"YWIDTH_PIXELS %d\n", ypixel); fprintf (fp,"QUAT_CONSTANT %f %f %f %f\n", qa*(1.0 + i/180.0), qb*(-1.0 + i/180.0), qc, qd*(1.0 + i/180.0)); fprintf (fp,"NEAR_SURFACE %f \n", nsurf); fprintf (fp,"NEAR_QUALITY %f \n", nqual); fprintf (fp,"CENTER_POSITION %f %f %f \n", cx*(1.0+i/100.0), cy*(1.0+i/100.0), cz*(1.0+i/100.0)); fprintf (fp,"XWIDTH_REAL %f \n", xwid); fprintf (fp,"YWIDTH_REAL %f \n", ywid); fprintf (fp,"YAW_ANGLE %f \n", yaw+(360/numberx*i)); fprintf (fp,"PITCH_ANGLE %f \n", pit+(360/numberx*i)); fprintf (fp,"LIGHT_DIRECTION %f %f %f \n", lx, ly, lz); fprintf (fp,"BACKGROUND_TOP %f %f %f \n", backtopa, backtopb, backtopc); fprintf (fp,"BACKGROUND_BOTTOM %f %f %f \n", backbota, backbotb, backbotc); fprintf (fp,"SPHERICAL_TGAMAP %s \n END \n", tgamap); } fclose(fp); fp = fopen (batch_name, "a"); if (fp == NULL) { puts ("*** Can't open output file - batch ***"); exit (2); } for (i = 1 ; i < numberx+1; i++) { fprintf(fp,"qjulia %s%3.3d.par\n", output_name, i); } return 0; }