ftp.nice.ch/pub/next/graphics/3d/Raytracers.N.bs.tar.gz#/raytracers/ohta/src/trace.c

This is trace.c in view mode; [Download] [Up]

#include "ray.h"

struct color black={0,0,0},white={1.0,1.0,1.0};

struct color trace(n,r)
register int n;
struct ray r;
{struct intersect i;
	if(n>=MAXLEVEL)
		return bgcolor(r);
	raycount++;
	i=intersect(r);
	if(i.obj>0)
	{	if(sflag)
			return ((*objects[i.obj].shade)(n,r,i));
		else
			return white;
	}
	else
	{	if(sflag)
			return bgcolor(r);
		else
			return black;
	}
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.