Back to index

radiance  4R0+20100331
Functions | Variables
p_data.c File Reference
#include "copyright.h"
#include "ray.h"
#include "data.h"
#include "func.h"
#include "rtotypes.h"

Go to the source code of this file.

Functions

int p_bdata (register OBJREC *m, RAY *r)
int p_cdata (register OBJREC *m, RAY *r)
int p_pdata (register OBJREC *m, RAY *r)

Variables

static const char RCSid [] = "$Id: p_data.c,v 2.8 2004/03/30 16:13:01 schorsch Exp $"

Function Documentation

int p_bdata ( register OBJREC m,
RAY r 
)

Definition at line 50 of file p_data.c.

{
       double  bval;
       double  pt[MAXDIM];
       DATARRAY  *dp;
       register MFUNC  *mf;
       register int  i;

       if (m->oargs.nsargs < 4)
              objerror(m, USER, "bad # arguments");
       dp = getdata(m->oargs.sarg[1]);
       i = (1 << dp->nd) - 1;
       mf = getfunc(m, 2, i<<3, 0);
       setfunc(m, r);
       errno = 0;
       for (i = dp->nd; i-- > 0; ) {
              pt[i] = evalue(mf->ep[i]);
              if (errno == EDOM || errno == ERANGE)
                     goto computerr;
       }
       bval = datavalue(dp, pt);
       errno = 0;
       bval = funvalue(m->oargs.sarg[0], 1, &bval);
       if (errno == EDOM || errno == ERANGE)
              goto computerr;
       scalecolor(r->pcol, bval);
       return(0);
computerr:
       objerror(m, WARNING, "compute error");
       return(0);
}

Here is the call graph for this function:

int p_cdata ( register OBJREC m,
RAY r 
)

Definition at line 87 of file p_data.c.

{
       double  col[3];
       COLOR  cval;
       double  pt[MAXDIM];
       int  nv;
       DATARRAY  *dp;
       register MFUNC  *mf;
       register int  i;

       if (m->oargs.nsargs < 8)
              objerror(m, USER, "bad # arguments");
       dp = getdata(m->oargs.sarg[3]);
       i = (1 << (nv = dp->nd)) - 1;
       mf = getfunc(m, 6, i<<7, 0);
       setfunc(m, r);
       errno = 0;
       for (i = 0; i < nv; i++) {
              pt[i] = evalue(mf->ep[i]);
              if (errno == EDOM || errno == ERANGE)
                     goto computerr;
       }
       col[0] = datavalue(dp, pt);
       for (i = 1; i < 3; i++) {
              dp = getdata(m->oargs.sarg[i+3]);
              if (dp->nd != nv)
                     objerror(m, USER, "dimension error");
              col[i] = datavalue(dp, pt);
       }
       errno = 0;
       for (i = 0; i < 3; i++)
              if (fundefined(m->oargs.sarg[i]) < 3)
                     colval(cval,i) = funvalue(m->oargs.sarg[i], 1, col+i);
              else
                     colval(cval,i) = funvalue(m->oargs.sarg[i], 3, col);
       if (errno == EDOM || errno == ERANGE)
              goto computerr;
       multcolor(r->pcol, cval);
       return(0);
computerr:
       objerror(m, WARNING, "compute error");
       return(0);
}

Here is the call graph for this function:

int p_pdata ( register OBJREC m,
RAY r 
)

Definition at line 136 of file p_data.c.

{
       double  col[3];
       COLOR  cval;
       double  pt[2];
       DATARRAY  *dp;
       register MFUNC  *mf;
       register int  i;

       if (m->oargs.nsargs < 7)
              objerror(m, USER, "bad # arguments");
       mf = getfunc(m, 4, 0x3<<5, 0);
       setfunc(m, r);
       errno = 0;
       pt[1] = evalue(mf->ep[0]);  /* y major ordering */
       pt[0] = evalue(mf->ep[1]);
       if (errno == EDOM || errno == ERANGE)
              goto computerr;
       dp = getpict(m->oargs.sarg[3]);
       for (i = 0; i < 3; i++)
              col[i] = datavalue(dp+i, pt);
       errno = 0;
       for (i = 0; i < 3; i++)
              if (fundefined(m->oargs.sarg[i]) < 3)
                     colval(cval,i) = funvalue(m->oargs.sarg[i], 1, col+i);
              else
                     colval(cval,i) = funvalue(m->oargs.sarg[i], 3, col);
       if (errno == EDOM || errno == ERANGE)
              goto computerr;
       multcolor(r->pcol, cval);
       return(0);

computerr:
       objerror(m, WARNING, "compute error");
       return(0);
}

Here is the call graph for this function:


Variable Documentation

const char RCSid[] = "$Id: p_data.c,v 2.8 2004/03/30 16:13:01 schorsch Exp $" [static]

Definition at line 2 of file p_data.c.