v21i016: A ray tracing program, Patch1

Rich Salz rsalz at uunet.uu.net
Thu Feb 8 07:53:26 AEST 1990


Submitted-by: Craig Kolb <craig at weedeater.math.yale.edu>
Posting-number: Volume 21, Issue 16
Archive-name: rayshade/patch1

System: rayshade version 3.0
Patch #: 1
Priority: MEDIUM-HIGH

Description:
	Fixed calculation of field of view in Stereo mode.

	When resolution/samples/etc. is set in the input file
	more than once, the last occurrence takes precedence.

	Moved atmospheric declarations to atmosphere.h to facilitate
	addition of new effects.

	Atmospheric effects are applied to background rays.

	Renamed several transformation routines to avoid name clashes
	when linking with external libraries.

	Statistics are now reported in Linda implementation.

	Added -w option to enable verbose worker output.

	Linda syntax is more up-to-date.


Fix:	From rn, say "| patch -p -N -d DIR", where DIR is your rayshade source
	directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
	If you don't have the patch program, apply the following by hand,
	or get patch (version 2.0, latest patchlevel).

	After patching:
		make depend
		make
		make install

	If patch indicates that patchlevel is the wrong version, you may need
	to apply one or more previous patches, or the patch may already
	have been applied.  See the patchlevel.h file to find out what has or
	has not been applied.  In any event, don't continue with the patch.

Index: src/patchlevel.h
Prereq: 0
1c1
< #define PATCHLEVEL 0
---
> #define PATCHLEVEL 1

Index: README
*** README.old	Mon Nov 20 13:10:11 1989
--- README	Mon Nov 20 13:10:12 1989
***************
*** 41,47
  for image manipulation and a library for reading/reading the toolkit's
  "RLE" format image files.  UTAH.BLURB is the "blurb" file from the latest
  distribution of the toolkit, which can be obtained via anonymous ftp from
! cs.utah.edu (128.110.4.21), weedeater.math.yale.edu (192.26.88.42),
  nl.cs.cmu.edu (128.22.222.56), and uunet.uu.net.  Also of interest is the
  "fbm" library, available from nl.cs.cmu.edu:/usr/mlm/ftp/fbm.tar.Z, which
  provides tools for converting Utah Raster RLE format images to/from other

--- 41,47 -----
  for image manipulation and a library for reading/reading the toolkit's
  "RLE" format image files.  UTAH.BLURB is the "blurb" file from the latest
  distribution of the toolkit, which can be obtained via anonymous ftp from
! cs.utah.edu (128.110.4.21), weedeater.math.yale.edu (130.132.23.17),
  nl.cs.cmu.edu (128.22.222.56), and uunet.uu.net.  Also of interest is the
  "fbm" library, available from nl.cs.cmu.edu:/usr/mlm/ftp/fbm.tar.Z, which
  provides tools for converting Utah Raster RLE format images to/from other

Index: TODO
*** TODO.old	Mon Nov 20 13:10:17 1989
--- TODO	Mon Nov 20 13:10:18 1989
***************
*** 28,32
  we test objects roughly in order.
  
  Improve handling of input files (error messages, #include directives, etc.).
- 
- Have workers pass statistics back to the supervisor.

--- 28,30 -----
  we test objects roughly in order.
  
  Improve handling of input files (error messages, #include directives, etc.).

Index: src/atmosphere.c
*** src/atmosphere.c.old	Mon Nov 20 13:10:29 1989
--- src/atmosphere.c	Mon Nov 20 13:10:31 1989
***************
*** 18,24
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: atmosphere.c,v 3.0 89/10/27 02:05:46 craig Exp $
   *
   * $Log:	atmosphere.c,v $
   * Revision 3.0  89/10/27  02:05:46  craig

--- 18,24 -----
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: atmosphere.c,v 3.0.1.1 89/11/16 20:38:39 craig Exp Locker: craig $
   *
   * $Log:	atmosphere.c,v $
   * Revision 3.0.1.1  89/11/16  20:38:39  craig
***************
*** 21,26
   * $Id: atmosphere.c,v 3.0 89/10/27 02:05:46 craig Exp $
   *
   * $Log:	atmosphere.c,v $
   * Revision 3.0  89/10/27  02:05:46  craig
   * Baseline for first official release.
   * 

--- 21,29 -----
   * $Id: atmosphere.c,v 3.0.1.1 89/11/16 20:38:39 craig Exp Locker: craig $
   *
   * $Log:	atmosphere.c,v $
+  * Revision 3.0.1.1  89/11/16  20:38:39  craig
+  * patch1: Changes to accommodate atmosphere.h.
+  * 
   * Revision 3.0  89/10/27  02:05:46  craig
   * Baseline for first official release.
   * 
***************
*** 30,35
  #include "typedefs.h"
  #include "constants.h"
  #include "funcdefs.h"
  
  Fog *GlobalFog;
  Mist *GlobalMist;

--- 33,39 -----
  #include "typedefs.h"
  #include "constants.h"
  #include "funcdefs.h"
+ #include "atmosphere.h"
  
  Fog *GlobalFog;
  Mist *GlobalMist;

Index: src/cone.c
*** src/cone.c.old	Mon Nov 20 13:10:36 1989
--- src/cone.c	Mon Nov 20 13:10:37 1989
***************
*** 18,24
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: cone.c,v 3.0 89/10/27 02:05:47 craig Exp $
   *
   * $Log:	cone.c,v $
   * Revision 3.0  89/10/27  02:05:47  craig

--- 18,24 -----
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: cone.c,v 3.0.1.1 89/11/18 14:08:09 craig Exp Locker: craig $
   *
   * $Log:	cone.c,v $
   * Revision 3.0.1.1  89/11/18  14:08:09  craig
***************
*** 21,26
   * $Id: cone.c,v 3.0 89/10/27 02:05:47 craig Exp $
   *
   * $Log:	cone.c,v $
   * Revision 3.0  89/10/27  02:05:47  craig
   * Baseline for first official release.
   * 

--- 21,29 -----
   * $Id: cone.c,v 3.0.1.1 89/11/18 14:08:09 craig Exp Locker: craig $
   *
   * $Log:	cone.c,v $
+  * Revision 3.0.1.1  89/11/18  14:08:09  craig
+  * patch1: Changes to reflect new names of transformation routines.
+  * 
   * Revision 3.0  89/10/27  02:05:47  craig
   * Baseline for first official release.
   * 
***************
*** 125,141
  	/*
  	 * Calculate rotation matrix to map from world space to cone space.
  	 */
! /*	if (equal(axis.z*axis.z, 1.)) {
! 		tmp.x = 0.;
! 		tmp.y = -axis.z;
! 		tmp.z = 0.;
! 	} else { */
! 		tmp.x = axis.y;
! 		tmp.y = -axis.x;
! 		tmp.z = 0.;
! 	/*} */
! 	rotate(trans, &tmp, acos(axis.z));
! 	translate(trans, &base);
  	cone->tantheta *= cone->tantheta;
  
  	return newobj;

--- 128,138 -----
  	/*
  	 * Calculate rotation matrix to map from world space to cone space.
  	 */
! 	tmp.x = axis.y;
! 	tmp.y = -axis.x;
! 	tmp.z = 0.;
! 	RS_rotate(trans, &tmp, acos(axis.z));
! 	RS_translate(trans, &base);
  	cone->tantheta *= cone->tantheta;
  
  	return newobj;

Index: src/cylinder.c
*** src/cylinder.c.old	Mon Nov 20 13:10:42 1989
--- src/cylinder.c	Mon Nov 20 13:10:43 1989
***************
*** 18,24
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: cylinder.c,v 3.0 89/10/27 02:05:48 craig Exp $
   *
   * $Log:	cylinder.c,v $
   * Revision 3.0  89/10/27  02:05:48  craig

--- 18,24 -----
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: cylinder.c,v 3.0.1.1 89/11/18 14:07:52 craig Exp Locker: craig $
   *
   * $Log:	cylinder.c,v $
   * Revision 3.0.1.1  89/11/18  14:07:52  craig
***************
*** 21,26
   * $Id: cylinder.c,v 3.0 89/10/27 02:05:48 craig Exp $
   *
   * $Log:	cylinder.c,v $
   * Revision 3.0  89/10/27  02:05:48  craig
   * Baseline for first official release.
   * 

--- 21,29 -----
   * $Id: cylinder.c,v 3.0.1.1 89/11/18 14:07:52 craig Exp Locker: craig $
   *
   * $Log:	cylinder.c,v $
+  * Revision 3.0.1.1  89/11/18  14:07:52  craig
+  * patch1: Changes to reflect new names of transformation routines.
+  * 
   * Revision 3.0  89/10/27  02:05:48  craig
   * Baseline for first official release.
   * 
***************
*** 81,88
  	dir.x = axis.y;
  	dir.y = -axis.x;
  	dir.z = 0.;
! 	rotate(trans, &dir, acos(axis.z));
! 	translate(trans, cent);
  
  	return newobj;
  }

--- 84,91 -----
  	dir.x = axis.y;
  	dir.y = -axis.x;
  	dir.z = 0.;
! 	RS_rotate(trans, &dir, acos(axis.z));
! 	RS_translate(trans, cent);
  
  	return newobj;
  }

