--- ray/src/rt/ray.h 2003/06/07 00:54:58 2.17 +++ ray/src/rt/ray.h 2005/05/26 06:55:22 2.26 @@ -1,24 +1,19 @@ -/* RCSid $Id: ray.h,v 2.17 2003/06/07 00:54:58 schorsch Exp $ */ +/* RCSid $Id: ray.h,v 2.26 2005/05/26 06:55:22 greg Exp $ */ /* * ray.h - header file for routines using rays. */ #ifndef _RAD_RAY_H_ #define _RAD_RAY_H_ -#ifdef __cplusplus -extern "C" { -#endif - -#include "copyright.h" - #include "standard.h" - #include "octree.h" - #include "object.h" - #include "color.h" +#ifdef __cplusplus +extern "C" { +#endif + #define MAXDIM 32 /* maximum number of dimensions */ /* ray type flags */ @@ -36,18 +31,19 @@ extern "C" { typedef struct ray { unsigned long rno; /* unique ray number */ int rlvl; /* number of reflections for this ray */ - float rweight; /* cumulative weight of this ray */ + float rweight; /* cumulative weight (for termination) */ + COLOR rcoef; /* contribution coefficient w.r.t. parent */ short rtype; /* ray type */ short crtype; /* cumulative ray type */ - struct ray *parent; /* ray this originated from */ + const struct ray *parent; /* ray this originated from */ FVECT rorg; /* origin of ray */ FVECT rdir; /* normalized direction of ray */ double rmax; /* maximum distance (aft clipping plane) */ int rsrc; /* source we're aiming for */ OBJECT *clipset; /* set of objects currently clipped */ OBJECT *newcset; /* next clipset, used for transmission */ - void (*revf)(); /* evaluation function for this ray */ - void (*hitf)(); /* custom hit test for this traversal */ + void (*revf)(struct ray *); /* ray evaluation function */ + void (*hitf)(OBJECT *, struct ray *); /* custom hit test */ OBJECT robj; /* intersected object number */ OBJREC *ro; /* intersected object (one with material) */ double rot; /* distance to object */ @@ -55,10 +51,10 @@ typedef struct ray { FVECT ron; /* intersection surface normal */ double rod; /* -DOT(rdir, ron) */ FULLXF *rox; /* object transformation */ - FLOAT uv[2]; /* local coordinates */ + RREAL uv[2]; /* local coordinates */ FVECT pert; /* surface normal perturbation */ COLOR pcol; /* pattern color */ - COLOR rcol; /* returned ray value */ + COLOR rcol; /* returned radiance value */ double rt; /* returned effective ray length */ COLOR cext; /* medium extinction coefficient */ COLOR albedo; /* medium scattering albedo */ @@ -124,8 +120,10 @@ extern int ambincl; /* include == 1, exclude == 0 */ extern int ray_pnprocs; /* number of child processes */ extern int ray_pnidle; /* number of idle processes */ -#define AMBLLEN 128 /* max. ambient list length */ -#define AMBWORD 8 /* average word length */ +#ifndef AMBLLEN +#define AMBLLEN 512 /* max. ambient list length */ +#endif +#define AMBWORD 12 /* average word length */ typedef struct { /* rendering parameter holder */ int do_irrad; @@ -165,6 +163,8 @@ typedef struct { /* rendering parameter holder */ extern void headclean(void); extern void openheader(void); extern void dupheader(void); + /* defined in persist.c */ +extern void persistfile(char *pfn); extern void pfdetach(void); extern void pfclean(void); extern void pflock(int lf); @@ -192,7 +192,7 @@ extern void ray_pdone(int freall); extern void ray_popen(int nadd); extern void ray_pclose(int nsub); /* defined in raytrace.c */ -extern int rayorigin(RAY *r, RAY *ro, int rt, double rw); +extern int rayorigin(RAY *r, int rt, const RAY *ro, const COLOR rc); extern void rayclear(RAY *r); extern void raytrace(RAY *r); extern void rayhit(OBJECT *oset, RAY *r); @@ -202,7 +202,8 @@ extern int rayshade(RAY *r, int mod); extern void rayparticipate(RAY *r); extern void raytexture(RAY *r, OBJECT mod); extern int raymixture(RAY *r, OBJECT fore, OBJECT back, double coef); -extern double raydist(RAY *r, int flags); +extern void raycontrib(COLOR rc, const RAY *r, int flags); +extern double raydist(const RAY *r, int flags); extern double raynormal(FVECT norm, RAY *r); extern void newrayxf(RAY *r); extern void flipsurface(RAY *r); @@ -213,8 +214,12 @@ extern void print_rdefaults(void); /* defined in srcdraw.c */ extern void drawsources(COLOR *pic[], float *zbf[], int x0, int xsiz, int y0, int ysiz); +extern void init_drawsources(int rad); + /* defined in rt/initotypes.c */ +extern void initotypes(void); /* module main procedures */ extern void rtrace(char *fname); +extern char * formstr(int f); extern void rview(void); extern void rpict(int seq, char *pout, char *zout, char *prvr);