home *** CD-ROM | disk | FTP | other *** search
- diff -c libshade/Makefile.SH libshade/Makefile.SH
- *** libshade/Makefile.SH Sun Feb 9 22:03:46 1992
- --- libshade/Makefile.SH Wed Feb 16 15:52:11 1994
- ***************
- *** 57,66 ****
- LIB = libshade.a
-
- SUPPORT_C = builtin.c symtab.c misc.c lightdef.c objdef.c options.c \
- ! stats.c surfdef.c
-
- SUPPORT_H = ../config.h datatypes.h funcdefs.h \
- ! ../patchlevel.h rayshade.h
-
- PARSE_C = yacc.c lex.c
-
- --- 57,66 ----
- LIB = libshade.a
-
- SUPPORT_C = builtin.c symtab.c misc.c lightdef.c objdef.c options.c \
- ! stats.c surfdef.c zbuf.c
-
- SUPPORT_H = ../config.h datatypes.h funcdefs.h \
- ! ../patchlevel.h rayshade.h zbuf.h
-
- PARSE_C = yacc.c lex.c
-
- diff -c libshade/misc.c libshade/misc.c
- *** libshade/misc.c Sun Feb 9 22:03:59 1992
- --- libshade/misc.c Wed Feb 16 15:42:42 1994
- ***************
- *** 36,42 ****
- --- 36,46 ----
- #endif
- #include "options.h"
- #include "stats.h"
- + #include "libcommon/common.h"
- + #include "viewing.h"
- + #include "zbuf.h"
-
- +
- Float RSabstmp; /* Temporary value used by fabs macro. Ugly. */
- static void RSmessage();
-
- ***************
- *** 88,93 ****
- --- 92,99 ----
- * Initialize symbol table.
- */
- SymtabInit();
- + if (Options.zbufprint)
- + zbuffer.rayfile = strsave (yyfilename);
- (void)yyparse();
- }
-
- diff -c libshade/options.c libshade/options.c
- *** libshade/options.c Sun Feb 9 22:04:09 1992
- --- libshade/options.c Wed Feb 16 15:43:00 1994
- ***************
- *** 239,244 ****
- --- 239,264 ----
- Options.crop_set = TRUE;
- argv += 4; argc -= 4;
- break;
- + case 'z':
- + Options.zbufprint = TRUE;
- + if (argv[1][0] == '-') {
- + /* User probably blew it, and
- + * it's difficult to remove a file
- + * that begins with '-'...
- + */
- + usage();
- + exit(2);
- + }
- + if (argv[0][2])
- + Options.zbufname = strsave (argv[0]+2);
- + else if (argv[1]) {
- + Options.zbufname = strsave(argv[1]);
- + argv++; argc--;
- + } else {
- + usage();
- + exit(2);
- + }
- + break;
- default:
- RLerror(RL_PANIC,"Bad argument: %s\n",argv[0]);
- }
- ***************
- *** 334,337 ****
- --- 354,358 ----
- fprintf(stderr,"\t-v \t\t(Verbose output.)\n");
- fprintf(stderr,"\t-W x x y y \t(Render subwindow.)\n");
- fprintf(stderr,"\t-X l r b t \t(Crop window.)\n");
- + fprintf(stderr,"\t-z filename\t(Write Z buffer to filename.)\n");
- }
- diff -c libshade/options.h libshade/options.h
- *** libshade/options.h Sun Feb 9 22:03:53 1992
- --- libshade/options.h Wed Feb 16 15:46:56 1994
- ***************
- *** 69,75 ****
- endframe, /* ending frame number */
- totalframes, /* total # of frames */
- totalframes_set, /* set on command line? */
- ! cpp; /* run CPP? */
- #ifdef URT
- int alpha; /* Write alpha channel? */
- int exp_output; /* Write exponential RLE file? */
- --- 69,76 ----
- endframe, /* ending frame number */
- totalframes, /* total # of frames */
- totalframes_set, /* set on command line? */
- ! cpp, /* run CPP? */
- ! zbufprint; /* print Zbuf stats? */
- #ifdef URT
- int alpha; /* Write alpha channel? */
- int exp_output; /* Write exponential RLE file? */
- ***************
- *** 88,94 ****
- *statsname, /* Name of stats file. */
- *imgname, /* Name of output image file */
- *inputname, /* Name of input file, NULL == stdin */
- ! *cppargs; /* arguments to pass to cpp */
- int window[2][2]; /* Subwindow corners */
- Float crop[2][2]; /* Crop window, lo/hi normalized */
- #ifdef LINDA
- --- 89,96 ----
- *statsname, /* Name of stats file. */
- *imgname, /* Name of output image file */
- *inputname, /* Name of input file, NULL == stdin */
- ! *cppargs, /* arguments to pass to cpp */
- ! *zbufname; /* Name of Z buffer file (if any) */
- int window[2][2]; /* Subwindow corners */
- Float crop[2][2]; /* Crop window, lo/hi normalized */
- #ifdef LINDA
- diff -c libshade/picture.c libshade/picture.c
- *** libshade/picture.c Sun Feb 9 22:04:06 1992
- --- libshade/picture.c Tue Feb 22 23:49:52 1994
- ***************
- *** 33,38 ****
- --- 33,39 ----
- #include "viewing.h"
- #include "options.h"
- #include "stats.h"
- + #include "zbuf.h"
-
- #ifdef URT
- unsigned char **outptr; /* Output buffer */
- ***************
- *** 131,136 ****
- --- 132,143 ----
- * lots of headers at the end of the file).
- */
- (void)fflush(rle_dflt_hdr.rle_file);
- + }
- +
- + if (Options.zbufprint) {
- + zbuffer.outfile = Options.imgname ?
- + strsave (Options.imgname) : NULL;
- + zbuffer.argv = argv;
- }
-
- if (rle_row_alloc(&rle_dflt_hdr, &outptr) < 0)
- diff -c libshade/setup.c libshade/setup.c
- *** libshade/setup.c Sun Feb 9 22:04:02 1992
- --- libshade/setup.c Wed Feb 16 15:44:12 1994
- ***************
- *** 114,119 ****
- --- 114,122 ----
- Options.workers = WORKERS;
- #endif
-
- + Options.zbufprint = FALSE;
- + Options.zbufname = NULL;
- +
- Options.totalframes = 1;
- Options.startframe = 0;
- Options.starttime = 0.;
- ***************
- *** 192,197 ****
- --- 195,202 ----
-
-
- LightSetup();
- + if (Options.zbufprint)
- + ZbufSetup();
- }
-
- void
- diff -c libshade/stats.c libshade/stats.c
- *** libshade/stats.c Sun Feb 9 22:04:00 1992
- --- libshade/stats.c Wed Feb 16 15:44:54 1994
- ***************
- *** 86,91 ****
- --- 86,93 ----
- fprintf(Stats.fstats,"Seconds / intersecting ray:\t%4.4f\n",
- (Stats.Utime + Stats.Stime)/(Float)Stats.HitRays);
- PrintMemoryStats(Stats.fstats);
- + if (Options.zbufprint)
- + ZbufPrint();
- }
-
- static void
- diff -c libshade/viewing.c libshade/viewing.c
- *** libshade/viewing.c Sun Feb 9 22:04:10 1992
- --- libshade/viewing.c Thu Feb 24 21:39:06 1994
- ***************
- *** 30,35 ****
- --- 30,36 ----
- #include "defaults.h"
- #include "picture.h"
- #include "stats.h"
- + #include "zbuf.h"
-
- RSCamera Camera;
- RSScreen Screen;
- ***************
- *** 89,94 ****
- --- 90,98 ----
- Screen.firstray.z -= 0.5*Screen.yres*Screen.scrny.z +
- 0.5*Screen.xres*Screen.scrnx.z;
-
- + /* Firstray now points to the lower left corner of the image plane,
- + if fixed at the eye position */
- +
- if (Camera.focaldist == UNSET)
- Camera.focaldist = Camera.lookdist;
- }
- ***************
- *** 281,293 ****
- dist = FAR_AWAY;
- hitlist.nodes = 0;
- (void)TraceRay(ray, &hitlist, EPSILON, &dist);
- ShadeRay(&hitlist, ray, dist, &Screen.background, &ctmp, &fullintens);
- color->r = ctmp.r;
- color->g = ctmp.g;
- color->b = ctmp.b;
- ! if (hitlist.nodes != 0) {
- ! color->alpha = 1.;
- ! } else {
- ! color->alpha = 0.;
- }
- }
- --- 285,305 ----
- dist = FAR_AWAY;
- hitlist.nodes = 0;
- (void)TraceRay(ray, &hitlist, EPSILON, &dist);
- +
- ShadeRay(&hitlist, ray, dist, &Screen.background, &ctmp, &fullintens);
- color->r = ctmp.r;
- color->g = ctmp.g;
- color->b = ctmp.b;
- ! if (hitlist.nodes != 0)
- ! {
- ! Float d = hitlist.data[hitlist.nodes-1].dist;
- !
- ! d *= dotp(&Camera.dir, &hitlist.data[hitlist.nodes-1].ray.dir);
- ! ZbufAdd (x, y, d); /* Save depth in Z buffer */
- ! color->alpha = 1.;
- ! }
- ! else
- ! {
- ! color->alpha = 0.;
- }
- }
-