Index: src/datatypes.h
*** src/datatypes.h.old	Mon Nov 20 13:10:46 1989
--- src/datatypes.h	Mon Nov 20 13:10:47 1989
***************
*** 18,24
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: datatypes.h,v 3.0 89/10/27 02:05:49 craig Exp $
   *
   * $Log:	datatypes.h,v $
   * Revision 3.0  89/10/27  02:05:49  craig

--- 18,24 -----
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: datatypes.h,v 3.0.1.1 89/11/16 20:41:39 craig Exp Locker: craig $
   *
   * $Log:	datatypes.h,v $
   * Revision 3.0.1.1  89/11/16  20:41:39  craig
***************
*** 21,26
   * $Id: datatypes.h,v 3.0 89/10/27 02:05:49 craig Exp $
   *
   * $Log:	datatypes.h,v $
   * Revision 3.0  89/10/27  02:05:49  craig
   * Baseline for first official release.
   * 

--- 21,29 -----
   * $Id: datatypes.h,v 3.0.1.1 89/11/16 20:41:39 craig Exp Locker: craig $
   *
   * $Log:	datatypes.h,v $
+  * Revision 3.0.1.1  89/11/16  20:41:39  craig
+  * patch1: Moved atmospheric declarations to atmosphere.h.
+  * 
   * Revision 3.0  89/10/27  02:05:49  craig
   * Baseline for first official release.
   * 
***************
*** 129,142
  	Trans *trans;		/* Transformation matrices. */
  	struct Texture *next;	/* Pointer to next texture. */
  } Texture;
- 
- typedef struct {
- 	Color color;
- 	double trans;
- } Fog;
- 
- typedef struct {
- 	Color color;		/* Mist color */
- 	Color trans;		/* R, G, B trans. */
- 	double scale, zero;	/* Height scale, start Z */
- } Mist;

--- 132,134 -----
  	Trans *trans;		/* Transformation matrices. */
  	struct Texture *next;	/* Pointer to next texture. */
  } Texture;

Index: src/hf.c
*** src/hf.c.old	Mon Nov 20 13:10:52 1989
--- src/hf.c	Mon Nov 20 13:10:53 1989
***************
*** 18,24
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: hf.c,v 3.0 89/10/27 02:05:51 craig Exp $
   *
   * $Log:	hf.c,v $
   * Revision 3.0  89/10/27  02:05:51  craig

--- 18,24 -----
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: hf.c,v 3.0.1.1 89/11/16 20:44:28 craig Exp Locker: craig $
   *
   * $Log:	hf.c,v $
   * Revision 3.0.1.1  89/11/16  20:44:28  craig
***************
*** 21,26
   * $Id: hf.c,v 3.0 89/10/27 02:05:51 craig Exp $
   *
   * $Log:	hf.c,v $
   * Revision 3.0  89/10/27  02:05:51  craig
   * Baseline for first official release.
   * 

--- 21,29 -----
   * $Id: hf.c,v 3.0.1.1 89/11/16 20:44:28 craig Exp Locker: craig $
   *
   * $Log:	hf.c,v $
+  * Revision 3.0.1.1  89/11/16  20:44:28  craig
+  * patch1: Fixed typos in code comments.
+  * 
   * Revision 3.0  89/10/27  02:05:51  craig
   * Baseline for first official release.
   * 
***************
*** 58,64
   *      |  \   |
   *      |   \  |
   *	|    \ |
!  *      |TRI2 \|	TRI2 == c-->a-->b-->d
   *      b------c
   */
  #define TRI1			1

--- 61,67 -----
   *      |  \   |
   *      |   \  |
   *	|    \ |
!  *      |TRI2 \|	TRI2 == c-->a-->b-->c
   *      b------c
   */
  #define TRI1			1
***************
*** 229,236
  	} else
  		hitpos = *pos;
  	/*
! 	 * Find out which cell "hitpoint" is in.  This could be
! 	 * causing problems!
  	 */
  	if (equal(hitpos.x, 1.))
  		hitpos.x -= EPSILON;

--- 232,238 -----
  	} else
  		hitpos = *pos;
  	/*
! 	 * Find out in which cell "hitpoint" is.
  	 */
  	if (equal(hitpos.x, 1.))
  		hitpos.x -= EPSILON;

Index: src/input_yacc.y
*** src/input_yacc.y.old	Mon Nov 20 13:10:58 1989
--- src/input_yacc.y	Mon Nov 20 13:10:59 1989
***************
*** 17,23
  /* name of the person performing the modification, the date of modification,*/
  /* and the reason for such modification.				    */
  /*									    */
