--- ray/src/rt/ray.h 2003/02/22 02:07:29 2.12 +++ ray/src/rt/ray.h 2005/04/19 01:15:06 2.25 @@ -1,73 +1,19 @@ -/* RCSid: $Id: ray.h,v 2.12 2003/02/22 02:07:29 greg Exp $ */ +/* RCSid $Id: ray.h,v 2.25 2005/04/19 01:15:06 greg Exp $ */ /* * ray.h - header file for routines using rays. */ +#ifndef _RAD_RAY_H_ +#define _RAD_RAY_H_ -/* ==================================================================== - * The Radiance Software License, Version 1.0 - * - * Copyright (c) 1990 - 2002 The Regents of the University of California, - * through Lawrence Berkeley National Laboratory. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes Radiance software - * (http://radsite.lbl.gov/) - * developed by the Lawrence Berkeley National Laboratory - * (http://www.lbl.gov/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Radiance," "Lawrence Berkeley National Laboratory" - * and "The Regents of the University of California" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact radiance@radsite.lbl.gov. - * - * 5. Products derived from this software may not be called "Radiance", - * nor may "Radiance" appear in their name, without prior written - * permission of Lawrence Berkeley National Laboratory. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of Lawrence Berkeley National Laboratory. For more - * information on Lawrence Berkeley National Laboratory, please see - * . - */ - #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 */ @@ -85,17 +31,18 @@ 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)(OBJECT *, struct ray *); /* custom hit test */ OBJECT robj; /* intersected object number */ OBJREC *ro; /* intersected object (one with material) */ double rot; /* distance to object */ @@ -103,9 +50,10 @@ typedef struct ray { FVECT ron; /* intersection surface normal */ double rod; /* -DOT(rdir, ron) */ FULLXF *rox; /* object transformation */ + 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 */ @@ -113,8 +61,6 @@ typedef struct ray { int *slights; /* list of lights to test for scattering */ } RAY; -#define rayvalue(r) (*(r)->revf)(r) - extern char VersionID[]; /* Radiance version ID string */ extern CUBE thescene; /* our scene */ @@ -171,8 +117,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; @@ -208,58 +156,12 @@ typedef struct { /* rendering parameter holder */ #define rpambmod(p,i) ( (i)>=AMBLLEN||(p)->amblndx[i]<0 ? \ (char *)NULL : (p)->amblval+(p)->amblndx[i] ) -#ifdef NOPROTO - -extern void headclean(); -extern void openheader(); -extern void dupheader(); -extern void pfdetach(); -extern void pfclean(); -extern void pflock(); -extern void pfhold(); -extern void io_process(); -extern int free_objs(); -extern void free_objmem(); -extern int load_os(); -extern void preload_objs(); -extern void ray_init(); -extern void ray_trace(); -extern void ray_done(); -extern void ray_save(); -extern void ray_restore(); -extern void ray_defaults(); -extern void ray_pinit(); -extern void ray_psend(); -extern int ray_pqueue(); -extern int ray_presult(); -extern void ray_pdone(); -extern void ray_popen(); -extern void ray_pclose(); -extern int rayorigin(); -extern void rayclear(); -extern void raytrace(); -extern void raycont(); -extern void raytrans(); -extern int rayshade(); -extern void rayparticipate(); -extern int raymixture(); -extern double raydist(); -extern double raynormal(); -extern void newrayxf(); -extern void flipsurface(); -extern int localhit(); -extern int getrenderopt(); -extern void print_rdefaults(); -extern void drawsources(); -extern void rtrace(); -extern void rview(); -extern void rpict(); - -#else /* defined in duphead.c */ 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); @@ -287,15 +189,18 @@ 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 rayvalue(RAY *r); +extern void rayhit(OBJECT *oset, RAY *r); extern void raycont(RAY *r); extern void raytrans(RAY *r); 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); @@ -306,9 +211,18 @@ 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); + +#ifdef __cplusplus +} #endif +#endif /* _RAD_RAY_H_ */ +