--- ray/src/rt/ambient.h 2003/02/22 02:07:28 2.7 +++ ray/src/rt/ambient.h 2005/04/19 01:15:06 2.12 @@ -1,67 +1,15 @@ -/* RCSid: $Id: ambient.h,v 2.7 2003/02/22 02:07:28 greg Exp $ */ +/* RCSid $Id: ambient.h,v 2.12 2005/04/19 01:15:06 greg Exp $ */ /* * Common definitions for interreflection routines. * * Include after ray.h */ +#ifndef _RAD_AMBIENT_H_ +#define _RAD_AMBIENT_H_ +#ifdef __cplusplus +extern "C" { +#endif -/* ==================================================================== - * 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 - * . - */ - /* * Since we've defined our vectors as float below to save space, * watch out for changes in the definitions of VCOPY() and DOT() @@ -94,6 +42,7 @@ typedef struct { } AMBSAMP; /* ambient sample division */ typedef struct { + COLOR acoef; /* coefficient for rayorigin() */ FVECT ux, uy, uz; /* x, y and z axis directions */ short nt, np; /* number of theta and phi directions */ } AMBHEMI; /* ambient sample hemisphere */ @@ -101,58 +50,34 @@ typedef struct { extern double maxarad; /* maximum ambient radius */ extern double minarad; /* minimum ambient radius */ +#ifndef AVGREFL #define AVGREFL 0.5 /* assumed average reflectance */ +#endif #define AMBVALSIZ 75 /* number of bytes in portable AMBVAL struct */ #define AMBMAGIC 557 /* magic number for ambient value files */ #define AMBFMT "Radiance_ambval" /* format id string */ -#ifdef NOPROTO - -extern int divsample(); -extern double doambient(); -extern void inithemi(); -extern void comperrs(); -extern void posgradient(); -extern void dirgradient(); -extern void setambres(); -extern void setambacc(); -extern void setambient(); -extern void ambdone(); -extern void ambnotify(); -extern void ambient(); -extern double sumambient(); -extern double makeambient(); -extern void extambient(); -extern int ambsync(); -extern void putambmagic(); -extern int hasambmagic(); -extern int writambval(); -extern int ambvalOK(); -extern int readambval(); -extern void lookamb(); -extern void writamb(); - -#else - /* defined in ambcomp.c */ -extern int divsample(AMBSAMP *dp, AMBHEMI *h, RAY *r); -extern double doambient(COLOR acol, RAY *r, double wt, FVECT pg, FVECT dg); -extern void inithemi(AMBHEMI *hp, RAY *r, double wt); -extern void comperrs(AMBSAMP *da, AMBHEMI *hp); -extern void posgradient(FVECT gv, AMBSAMP *da, AMBHEMI *hp); -extern void dirgradient(FVECT gv, AMBSAMP *da, AMBHEMI *hp); /* defined in ambient.c */ extern void setambres(int ar); extern void setambacc(double newa); extern void setambient(void); +extern void multambient(COLOR aval, RAY *r, FVECT nrm); extern void ambdone(void); extern void ambnotify(OBJECT obj); -extern void ambient(COLOR acol, RAY *r, FVECT nrm); extern double sumambient(COLOR acol, RAY *r, FVECT rn, int al, AMBTREE *at, FVECT c0, double s); -extern double makeambient(COLOR acol, RAY *r, FVECT rn, int al); +extern double makeambient(COLOR acol, RAY *r, COLOR ac, FVECT rn, int al); extern void extambient(COLOR cr, AMBVAL *ap, FVECT pv, FVECT nv); extern int ambsync(void); + /* defined in ambcomp.c */ +extern double doambient(COLOR acol, RAY *r, COLOR ac, double wt, + FVECT pg, FVECT dg); +extern int inithemi(AMBHEMI *hp, RAY *r, COLOR ac, double wt); +extern int divsample(AMBSAMP *dp, AMBHEMI *h, RAY *r); +extern void comperrs(AMBSAMP *da, AMBHEMI *hp); +extern void posgradient(FVECT gv, AMBSAMP *da, AMBHEMI *hp); +extern void dirgradient(FVECT gv, AMBSAMP *da, AMBHEMI *hp); /* defined in ambio.c */ extern void putambmagic(FILE *fp); extern int hasambmagic(FILE *fp); @@ -163,4 +88,9 @@ extern int readambval(AMBVAL *av, FILE *fp); extern void lookamb(FILE *fp); extern void writamb(FILE *fp); + +#ifdef __cplusplus +} #endif +#endif /* _RAD_AMBIENT_H_ */ +