! /* $Id: input_yacc.y,v 3.0 89/10/27 02:05:53 craig Exp $ */
  %{
  #include <stdio.h>
  #include "constants.h"

--- 17,23 -----
  /* name of the person performing the modification, the date of modification,*/
  /* and the reason for such modification.				    */
  /*									    */
! /* $Id: input_yacc.y,v 3.0.1.3 89/11/20 13:05:33 craig Exp Locker: craig $ */
  %{
  #include <stdio.h>
  #include "constants.h"
***************
*** 24,29
  #include "typedefs.h"
  #include "funcdefs.h"
  #include "texture.h"
  
  int Npoints=0, CurXSize, CurYSize, CurZSize;
  Object *LastObj = (Object *)0;

--- 24,30 -----
  #include "typedefs.h"
  #include "funcdefs.h"
  #include "texture.h"
+ #include "atmosphere.h"
  
  int Npoints=0, CurXSize, CurYSize, CurZSize;
  Object *LastObj = (Object *)0;
***************
*** 36,41
  extern Object *World;
  extern int WorldXSize, WorldYSize, WorldZSize, nlight, Xres, Yres, maxlevel;
  extern int yylineno, Jittered, JitSamples, pixel_div;
  extern double hfov, vfov, RedContrast, GreenContrast, BlueContrast;
  extern double TreeCutoff;
  extern Vector eyep, lookp, up;

--- 37,44 -----
  extern Object *World;
  extern int WorldXSize, WorldYSize, WorldZSize, nlight, Xres, Yres, maxlevel;
  extern int yylineno, Jittered, JitSamples, pixel_div;
+ extern int ResolutionSet, ContrastSet, SamplesSet, CutoffSet;
+ extern int AdaptiveSet, JitteredSet;
  extern double hfov, vfov, RedContrast, GreenContrast, BlueContrast;
  extern double TreeCutoff;
  extern Vector eyep, lookp, up;
***************
*** 354,360
  		{
  			if (CurTrans == (TransInfo *)0)
  				CurTrans = new_transinfo();
! 			translate(CurTrans, &($2));
  		}
  		| tROTATE Vector Fnumber
  		{

--- 357,363 -----
  		{
  			if (CurTrans == (TransInfo *)0)
  				CurTrans = new_transinfo();
! 			RS_translate(CurTrans, &($2));
  		}
  		| tROTATE Vector Fnumber
  		{
***************
*** 361,367
  			if (CurTrans == (TransInfo *)0)
  				CurTrans = new_transinfo();
  
! 			rotate(CurTrans, &($2), deg2rad($3));
  		}
  		| tSCALE Fnumber Fnumber Fnumber
  		{

--- 364,370 -----
  			if (CurTrans == (TransInfo *)0)
  				CurTrans = new_transinfo();
  
! 			RS_rotate(CurTrans, &($2), deg2rad($3));
  		}
  		| tSCALE Fnumber Fnumber Fnumber
  		{
***************
*** 367,373
  		{
  			if (CurTrans == (TransInfo *)0)
  				CurTrans = new_transinfo();
! 			scale(CurTrans, $2, $3, $4);
  		}
  		| tTRANSFORM Fnumber Fnumber Fnumber
  				Fnumber Fnumber Fnumber

--- 370,376 -----
  		{
  			if (CurTrans == (TransInfo *)0)
  				CurTrans = new_transinfo();
! 			RS_scale(CurTrans, $2, $3, $4);
  		}
  		| tTRANSFORM Fnumber Fnumber Fnumber
  				Fnumber Fnumber Fnumber
***************
*** 422,428
  		;
  Samples		: tSAMPLES tINT
  		{
! 			if (JitSamples == UNSET)
  				JitSamples = $2;
  		}
  		;

--- 425,431 -----
  		;
  Samples		: tSAMPLES tINT
  		{
! 			if (!SamplesSet)
  				JitSamples = $2;
  		}
  		;
***************
*** 428,434
  		;
  Adaptive	: tADAPTIVE tINT
  		{
! 			if (pixel_div == UNSET && !Jittered)
  				pixel_div = $2;
  		}
  		;

--- 431,437 -----
  		;
  Adaptive	: tADAPTIVE tINT
  		{
! 			if (!AdaptiveSet && !JitteredSet)
  				pixel_div = $2;
  		}
  		;
***************
*** 434,442
  		;
  Contrast	: tCONTRAST Fnumber Fnumber Fnumber
  		{
! 			if (RedContrast == UNSET ||
! 			    GreenContrast == UNSET ||
! 			    BlueContrast == UNSET) {
  				RedContrast = $2;
  				GreenContrast = $3;
  				BlueContrast = $4;

--- 437,443 -----
  		;
  Contrast	: tCONTRAST Fnumber Fnumber Fnumber
  		{
! 			if (!ContrastSet) {
  				RedContrast = $2;
  				GreenContrast = $3;
  				BlueContrast = $4;
***************
*** 445,451
  		;
  Cutoff		: tCUTOFF Fnumber
  		{
! 			if (TreeCutoff == UNSET)
  				TreeCutoff = $2;
  		}
  		;

--- 446,452 -----
  		;
  Cutoff		: tCUTOFF Fnumber
  		{
! 			if (!CutoffSet)
  				TreeCutoff = $2;
  		}
  		;
***************
*** 451,457
  		;
  Jittered	: tJITTERED
  		{
! 			if (pixel_div == UNSET)
  				Jittered = TRUE;
  		}
  		;

--- 452,458 -----
  		;
  Jittered	: tJITTERED
  		{
! 			if (!AdaptiveSet)
  				Jittered = TRUE;
  		}
  		;
***************
*** 457,463
  		;
  Screen		: tSCREEN tINT tINT
  		{
! 			if (Xres == UNSET || Yres == UNSET) {
  				Xres = $2;
  				Yres = $3;
  			}

--- 458,464 -----
  		;
  Screen		: tSCREEN tINT tINT
  		{
! 			if (!ResolutionSet) {
  				Xres = $2;
  				Yres = $3;
  			}
***************
*** 464,470
  		}
  		| tRESOLUTION tINT tINT
  		{
! 			if (Xres == UNSET || Yres == UNSET) {
  				Xres = $2;
  				Yres = $3;
  			}

--- 465,471 -----
  		}
  		| tRESOLUTION tINT tINT
  		{
! 			if (!ResolutionSet) {
  				Xres = $2;
  				Yres = $3;
  			}

Index: src/main.c
*** src/main.c.old	Mon Nov 20 13:11:04 1989
--- src/main.c	Mon Nov 20 13:11:05 1989
***************
*** 1,5
  char rcsid[] =
! 	"$Id: main.c,v 3.0 89/10/27 17:05:45 craig Exp $";
  /*
   * main.c
   *

--- 1,5 -----
  char rcsid[] =
! 	"$Id: main.c,v 3.0.1.1 89/11/16 18:28:21 craig Exp Locker: craig $";
  /*
   * main.c
   *
***************
*** 21,26
   * and the reason for such modification.
   *
   * $Log:	main.c,v $
   * Revision 3.0  89/10/27  17:05:45  craig
   * Baseline for first official release.
   * 

--- 21,29 -----
   * and the reason for such modification.
   *
   * $Log:	main.c,v $
+  * Revision 3.0.1.1  89/11/16  18:28:21  craig
+  * patch1: Statistics are now reported in Linda implementation.
+  * 
   * Revision 3.0  89/10/27  17:05:45  craig
   * Baseline for first official release.
   * 
***************
*** 49,54
  		BVTests,	/* # of bounding volume tests. */
  		SuperSampled;	/* # of supersampled pixels. */
  double		ftmp;		/* Used by fabs() macro. */
  FILE		*fstats;	/* Statistics file */
  
  /*

--- 52,58 -----
  		BVTests,	/* # of bounding volume tests. */
  		SuperSampled;	/* # of supersampled pixels. */
  double		ftmp;		/* Used by fabs() macro. */
+ double		utime, stime;	/* user, system CPU time */
  FILE		*fstats;	/* Statistics file */
  
  /*
***************
*** 62,68
  int argc;
  char **argv;
  {
- 	double utime, stime;
  	unsigned long TotalRays;
  	extern int Verbose, Cache;
  	extern unsigned long CacheWorked, CacheFailed, ShadowHits;

--- 66,71 -----
  int argc;
  char **argv;
  {
  	unsigned long TotalRays;
  	extern int Verbose, Cache, Workers, Jittered;
  	extern unsigned long CacheWorked, CacheFailed, ShadowHits;
***************
*** 64,70
  {
  	double utime, stime;
  	unsigned long TotalRays;
! 	extern int Verbose, Cache;
  	extern unsigned long CacheWorked, CacheFailed, ShadowHits;
  
  	/*

--- 67,73 -----
  char **argv;
  {
  	unsigned long TotalRays;
! 	extern int Verbose, Cache, Workers, Jittered;
  	extern unsigned long CacheWorked, CacheFailed, ShadowHits;
  
  	/*
***************
*** 116,122
  	 * Close the image file.
  	 */
  	endpic();
! 
  	get_cpu_time(&utime, &stime);
  
  #ifndef LINDA

--- 119,125 -----
  	 * Close the image file.
  	 */
  	endpic();
! #ifndef LINDA
  	get_cpu_time(&utime, &stime);
  #endif
  
***************
*** 118,123
  	endpic();
  
  	get_cpu_time(&utime, &stime);
  
  #ifndef LINDA
  	TotalRays = EyeRays + ShadowRays + ReflectRays + RefractRays;

--- 121,127 -----
  	endpic();
  #ifndef LINDA
  	get_cpu_time(&utime, &stime);
+ #endif
  
  	TotalRays = EyeRays + ShadowRays + ReflectRays + RefractRays;
  	ShadowHits += CacheWorked;
***************
*** 119,125
  
  	get_cpu_time(&utime, &stime);
  
- #ifndef LINDA
  	TotalRays = EyeRays + ShadowRays + ReflectRays + RefractRays;
  	ShadowHits += CacheWorked;
  	HitRays += ShadowHits;

--- 123,128 -----
  	get_cpu_time(&utime, &stime);
  #endif
  
  	TotalRays = EyeRays + ShadowRays + ReflectRays + RefractRays;
  	ShadowHits += CacheWorked;
  	HitRays += ShadowHits;
***************
*** 123,128
  	TotalRays = EyeRays + ShadowRays + ReflectRays + RefractRays;
  	ShadowHits += CacheWorked;
  	HitRays += ShadowHits;
  	fprintf(fstats,"Eye rays:\t\t\t%ld\n", EyeRays);
  	fprintf(fstats,"Shadow rays:\t\t\t%ld\n",ShadowRays);
  	fprintf(fstats,"Reflected rays:\t\t\t%ld\n",ReflectRays);

--- 126,134 -----
  	TotalRays = EyeRays + ShadowRays + ReflectRays + RefractRays;
  	ShadowHits += CacheWorked;
  	HitRays += ShadowHits;
+ #ifdef LINDA
+ 	fprintf(fstats,"Workers:\t\t\t%d\n",Workers);
+ #endif
  	fprintf(fstats,"Eye rays:\t\t\t%ld\n", EyeRays);
  	fprintf(fstats,"Shadow rays:\t\t\t%ld\n",ShadowRays);
  	fprintf(fstats,"Reflected rays:\t\t\t%ld\n",ReflectRays);
***************
*** 138,144
  		fprintf(fstats,"Total shadow hits:\t\t%ld (%3.3f%%)\n",
  			ShadowHits, 100.*(float)ShadowHits / (float)ShadowRays);
  	}
! 	fprintf(fstats,"Supersampled pixels:\t\t%ld\n",SuperSampled);
  	fprintf(fstats,"B.V. intersection tests:\t%ld\n", BVTests);
  	print_prim_stats();
  #endif

--- 144,151 -----
  		fprintf(fstats,"Total shadow hits:\t\t%ld (%3.3f%%)\n",
  			ShadowHits, 100.*(float)ShadowHits / (float)ShadowRays);
  	}
! 	if (!Jittered)
! 		fprintf(fstats,"Supersampled pixels:\t\t%ld\n",SuperSampled);
  	fprintf(fstats,"B.V. intersection tests:\t%ld\n", BVTests);
  	print_prim_stats();
  #ifdef LINDA
***************
*** 141,147
  	fprintf(fstats,"Supersampled pixels:\t\t%ld\n",SuperSampled);
  	fprintf(fstats,"B.V. intersection tests:\t%ld\n", BVTests);
  	print_prim_stats();
! #endif
  	fprintf(fstats,"Total CPU time (sec):\t\t");
  	fprintf(fstats,"%2.2lf (%2.2lfu + %2.2lfs)\n",utime+stime, utime, stime);
  #ifndef LINDA

--- 148,156 -----
  		fprintf(fstats,"Supersampled pixels:\t\t%ld\n",SuperSampled);
  	fprintf(fstats,"B.V. intersection tests:\t%ld\n", BVTests);
  	print_prim_stats();
! #ifdef LINDA
! 	fprintf(fstats,"Average CPU time/processor:\t");
! #else
  	fprintf(fstats,"Total CPU time (sec):\t\t");
  #endif
  	fprintf(fstats,"%2.2lf (%2.2lfu + %2.2lfs)\n",utime+stime, utime, stime);
***************
*** 143,148
  	print_prim_stats();
  #endif
  	fprintf(fstats,"Total CPU time (sec):\t\t");
  	fprintf(fstats,"%2.2lf (%2.2lfu + %2.2lfs)\n",utime+stime, utime, stime);
  #ifndef LINDA
  	if (TotalRays != 0.)

--- 152,158 -----
  	fprintf(fstats,"Average CPU time/processor:\t");
  #else
  	fprintf(fstats,"Total CPU time (sec):\t\t");
+ #endif
  	fprintf(fstats,"%2.2lf (%2.2lfu + %2.2lfs)\n",utime+stime, utime, stime);
  	if (TotalRays != 0.)
  		fprintf(fstats,"Seconds / ray:\t\t\t%4.4lf\n",
***************
*** 144,150
  #endif
  	fprintf(fstats,"Total CPU time (sec):\t\t");
  	fprintf(fstats,"%2.2lf (%2.2lfu + %2.2lfs)\n",utime+stime, utime, stime);
- #ifndef LINDA
  	if (TotalRays != 0.)
  		fprintf(fstats,"Seconds / ray:\t\t\t%4.4lf\n",
  				(utime + stime) / (double)TotalRays);

--- 154,159 -----
  	fprintf(fstats,"Total CPU time (sec):\t\t");
  #endif
  	fprintf(fstats,"%2.2lf (%2.2lfu + %2.2lfs)\n",utime+stime, utime, stime);
  	if (TotalRays != 0.)
  		fprintf(fstats,"Seconds / ray:\t\t\t%4.4lf\n",
  				(utime + stime) / (double)TotalRays);
***************
*** 151,157
  	if (HitRays != 0.)
  		fprintf(fstats, "Seconds / intersecting ray:\t%4.4lf\n",
  				(utime + stime) / (double)HitRays);
- #endif
  	PrintMemoryStats();
  	exit(0);
  }

--- 160,165 -----
  	if (HitRays != 0.)
  		fprintf(fstats, "Seconds / intersecting ray:\t%4.4lf\n",
  				(utime + stime) / (double)HitRays);
  	PrintMemoryStats();
  	exit(0);
  }

Index: src/matrix.c
*** src/matrix.c.old	Mon Nov 20 13:11:10 1989
--- src/matrix.c	Mon Nov 20 13:11:11 1989
***************
*** 18,24
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: matrix.c,v 3.0 89/10/27 02:05:56 craig Exp $
   *
   * $Log:	matrix.c,v $
   * Revision 3.0  89/10/27  02:05:56  craig

--- 18,24 -----
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: matrix.c,v 3.0.1.1 89/11/18 14:05:11 craig Exp Locker: craig $
   *
   * $Log:	matrix.c,v $
   * Revision 3.0.1.1  89/11/18  14:05:11  craig
***************
*** 21,26
   * $Id: matrix.c,v 3.0 89/10/27 02:05:56 craig Exp $
   *
   * $Log:	matrix.c,v $
   * Revision 3.0  89/10/27  02:05:56  craig
   * Baseline for first official release.
   * 

--- 21,30 -----
   * $Id: matrix.c,v 3.0.1.1 89/11/18 14:05:11 craig Exp Locker: craig $
   *
   * $Log:	matrix.c,v $
+  * Revision 3.0.1.1  89/11/18  14:05:11  craig
+  * patch1: Renamed rotate(), translate() and scale() to avoid problems
+  * patch1: with external libraries.
+  * 
   * Revision 3.0  89/10/27  02:05:56  craig
   * Baseline for first official release.
   * 
***************
*** 100,106
  /*
   * Apply translation by (vec) to trans.
   */
! translate(trans, vec)
  TransInfo *trans;
  Vector *vec;
  {

--- 104,110 -----
  /*
   * Apply translation by (vec) to trans.
   */
! RS_translate(trans, vec)
  TransInfo *trans;
  Vector *vec;
  {
***************
*** 112,118
  /*
   * Apply rotation about (dir) to matrix.
   */
! rotate(trans, dir, radians)
  TransInfo *trans;
  double radians;
  Vector *dir;

--- 116,122 -----
  /*
   * Apply rotation about (dir) to matrix.
   */
! RS_rotate(trans, dir, radians)
  TransInfo *trans;
  double radians;
  Vector *dir;
***************
*** 126,132
  /*
   * Apply scale of (x, y, z) to trans.
   */
! scale(trans, x, y, z)
  TransInfo *trans;
  double x, y, z;
  {

--- 130,136 -----
  /*
   * Apply scale of (x, y, z) to trans.
   */
! RS_scale(trans, x, y, z)
  TransInfo *trans;
  double x, y, z;
  {

Index: src/ray_options.c
*** src/ray_options.c.old	Mon Nov 20 13:11:22 1989
--- src/ray_options.c	Mon Nov 20 13:11:23 1989
***************
*** 18,24
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: ray_options.c,v 3.0 89/10/27 02:06:00 craig Exp $
   *
   * $Log:	ray_options.c,v $
   * Revision 3.0  89/10/27  02:06:00  craig

--- 18,24 -----
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: ray_options.c,v 3.0.1.2 89/11/20 13:02:22 craig Exp Locker: craig $
   *
   * $Log:	ray_options.c,v $
   * Revision 3.0.1.2  89/11/20  13:02:22  craig
***************
*** 21,26
   * $Id: ray_options.c,v 3.0 89/10/27 02:06:00 craig Exp $
   *
   * $Log:	ray_options.c,v $
   * Revision 3.0  89/10/27  02:06:00  craig
   * Baseline for first official release.
   * 

--- 21,32 -----
   * $Id: ray_options.c,v 3.0.1.2 89/11/20 13:02:22 craig Exp Locker: craig $
   *
   * $Log:	ray_options.c,v $
+  * Revision 3.0.1.2  89/11/20  13:02:22  craig
+  * patch1: Fixed problems involving overriding values on the command line.
+  * 
+  * Revision 3.0.1.1  89/11/16  18:28:38  craig
+  * patch1: Added -w option.
+  * 
   * Revision 3.0  89/10/27  02:06:00  craig
   * Baseline for first official release.
   * 
***************
*** 39,44
  int Quiet;			/* Don't be so verbose flag */
  char *progname;			/* argv[0] */
  
  #ifdef LINDA
  int Workers;			/* # of workers */
  #endif

--- 45,55 -----
  int Quiet;			/* Don't be so verbose flag */
  char *progname;			/* argv[0] */
  
+ /*
+  * Flags indicating that options were set on the command line.
+  */
+ int ResolutionSet, ContrastSet, SamplesSet, CutoffSet, AdaptiveSet, JitteredSet;
+ 
  #ifdef LINDA
  int Workers;			/* # of workers */
  int VerboseWorker;
***************
*** 41,46
  
  #ifdef LINDA
  int Workers;			/* # of workers */
  #endif
  
  parse_options(argc, argv)

--- 52,58 -----
  
  #ifdef LINDA
  int Workers;			/* # of workers */
+ int VerboseWorker;
  #endif
  
  parse_options(argc, argv)
***************
*** 67,72
  				RedContrast = atof(argv[1]);
  				GreenContrast = atof(argv[2]);
  				BlueContrast = atof(argv[3]);
  				argv += 3;
  				argc -= 3;
  				break;

--- 79,85 -----
  				RedContrast = atof(argv[1]);
  				GreenContrast = atof(argv[2]);
  				BlueContrast = atof(argv[3]);
+ 				ContrastSet = TRUE;
  				argv += 3;
  				argc -= 3;
  				break;
***************
*** 83,88
  				break;
  			case 'j':
  				Jittered = TRUE;
  				break;
  			case 'L':
  				StartLine = atoi(argv[1]);

--- 96,102 -----
  				break;
  			case 'j':
  				Jittered = TRUE;
+ 				JitteredSet = TRUE;
  				break;
  			case 'L':
  				StartLine = atoi(argv[1]);
***************
*** 104,109
  				pixel_div = atoi(argv[1]);
  				if(pixel_div < 0)
  					pixel_div = 0;
  				argv++;
  				argc--;
  				break;

--- 118,124 -----
  				pixel_div = atoi(argv[1]);
  				if(pixel_div < 0)
  					pixel_div = 0;
+ 				AdaptiveSet = TRUE;
  				argv++;
  				argc--;
  				break;
***************
*** 116,121
  			case 'R':
  				Xres = atoi(argv[1]);
  				Yres = atoi(argv[2]);
  				argv += 2;
  				argc -= 2;
  				break;

--- 131,137 -----
  			case 'R':
  				Xres = atoi(argv[1]);
  				Yres = atoi(argv[2]);
+ 				ResolutionSet = TRUE;
  				argv += 2;
  				argc -= 2;
  				break;
***************
*** 126,131
  				JitSamples = atoi(argv[1]);
  				if (JitSamples < 1)
  					JitSamples = 1;
  				argv++; argc--;
  				break;
  			case 's':

--- 142,148 -----
  				JitSamples = atoi(argv[1]);
  				if (JitSamples < 1)
  					JitSamples = 1;
+ 				SamplesSet = TRUE;
  				argv++; argc--;
  				break;
  			case 's':
***************
*** 133,138
  				break;
  			case 'T':
  				TreeCutoff = atof(argv[1]);
  				argv++; argc--;
  				break;
  			case 'v':

--- 150,156 -----
  				break;
  			case 'T':
  				TreeCutoff = atof(argv[1]);
+ 				CutoffSet = TRUE;
  				argv++; argc--;
  				break;
  			case 'v':
***************
*** 164,169
  					exit(3);
  				}
  				argv++; argc--;
  				break;
  #endif
  			default:

--- 182,190 -----
  					exit(3);
  				}
  				argv++; argc--;
+ 				break;
+ 			case 'w':
+ 				VerboseWorker = !VerboseWorker;
  				break;
  #endif
  			default:

Index: doc/rayshade.1
*** doc/rayshade.1.old	Mon Nov 20 13:10:22 1989
--- doc/rayshade.1	Mon Nov 20 13:10:24 1989
***************
*** 1,6
  .\" Manual page for rayshade, 'troff -man' format.
  .\"
! .\" $Id: rayshade.1,v 3.0 89/10/27 16:55:22 craig Exp $
  .\"
  .\" $Log:	rayshade.1,v $
  .\" Revision 3.0  89/10/27  16:55:22  craig

--- 1,6 -----
  .\" Manual page for rayshade, 'troff -man' format.
  .\"
! .\" $Id: rayshade.1,v 3.0.1.1 89/11/17 16:57:19 craig Exp Locker: craig $
  .\"
  .\" $Log:	rayshade.1,v $
  .\" Revision 3.0.1.1  89/11/17  16:57:19  craig
***************
*** 3,8
  .\" $Id: rayshade.1,v 3.0 89/10/27 16:55:22 craig Exp $
  .\"
  .\" $Log:	rayshade.1,v $
  .\" Revision 3.0  89/10/27  16:55:22  craig
  .\" Baseline for first official release.
  .\" 

--- 3,11 -----
  .\" $Id: rayshade.1,v 3.0.1.1 89/11/17 16:57:19 craig Exp Locker: craig $
  .\"
  .\" $Log:	rayshade.1,v $
+ .\" Revision 3.0.1.1  89/11/17  16:57:19  craig
+ .\" patch1: Documented new -w option.
+ .\" 
  .\" Revision 3.0  89/10/27  16:55:22  craig
  .\" Baseline for first official release.
  .\" 
***************
*** 83,88
  .TP
  .B \-v
  Write verbose output to standard output.
  .TP
  .B \-W \fIworkers\fR
  Specify number of worker processes (Linda implementation only).

--- 86,94 -----
  .TP
  .B \-v
  Write verbose output to standard output.
+ .TP
+ .B \-w
+ Write verbose worker information to the standard error.
  .TP
  .B \-W \fIworkers\fR
  Specify number of worker processes (Linda implementation only).

Index: src/raytrace.c
*** src/raytrace.c.old	Mon Nov 20 13:11:27 1989
--- src/raytrace.c	Mon Nov 20 13:11:28 1989
***************
*** 18,24
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: raytrace.c,v 3.0 89/10/27 02:06:02 craig Exp $
   *
   * $Log:	raytrace.c,v $
   * Revision 3.0  89/10/27  02:06:02  craig

--- 18,24 -----
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: raytrace.c,v 3.0.1.2 89/11/16 20:35:30 craig Exp Locker: craig $
   *
   * $Log:	raytrace.c,v $
   * Revision 3.0.1.2  89/11/16  20:35:30  craig
***************
*** 21,26
   * $Id: raytrace.c,v 3.0 89/10/27 02:06:02 craig Exp $
   *
   * $Log:	raytrace.c,v $
   * Revision 3.0  89/10/27  02:06:02  craig
   * Baseline for first official release.
   * 

--- 21,33 -----
   * $Id: raytrace.c,v 3.0.1.2 89/11/16 20:35:30 craig Exp Locker: craig $
   *
   * $Log:	raytrace.c,v $
+  * Revision 3.0.1.2  89/11/16  20:35:30  craig
+  * patch1: ShadeRay is now called on background rays.
+  * 
+  * Revision 3.0.1.1  89/11/16  18:27:38  craig
+  * patch1: Workers now report statistics to supervisor.
+  * patch1: Linda syntax is more up-to-date.
+  * 
   * Revision 3.0  89/10/27  02:06:02  craig
   * Baseline for first official release.
   * 
***************
*** 83,88
  
  raytrace()
  {
  	/*
  	 * The top-level ray TopRay always has as its origin the
  	 * eye position and as its medium NULL, indicating that it

--- 90,109 -----
  
  raytrace()
  {
+ #ifdef LINDA
+ 	extern unsigned long primtests[], primhits[];
+ 	extern double utime, stime;
+ 	extern unsigned long EyeRays, ShadowRays, ReflectRays, RefractRays,
+ 			CacheWorked, CacheFailed, ShadowHits, SuperSampled,
+ 			BVTests, HitRays;
+ 	unsigned long eyerays, shadowrays, reflectrays, refractrays,
+ 			cacheworked, cachefailed, shadowhits, supersampled,
+ 			bvtests, hitrays;
+ 	unsigned long primtmp[PRIMTYPES], hittmp[PRIMTYPES];
+ 	double utmp, stmp;
+ 	int i, j;
+ 	extern FILE *fstats;
+ #endif
  	/*
  	 * The top-level ray TopRay always has as its origin the
  	 * eye position and as its medium NULL, indicating that it
***************
*** 99,104
  		distributed_trace();
  	else
  		adaptive_trace();
  }
  
  /*

--- 120,153 -----
  		distributed_trace();
  	else
  		adaptive_trace();
+ #ifdef LINDA
+ 	/*
+ 	 * In statistics & workers.
+ 	 */
+ 	for (i = 0; i < Workers; i++) {
+ 		in ("statistics", ? eyerays, ? shadowrays, ? reflectrays,
+ 			? refractrays, ? cacheworked, ? cachefailed,
+ 			? shadowhits, ? supersampled, ? bvtests, ? hitrays);
+ 		EyeRays += eyerays;
+ 		ShadowRays += shadowrays;
+ 		ReflectRays += reflectrays;
+ 		RefractRays += refractrays;
+ 		CacheWorked += cacheworked;
+ 		ShadowHits += shadowhits;
+ 		SuperSampled += supersampled;
+ 		BVTests += bvtests;
+ 		HitRays += hitrays;
+ 		in ("counts", ? primtmp, ? hittmp);
+ 		for (j = 0; j < PRIMTYPES; j++) {
+ 			primtests[j] += primtmp[j];
+ 			primhits[j] += hittmp[j];
+ 		}
+ 		in ("timing", ? utmp, ? stmp);
+ 		utime += utmp / (double)Workers;
+ 		stime += stmp / (double)Workers;
+ 		in("worker", ? int);
+ 	}
+ #endif
  }
  
  /*
***************
*** 109,115
  	register int y;
  	extern FILE *fstats;
  	extern unsigned long EyeRays;
! 	extern int Verbose;
  
  	switch (JitSamples) {
  		case 1:

--- 158,166 -----
  	register int y;
  	extern FILE *fstats;
  	extern unsigned long EyeRays;
! #ifdef LINDA
! 	extern int VerboseWorker;
! #endif
  
  	switch (JitSamples) {
  		case 1:
***************
*** 146,151
  	 * the output file.
  	 */
  	fprintf(fstats,"Using %d workers.\n",Workers);
  	out("scaninfo", StartLine);
  	for (y = 0; y < Workers; y++)
  		eval("worker", dist_worker());

--- 197,203 -----
  	 * the output file.
  	 */
  	fprintf(fstats,"Using %d workers.\n",Workers);
+ 	fflush(fstats);
  	out("scaninfo", StartLine);
  	for (y = 0; y < Workers; y++)
  		eval("worker", dist_worker());
***************
*** 150,157
  	for (y = 0; y < Workers; y++)
  		eval("worker", dist_worker());
  	for (y = StartLine; y >= 0 ; y--) {
! 		in("result", y, ? out_buf);
! 		if (Verbose)
  			fprintf(stderr,"Supervisor: inned %d\n",y);
  		if (y % 10 == 0)
  			fprintf(fstats, "Finished line %d.\n",y);

--- 202,209 -----
  	for (y = 0; y < Workers; y++)
  		eval("worker", dist_worker());
  	for (y = StartLine; y >= 0 ; y--) {
! 		in("result", y, ? out_buf:);
! 		if (VerboseWorker)
  			fprintf(stderr,"Supervisor: inned %d\n",y);
  		if (y % 10 == 0)
  			fprintf(fstats, "Finished line %d.\n",y);
***************
*** 155,160
  			fprintf(stderr,"Supervisor: inned %d\n",y);
  		if (y % 10 == 0)
  			fprintf(fstats, "Finished line %d.\n",y);
  		outline(out_buf);
  	}
  	for (y = 0; y < Workers; y++)

--- 207,213 -----
  			fprintf(stderr,"Supervisor: inned %d\n",y);
  		if (y % 10 == 0)
  			fprintf(fstats, "Finished line %d.\n",y);
+ 		fflush(fstats);
  		outline(out_buf);
  	}
  #else
***************
*** 157,164
  			fprintf(fstats, "Finished line %d.\n",y);
  		outline(out_buf);
  	}
- 	for (y = 0; y < Workers; y++)
- 		in("worker", ? int);
  #else
  	/*
  	 * Trace each scanline, writing results to output file.

--- 210,215 -----
  		fflush(fstats);
  		outline(out_buf);
  	}
  #else
  	/*
  	 * Trace each scanline, writing results to output file.
***************
*** 217,223
  {
  	register int line;
  	extern unsigned long EyeRays;
- 	extern int maxlevel, Verbose;
  	extern FILE *fstats;
  
  	/*

--- 268,273 -----
  {
  	register int line;
  	extern unsigned long EyeRays;
  	extern FILE *fstats;
  #ifdef LINDA
  	extern int maxlevel, VerboseWorker;
***************
*** 219,224
  	extern unsigned long EyeRays;
  	extern int maxlevel, Verbose;
  	extern FILE *fstats;
  
  	/*
  	 * In the adaptive supersampling case, Jitter, JitterWeight,

--- 269,277 -----
  	register int line;
  	extern unsigned long EyeRays;
  	extern FILE *fstats;
+ #ifdef LINDA
+ 	extern int maxlevel, VerboseWorker;
+ #endif
  
  	/*
  	 * In the adaptive supersampling case, Jitter, JitterWeight,
***************
*** 269,274
  	 * is still working on it.)
  	 */
  	fprintf(fstats,"Using %d workers.\n",Workers);
  	out("scaninfo", StartLine+1, StartLine+2);
  	for (line = 0; line < Workers; line++)
  		eval("worker", adapt_worker());

--- 322,328 -----
  	 * is still working on it.)
  	 */
  	fprintf(fstats,"Using %d workers.\n",Workers);
+ 	fflush(fstats);
  	out("scaninfo", StartLine+1, StartLine+2);
  	for (line = 0; line < Workers; line++)
  		eval("worker", adapt_worker());
***************
*** 281,288
  	for (line = StartLine; line >= 0;) {
  		if (!adapt_job(TRUE))
  			sleep(5);
! 		while (inp("result", line, ? out_buf)) {
! 			if (Verbose)
  				fprintf(stderr,"Supervisor: inned %d\n",line);
  			if (line % 10 == 0)
  				fprintf(fstats, "Finished line %d.\n",line);

--- 335,342 -----
  	for (line = StartLine; line >= 0;) {
  		if (!adapt_job(TRUE))
  			sleep(5);
! 		while (inp("result", line, ? out_buf:)) {
! 			if (VerboseWorker)
  				fprintf(stderr,"Supervisor: inned %d\n",line);
  			if (line % 10 == 0)
  				fprintf(fstats, "Finished line %d.\n",line);
***************
*** 286,291
  				fprintf(stderr,"Supervisor: inned %d\n",line);
  			if (line % 10 == 0)
  				fprintf(fstats, "Finished line %d.\n",line);
  			outline(out_buf);
  			if (--line < 0)
  				break;

--- 340,346 -----
  				fprintf(stderr,"Supervisor: inned %d\n",line);
  			if (line % 10 == 0)
  				fprintf(fstats, "Finished line %d.\n",line);
+ 			fflush(fstats);
  			outline(out_buf);
  			if (--line < 0)
  				break;
***************
*** 291,300
  				break;
  		}
  	}
- 	if (Verbose)
- 		fprintf(stderr,"Finished -- inning workers.\n");
- 	for (line = 0; line < Workers; line++)
- 		in("worker", ? int);
  #else
  	line = StartLine + 1;
  	trace_line(line, &pixel_buf[line & 01][0]);

--- 346,351 -----
  				break;
  		}
  	}
  #else
  	line = StartLine + 1;
  	trace_line(line, &pixel_buf[line & 01][0]);
***************
*** 465,478
  	 * Do the actual ray trace.
  	 */
  	dist = TraceRay((Primitive *)NULL, &TopRay, &hitinfo);
! 	if (dist > 0.)
! 		/*
! 		 * There was a valid intersection.
! 		 */
! 		ShadeRay(&hitinfo, &TopRay, dist, &background, color, 1.0);
! 	else
! 		/* Use background color */
! 		*color = background;
  }
  
  /*

--- 516,522 -----
  	 * Do the actual ray trace.
  	 */
  	dist = TraceRay((Primitive *)NULL, &TopRay, &hitinfo);
! 	ShadeRay(&hitinfo, &TopRay, dist, &background, color, 1.0);
  }
  
  /*
***************
*** 514,519
  #ifdef LINDA
  dist_worker()
  {
  	while (dist_job())
  		;
  	return;

--- 558,571 -----
  #ifdef LINDA
  dist_worker()
  {
+ 	extern unsigned long EyeRays, ShadowRays, ReflectRays, RefractRays;
+ 	extern unsigned long CacheWorked, CacheFailed, ShadowHits;
+ 	extern unsigned long SuperSampled, BVTests, HitRays;
+ 	extern unsigned long primtests[PRIMTYPES], primhits[PRIMTYPES];
+ 	extern int VerboseWorker;
+ 	extern FILE *fstats;
+ 	double user, sys;
+ 
  	while (dist_job())
  		;
  	/*
***************
*** 516,521
  {
  	while (dist_job())
  		;
  	return;
  }
  

--- 568,588 -----
  
  	while (dist_job())
  		;
+ 	/*
+ 	 * Out statistics.
+ 	 */
+ 	out ("statistics", EyeRays, ShadowRays, ReflectRays, RefractRays,
+ 		CacheWorked, CacheFailed, ShadowHits, SuperSampled, BVTests,
+ 		HitRays);
+ 	/*
+ 	 * Out ray/primitive intersection counts.
+ 	 */
+ 	out ("counts", primtests, primhits);
+ 	/*
+ 	 * Compute running time.
+ 	 */
+ 	get_cpu_time(&user, &sys);
+ 	out ("timing", user, sys);
  	return;
  }
  
***************
*** 525,531
  dist_job()
  {
  	int y;
! 	extern int Verbose;
  
  	in("scaninfo", ? y);
  	if (y < 0) {

--- 592,598 -----
  dist_job()
  {
  	int y;
! 	extern int VerboseWorker;
  
  	in("scaninfo", ? y);
  	if (y < 0) {
***************
*** 532,538
  		out("scaninfo", y);
  		return 0;
  	}
! 	if (Verbose)
  		fprintf(stderr,"Worker: inned %d\n",y);
  	out("scaninfo", y-1);
  	trace_jit_line(y, out_buf);

--- 599,605 -----
  		out("scaninfo", y);
  		return 0;
  	}
! 	if (VerboseWorker)
  		fprintf(stderr,"Worker: inned %d\n",y);
  	out("scaninfo", y-1);
  	trace_jit_line(y, out_buf);
***************
*** 536,542
  		fprintf(stderr,"Worker: inned %d\n",y);
  	out("scaninfo", y-1);
  	trace_jit_line(y, out_buf);
! 	if (Verbose)
  		fprintf(stderr,"Worker: outing %d\n",y);
  	out("result", y, out_buf : Xres);
  	return 1;

--- 603,609 -----
  		fprintf(stderr,"Worker: inned %d\n",y);
  	out("scaninfo", y-1);
  	trace_jit_line(y, out_buf);
! 	if (VerboseWorker)
  		fprintf(stderr,"Worker: outing %d\n",y);
  	out("result", y, out_buf : Xres);
  	return 1;
***************
*** 544,549
  
  adapt_worker()
  {
  	while (adapt_job(FALSE))
  		;
  	return;

--- 611,623 -----
  
  adapt_worker()
  {
+ 
+ 	extern unsigned long EyeRays, ShadowRays, ReflectRays, RefractRays;
+ 	extern unsigned long CacheWorked, CacheFailed, ShadowHits;
+ 	extern unsigned long SuperSampled, BVTests, HitRays;
+ 	extern unsigned long primtests[PRIMTYPES], primhits[PRIMTYPES];
+ 	double user, sys;
+ 
  	while (adapt_job(FALSE))
  		;
  	/*
***************
*** 546,551
  {
  	while (adapt_job(FALSE))
  		;
  	return;
  }
  

--- 620,642 -----
  
  	while (adapt_job(FALSE))
  		;
+ 	/*
+ 	 * Out statistics.
+ 	 */
+ 	out ("statistics", EyeRays, ShadowRays, ReflectRays, RefractRays,
+ 		CacheWorked, CacheFailed, ShadowHits, SuperSampled, BVTests,
+ 		HitRays);
+ 	/*
+ 	 * Out ray/primitive intersection counts.
+ 	 */
+ 	out ("counts", primtests, primhits);
+ 
+ 	/*
+ 	 * Compute running time.
+ 	 */
+ 	get_cpu_time(&user, &sys);
+ 	out ("timing", user, sys);
+ 
  	return;
  }
  
***************
*** 553,559
  int supervisor;
  {
  	int lastpix, lastscan;
! 	extern int Verbose;
  
  	in("scaninfo", ? lastpix, ? lastscan);
  	if (lastpix <= 0) {

--- 644,650 -----
  int supervisor;
  {
  	int lastpix, lastscan;
! 	extern int VerboseWorker;
  
  	in("scaninfo", ? lastpix, ? lastscan);
  	if (lastpix <= 0) {
***************
*** 558,564
  	in("scaninfo", ? lastpix, ? lastscan);
  	if (lastpix <= 0) {
  		out("scaninfo", lastpix, lastscan);
! 		if (Verbose)
  			fprintf(stderr,"Worker:  all finished!\n");
  		return FALSE;
  	}

--- 649,655 -----
  	in("scaninfo", ? lastpix, ? lastscan);
  	if (lastpix <= 0) {
  		out("scaninfo", lastpix, lastscan);
! 		if (VerboseWorker)
  			fprintf(stderr,"Worker:  all finished!\n");
  		return FALSE;
  	}
***************
*** 563,570
  		return FALSE;
  	}
  
! 	if (rdp("scanline", lastpix -1, ? pixel_buf[0]) &&
! 	    inp("scanline", lastpix, ? pixel_buf[1])) {
  		lastpix--;
  		out("scaninfo", lastpix, lastscan);
  		if (Verbose)

--- 654,661 -----
  		return FALSE;
  	}
  
! 	if (rdp("scanline", lastpix -1, ? pixel_buf[0]:) &&
! 	    inp("scanline", lastpix, ? pixel_buf[1]:)) {
  		lastpix--;
  		out("scaninfo", lastpix, lastscan);
  		if (VerboseWorker)
***************
*** 567,573
  	    inp("scanline", lastpix, ? pixel_buf[1])) {
  		lastpix--;
  		out("scaninfo", lastpix, lastscan);
! 		if (Verbose)
  			fprintf(stderr,"%s: doing pixline %d\n",
  				supervisor ? "Supervisor" : "Worker",
  					lastpix);

--- 658,664 -----
  	    inp("scanline", lastpix, ? pixel_buf[1]:)) {
  		lastpix--;
  		out("scaninfo", lastpix, lastscan);
! 		if (VerboseWorker)
  			fprintf(stderr,"%s: doing pixline %d\n",
  				supervisor ? "Supervisor" : "Worker",
  					lastpix);
***************
*** 581,587
  		 * a long, long time, causing tuple-space to get
  		 * jammed with finished pixlines, and...
  		 */
! 		if (Verbose)
  			fprintf(stderr,"Supervisor: nothing to do...\n");
  		out ("scaninfo", lastpix, lastscan);
  		return FALSE;

--- 672,678 -----
  		 * a long, long time, causing tuple-space to get
  		 * jammed with finished pixlines, and...
  		 */
! 		if (VerboseWorker)
  			fprintf(stderr,"Supervisor: nothing to do...\n");
  		out ("scaninfo", lastpix, lastscan);
  		return FALSE;
***************
*** 588,594
  	} else if (lastscan > 0) {
  		lastscan--;
  		out("scaninfo", lastpix, lastscan);
! 		if (Verbose)
  			fprintf(stderr,"Worker: doing scan %d\n",
  					lastscan);
  		trace_line(lastscan, pixel_buf[0]);

--- 679,685 -----
  	} else if (lastscan > 0) {
  		lastscan--;
  		out("scaninfo", lastpix, lastscan);
! 		if (VerboseWorker)
  			fprintf(stderr,"Worker: doing scan %d\n",
  					lastscan);
  		trace_line(lastscan, pixel_buf[0]);
***************
*** 597,603
  		/*
  		 * Nothing to do until somebody finishes a scanline.
  		 */
! 		if (Verbose) {
  			fprintf(stderr,"Worker idle... ");
  			fprintf(stderr,"pix = %d, scan = %d\n",
  					lastpix, lastscan);

--- 688,694 -----
  		/*
  		 * Nothing to do until somebody finishes a scanline.
  		 */
! 		if (VerboseWorker) {
  			fprintf(stderr,"Worker idle... ");
  			fprintf(stderr,"pix = %d, scan = %d\n",
  					lastpix, lastscan);

Index: src/shade.c
*** src/shade.c.old	Mon Nov 20 13:11:33 1989
--- src/shade.c	Mon Nov 20 13:11:34 1989
***************
*** 18,24
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: shade.c,v 3.0 89/10/27 02:06:03 craig Exp $
   *
   * $Log:	shade.c,v $
   * Revision 3.0  89/10/27  02:06:03  craig

--- 18,24 -----
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: shade.c,v 3.0.1.1 89/11/16 20:34:42 craig Exp Locker: craig $
   *
   * $Log:	shade.c,v $
   * Revision 3.0.1.1  89/11/16  20:34:42  craig
***************
*** 21,26
   * $Id: shade.c,v 3.0 89/10/27 02:06:03 craig Exp $
   *
   * $Log:	shade.c,v $
   * Revision 3.0  89/10/27  02:06:03  craig
   * Baseline for first official release.
   * 

--- 21,29 -----
   * $Id: shade.c,v 3.0.1.1 89/11/16 20:34:42 craig Exp Locker: craig $
   *
   * $Log:	shade.c,v $
+  * Revision 3.0.1.1  89/11/16  20:34:42  craig
+  * patch1: Atmospheric effects are now applied to background rays.
+  * 
   * Revision 3.0  89/10/27  02:06:03  craig
   * Baseline for first official release.
   * 
***************
*** 30,35
  #include "constants.h"
  #include "typedefs.h"
  #include "funcdefs.h"
  
  int	level, maxlevel;	/* Current tree depth, max depth */
  double	DefIndex = 1.0;		/* Default index of refraction. */

--- 33,39 -----
  #include "constants.h"
  #include "typedefs.h"
  #include "funcdefs.h"
+ #include "atmosphere.h"
  
  int	level, maxlevel;	/* Current tree depth, max depth */
  double	DefIndex = 1.0;		/* Default index of refraction. */
***************
*** 47,52
  double contrib;			/* Contribution of this ray to final color */
  {
  	Vector hit;
  	extern unsigned long HitRays;
  	extern Fog *GlobalFog;
  	extern Mist *GlobalMist;

--- 51,57 -----
  double contrib;			/* Contribution of this ray to final color */
  {
  	Vector hit;
+ 	double realdist;
  	extern unsigned long HitRays;
  	extern Fog *GlobalFog;
  	extern Mist *GlobalMist;
***************
*** 51,60
  	extern Fog *GlobalFog;
  	extern Mist *GlobalMist;
  
! 	/*
! 	 * If we got here, then a ray hit something, so...
! 	 */
! 	HitRays++;
  
  	(void)normalize(&hitinfo->norm);
  	/*

--- 56,75 -----
  	extern Fog *GlobalFog;
  	extern Mist *GlobalMist;
  
! 	if (dist <= 0.) {
! 		/*
! 		 * No valid intersection.  Set distance for atmospheric
! 		 * effects and set color of ray to background.
! 		 */
! 		realdist = FAR_AWAY;
! 		*color = *back;
! 		addscaledvec(ray->pos, realdist, ray->dir, &hit);
! 	} else {
! 		realdist = dist;
! 		/*
! 		 * If we got here, then a ray hit something, so...
! 		 */
! 		HitRays++;
  
  		(void)normalize(&hitinfo->norm);
  		/*
***************
*** 56,71
  	 */
  	HitRays++;
  
! 	(void)normalize(&hitinfo->norm);
! 	/*
!  	 * "hit" is the location of intersection in world space.
! 	 * hitinfo->pos is the intersection point in object space.
! 	 */
! 	addscaledvec(ray->pos, dist, ray->dir, &hit);
! 	/*
! 	 * Calculate ray color.
! 	 */
! 	shade(&hit, ray, &hitinfo->norm, hitinfo->prim, &hitinfo->surf,
  			back, color, contrib);
  	/*
  	 * If fog or mist is present, modify computed color.

--- 71,86 -----
  		 */
  		HitRays++;
  
! 		(void)normalize(&hitinfo->norm);
! 		/*
!  		 * "hit" is the location of intersection in world space.
! 		 * hitinfo->pos is the intersection point in object space.
! 		 */
! 		addscaledvec(ray->pos, dist, ray->dir, &hit);
! 		/*
! 		 * Calculate ray color.
! 		 */
! 		shade(&hit, ray, &hitinfo->norm, hitinfo->prim, &hitinfo->surf,
  			back, color, contrib);
  	}
  	/*
***************
*** 67,72
  	 */
  	shade(&hit, ray, &hitinfo->norm, hitinfo->prim, &hitinfo->surf,
  			back, color, contrib);
  	/*
  	 * If fog or mist is present, modify computed color.
  	 */

--- 82,88 -----
  		 */
  		shade(&hit, ray, &hitinfo->norm, hitinfo->prim, &hitinfo->surf,
  			back, color, contrib);
+ 	}
  	/*
  	 * If fog or mist is present, modify computed color.
  	 */
***************
*** 71,77
  	 * If fog or mist is present, modify computed color.
  	 */
  	if (GlobalFog)
! 		ComputeFog(GlobalFog, dist, color);
  	if (GlobalMist)
  		ComputeMist(GlobalMist, &ray->pos, &hit, dist, color);
  }

--- 87,93 -----
  	 * If fog or mist is present, modify computed color.
  	 */
  	if (GlobalFog)
! 		ComputeFog(GlobalFog, realdist, color);
  	if (GlobalMist)
  		ComputeMist(GlobalMist, &ray->pos, &hit, realdist, color);
  }
***************
*** 73,79
  	if (GlobalFog)
  		ComputeFog(GlobalFog, dist, color);
  	if (GlobalMist)
! 		ComputeMist(GlobalMist, &ray->pos, &hit, dist, color);
  }
  
  shade(pos, ray, nrm, prim, surf, back, color, contrib)

--- 89,95 -----
  	if (GlobalFog)
  		ComputeFog(GlobalFog, realdist, color);
  	if (GlobalMist)
! 		ComputeMist(GlobalMist, &ray->pos, &hit, realdist, color);
  }
  
  shade(pos, ray, nrm, prim, surf, back, color, contrib)
***************
*** 136,147
  		NewRay.media = ray->media;	/* Medium == old medium */
  		ReflectRays++;
  		dist = TraceRay(prim, &NewRay, &hitinfo);
! 		if (dist > EPSILON) {
! 			ShadeRay(&hitinfo, &NewRay, dist, back, &newcol,
! 					contrib*surf->refl);
! 			AddScaledColor(*color, surf->refl, newcol, color);
! 		} else
! 			AddScaledColor(*color, surf->refl, *back, color);
  		level--;
  	}
  	/*

--- 152,160 -----
  		NewRay.media = ray->media;	/* Medium == old medium */
  		ReflectRays++;
  		dist = TraceRay(prim, &NewRay, &hitinfo);
! 		ShadeRay(&hitinfo, &NewRay, dist, back, &newcol,
! 				contrib*surf->refl);
! 		AddScaledColor(*color, surf->refl, newcol, color);
  		level--;
  	}
  	/*
***************
*** 185,192
  		level++;
  		RefractRays++;
  		dist = TraceRay((Primitive *)NULL, &NewRay, &hitinfo);
! 		if (dist > EPSILON) {
! 			ShadeRay(&hitinfo, &NewRay, dist, back, &newcol,
  				contrib * surf->transp);
  			AddScaledColor(*color, surf->transp, newcol, color);
  		} else

--- 198,204 -----
  		level++;
  		RefractRays++;
  		dist = TraceRay((Primitive *)NULL, &NewRay, &hitinfo);
! 		ShadeRay(&hitinfo, &NewRay, dist, back, &newcol,
  				contrib * surf->transp);
  		AddScaledColor(*color, surf->transp, newcol, color);
  		if (entering)
***************
*** 188,196
  		if (dist > EPSILON) {
  			ShadeRay(&hitinfo, &NewRay, dist, back, &newcol,
  				contrib * surf->transp);
! 			AddScaledColor(*color, surf->transp, newcol, color);
! 		} else
! 			AddScaledColor(*color, surf->transp, *back, color);
  		if (entering)
  			free((char *)NewRay.media);
  		level--;

--- 200,206 -----
  		dist = TraceRay((Primitive *)NULL, &NewRay, &hitinfo);
  		ShadeRay(&hitinfo, &NewRay, dist, back, &newcol,
  				contrib * surf->transp);
! 		AddScaledColor(*color, surf->transp, newcol, color);
  		if (entering)
  			free((char *)NewRay.media);
  		level--;

Index: src/viewing.c
*** src/viewing.c.old	Mon Nov 20 13:11:42 1989
--- src/viewing.c	Mon Nov 20 13:11:43 1989
***************
*** 18,24
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: viewing.c,v 3.0 89/10/27 02:06:08 craig Exp $
   *
   * $Log:	viewing.c,v $
   * Revision 3.0  89/10/27  02:06:08  craig

--- 18,24 -----
   * name of the person performing the modification, the date of modification,
   * and the reason for such modification.
   *
!  * $Id: viewing.c,v 3.0.1.1 89/11/16 18:24:30 craig Exp Locker: craig $
   *
   * $Log:	viewing.c,v $
   * Revision 3.0.1.1  89/11/16  18:24:30  craig
***************
*** 21,26
   * $Id: viewing.c,v 3.0 89/10/27 02:06:08 craig Exp $
   *
   * $Log:	viewing.c,v $
   * Revision 3.0  89/10/27  02:06:08  craig
   * Baseline for first official release.
   * 

--- 21,29 -----
   * $Id: viewing.c,v 3.0.1.1 89/11/16 18:24:30 craig Exp Locker: craig $
   *
   * $Log:	viewing.c,v $
+  * Revision 3.0.1.1  89/11/16  18:24:30  craig
+  * patch1: Fixed calculation of dist in Stereo mode.
+  * 
   * Revision 3.0  89/10/27  02:06:08  craig
   * Baseline for first official release.
   * 
***************
*** 60,66
  		eyep.z += magnitude * scrnx.z;
  		vecsub(lookp, eyep, &firstray);
  		gaze = firstray;
! 		dist = normalize(&gaze);
  		(void)crossp(&scrnx, &gaze, &up);
  		(void)crossp(&scrny, &scrnx, &gaze);
  	}

--- 63,69 -----
  		eyep.z += magnitude * scrnx.z;
  		vecsub(lookp, eyep, &firstray);
  		gaze = firstray;
! 		dist = 2. * normalize(&gaze);
  		(void)crossp(&scrnx, &gaze, &up);
  		(void)crossp(&scrny, &scrnx, &gaze);
  	}

Index: src/atmosphere.h
*** /dev/null	Mon Nov 20 13:14:20 1989
--- src/atmosphere.h	Thu Nov 16 20:40:54 1989
***************
*** 0 ****
--- 1,36 ----
+ /*
+  * Copyright (C) 1989, Craig E. Kolb
+  *
+  * This software may be freely copied, modified, and redistributed,
+  * provided that this copyright notice is preserved on all copies.
+  * 
+  * There is no warranty or other guarantee of fitness for this software,
+  * it is provided solely "as is".  Bug reports or fixes may be sent
+  * to the author, who may or may not act on them as he desires.
+  *
+  * You may not include this software in a program or other software product
+  * without supplying the source, or without informing the end-user that the 
+  * source is available for no extra charge.
+  *
+  * If you modify this software, you should include a notice giving the
+  * name of the person performing the modification, the date of modification,
+  * and the reason for such modification.
+  *
+  * $Id: atmosphere.h,v 3.0 89/11/16 20:40:53 craig Exp Locker: craig $
+  *
+  * $Log:	atmosphere.h,v $
+  * Revision 3.0  89/11/16  20:40:53  craig
+  * Initial version.
+  * 
+  */
+ 
+ typedef struct {
+ 	Color color;		/* Fog color */
+ 	double trans;		/* Fog transmissivity */
+ } Fog;
+ 
+ typedef struct {
+ 	Color color;		/* Mist color */
+ 	Color trans;		/* R, G, B transmissivity */
+ 	double scale, zero;	/* Height scale, start Z */
+ } Mist;


-- 
Please send comp.sources.unix-related mail to rsalz at uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.



More information about the Comp.sources.unix mailing list