Back to index

radiance  4R0+20100331
Classes | Defines | Functions | Variables
rad2mgf.c File Reference
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include "platform.h"
#include "rtmath.h"
#include "rtio.h"
#include "rtprocess.h"
#include "object.h"
#include "color.h"
#include "lookup.h"

Go to the source code of this file.

Classes

struct  vert

Defines

#define C_1SIDEDTHICK   0.005
#define hasmult   (unit_mult < .999 || unit_mult > 1.001)
#define VKLEN   64
#define mkvkey(k, v)   sprintf(k, VKFMT, (v)[0], (v)[1], (v)[2])
#define NVERTS   256

Functions

void rad2mgf (char *inp)
void cvtprim (char *inp, char *mod, char *typ, char *id, FUNARGS *fa)
void newmat (char *id, char *alias)
void setmat (char *id)
void setobj (char *id)
void init (void)
void uninit (void)
void clrverts (void)
void unspace (char *s)
void add2dispatch (char *name, int(*func)())
char * getvertid (char *vname, FVECT vp)
int o_unsupported (char *mod, char *typ, char *id, FUNARGS *fa)
int o_face (char *mod, char *typ, char *id, FUNARGS *fa)
int o_cone (char *mod, char *typ, char *id, FUNARGS *fa)
int o_sphere (char *mod, char *typ, char *id, FUNARGS *fa)
int o_cylinder (char *mod, char *typ, char *id, FUNARGS *fa)
int o_ring (char *mod, char *typ, char *id, FUNARGS *fa)
int o_instance (char *mod, char *typ, char *id, FUNARGS *fa)
int o_illum (char *mod, char *typ, char *id, FUNARGS *fa)
int o_plastic (char *mod, char *typ, char *id, FUNARGS *fa)
int o_metal (char *mod, char *typ, char *id, FUNARGS *fa)
int o_glass (char *mod, char *typ, char *id, FUNARGS *fa)
int o_dielectric (char *mod, char *typ, char *id, FUNARGS *fa)
int o_mirror (char *mod, char *typ, char *id, FUNARGS *fa)
int o_trans (char *mod, char *typ, char *id, FUNARGS *fa)
int o_light (char *mod, char *typ, char *id, FUNARGS *fa)
int main (int argc, char **argv)
int o_cone (char *mod, char *typ, char *id, register FUNARGS *fa)
int o_sphere (char *mod, char *typ, char *id, register FUNARGS *fa)
int o_cylinder (char *mod, char *typ, char *id, register FUNARGS *fa)
int o_ring (char *mod, char *typ, char *id, register FUNARGS *fa)
int o_plastic (char *mod, char *typ, char *id, register FUNARGS *fa)
int o_metal (char *mod, char *typ, char *id, register FUNARGS *fa)
int o_glass (char *mod, char *typ, char *id, register FUNARGS *fa)
int o_dielectric (char *mod, char *typ, char *id, register FUNARGS *fa)
int o_mirror (char *mod, char *typ, char *id, register FUNARGS *fa)
int o_trans (char *mod, char *typ, char *id, register FUNARGS *fa)
int o_light (char *mod, char *typ, char *id, register FUNARGS *fa)

Variables

static const char RCSid [] = "$Id: rad2mgf.c,v 2.25 2005/12/28 18:39:07 greg Exp $"
LUTAB rmats = LU_SINIT(free,NULL)
LUTAB rdispatch = LU_SINIT(NULL,NULL)
char curmat [80]
char curobj [128] = "Untitled"
double unit_mult = 1.
char VKFMT [] = "%+16.9e %+16.9e %+16.9e"
long vclock
struct vert vert [NVERTS]
LUTAB vertab = LU_SINIT(free,NULL)

Class Documentation

struct vert

Definition at line 46 of file rad2mgf.c.

Class Members
long lused
FVECT p

Define Documentation

#define C_1SIDEDTHICK   0.005

Definition at line 20 of file rad2mgf.c.

#define hasmult   (unit_mult < .999 || unit_mult > 1.001)

Definition at line 32 of file rad2mgf.c.

#define mkvkey (   k,
  v 
)    sprintf(k, VKFMT, (v)[0], (v)[1], (v)[2])

Definition at line 41 of file rad2mgf.c.

#define NVERTS   256

Definition at line 43 of file rad2mgf.c.

#define VKLEN   64

Definition at line 39 of file rad2mgf.c.


Function Documentation

void add2dispatch ( char *  name,
int(*)()  func 
)
void clrverts ( void  )
void cvtprim ( char *  inp,
char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)
char* getvertid ( char *  vname,
FVECT  vp 
)
void init ( void  )
int main ( int  argc,
char **  argv 
)

Definition at line 83 of file rad2mgf.c.

{
       int    i;

       for (i = 1; i < argc && argv[i][0] == '-'; i++)
              switch (argv[i][1]) {
              case 'd':                   /* units */
                     switch (argv[i][2]) {
                     case 'm':                   /* meters */
                            unit_mult = 1.;
                            break;
                     case 'c':                   /* centimeters */
                            unit_mult = .01;
                            break;
                     case 'f':                   /* feet */
                            unit_mult = 12.*.0254;
                            break;
                     case 'i':                   /* inches */
                            unit_mult = .0254;
                            break;
                     default:
                            goto unkopt;
                     }
                     break;
              default:
                     goto unkopt;
              }
       init();
       if (i >= argc)
              rad2mgf(NULL);
       else
              for ( ; i < argc; i++)
                     rad2mgf(argv[i]);
       uninit();
       exit(0);
unkopt:
       fprintf(stderr, "Usage: %s [-d{m|c|f|i}] file ..\n", argv[0]);
       exit(1);
}

Here is the call graph for this function:

void newmat ( char *  id,
char *  alias 
)
int o_cone ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)

Definition at line 451 of file rad2mgf.c.

{
       char   v1[6], v2[6];

       if (fa->nfargs != 8)
              return(-1);
       setmat(mod);
       setobj(id);
       getvertid(v1, fa->farg);
       getvertid(v2, fa->farg + 3);
       if (typ[1] == 'u')                 /* cup -> inverted cone */
              printf("cone %s %.12g %s %.12g\n",
                            v1, -fa->farg[6], v2, -fa->farg[7]);
       else
              printf("cone %s %.12g %s %.12g\n",
                            v1, fa->farg[6], v2, fa->farg[7]);
       return(0);
}

Here is the call graph for this function:

int o_cone ( char *  mod,
char *  typ,
char *  id,
register FUNARGS fa 
)

Definition at line 518 of file rad2mgf.c.

{
       char   v1[6], v2[6];

       if (fa->nfargs != 8)
              return(-1);
       setmat(mod);
       setobj(id);
       getvertid(v1, fa->farg);
       getvertid(v2, fa->farg + 3);
       if (typ[1] == 'u')                 /* cup -> inverted cone */
              printf("cone %s %.12g %s %.12g\n",
                            v1, -fa->farg[6], v2, -fa->farg[7]);
       else
              printf("cone %s %.12g %s %.12g\n",
                            v1, fa->farg[6], v2, fa->farg[7]);
       return(0);
}

Here is the call graph for this function:

int o_cylinder ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)

Definition at line 491 of file rad2mgf.c.

{
       char   v1[6], v2[6];

       if (fa->nfargs != 7)
              return(-1);
       setmat(mod);
       setobj(id);
       getvertid(v1, fa->farg);
       getvertid(v2, fa->farg + 3);
       printf("cyl %s %.12g %s\n", v1,
                     typ[0]=='t' ? -fa->farg[6] : fa->farg[6], v2);
       return(0);
}

Here is the call graph for this function:

int o_cylinder ( char *  mod,
char *  typ,
char *  id,
register FUNARGS fa 
)

Definition at line 564 of file rad2mgf.c.

{
       char   v1[6], v2[6];

       if (fa->nfargs != 7)
              return(-1);
       setmat(mod);
       setobj(id);
       getvertid(v1, fa->farg);
       getvertid(v2, fa->farg + 3);
       printf("cyl %s %.12g %s\n", v1,
                     typ[0]=='t' ? -fa->farg[6] : fa->farg[6], v2);
       return(0);
}

Here is the call graph for this function:

int o_dielectric ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)

Definition at line 683 of file rad2mgf.c.

{
       COLOR  cxyz, trgb;
       double F, d;
       register int  i;

       if (fa->nfargs != 5)
              return(-1);
       newmat(id, NULL);
       F = (1. - fa->farg[3])/(1. + fa->farg[3]);       /* normal incidence */
       F *= F;
       for (i = 0; i < 3; i++)
              trgb[i] = (1. - F)*pow(fa->farg[i], C_1SIDEDTHICK/unit_mult);
       printf("\tir %f 0\n", fa->farg[3]);       /* put index of refraction */
       printf("\tsides 1\n");
       puts("\tc");                       /* put reflected component */
       printf("\trs %.4f 0\n", F);
       rgb_cie(cxyz, trgb);               /* put transmitted component */
       puts("\tc");
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\tts %.4f 0\n", cxyz[1]);
       return(0);
}

Here is the call graph for this function:

int o_dielectric ( char *  mod,
char *  typ,
char *  id,
register FUNARGS fa 
)

Definition at line 777 of file rad2mgf.c.

{
       COLOR  cxyz, trgb;
       double F, d;
       register int  i;

       if (fa->nfargs != 5)
              return(-1);
       newmat(id, NULL);
       F = (1. - fa->farg[3])/(1. + fa->farg[3]);       /* normal incidence */
       F *= F;
       for (i = 0; i < 3; i++)
              trgb[i] = (1. - F)*pow(fa->farg[i], C_1SIDEDTHICK/unit_mult);
       printf("\tir %f 0\n", fa->farg[3]);       /* put index of refraction */
       printf("\tsides 1\n");
       puts("\tc");                       /* put reflected component */
       printf("\trs %.4f 0\n", F);
       rgb_cie(cxyz, trgb);               /* put transmitted component */
       puts("\tc");
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\tts %.4f 0\n", cxyz[1]);
       return(0);
}

Here is the call graph for this function:

int o_face ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)
int o_glass ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)

Definition at line 644 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb, trgb;
       double nrfr = 1.52, F, d;
       register int  i;

       if (fa->nfargs != 3 && fa->nfargs != 4)
              return(-1);
       newmat(id, NULL);
       if (fa->nfargs == 4)
              nrfr = fa->farg[3];
       printf("\tir %f 0\n", nrfr);
       F = (1. - nrfr)/(1. + nrfr);              /* use normal incidence */
       F *= F;
       for (i = 0; i < 3; i++) {
              trgb[i] = fa->farg[i] * (1. - F)*(1. - F) /
                            (1. - F*F*fa->farg[i]*fa->farg[i]);
              rrgb[i] = F * (1. + (1. - 2.*F)*fa->farg[i]) /
                            (1. - F*F*fa->farg[i]*fa->farg[i]);
       }
       rgb_cie(cxyz, rrgb);               /* put reflected component */
       puts("\tc");
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\trs %.4f 0\n", cxyz[1]);
       rgb_cie(cxyz, trgb);               /* put transmitted component */
       puts("\tc");
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\tts %.4f 0\n", cxyz[1]);
       return(0);
}

Here is the call graph for this function:

int o_glass ( char *  mod,
char *  typ,
char *  id,
register FUNARGS fa 
)

Definition at line 735 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb, trgb;
       double nrfr = 1.52, F, d;
       register int  i;

       if (fa->nfargs != 3 && fa->nfargs != 4)
              return(-1);
       newmat(id, NULL);
       if (fa->nfargs == 4)
              nrfr = fa->farg[3];
       printf("\tir %f 0\n", nrfr);
       F = (1. - nrfr)/(1. + nrfr);              /* use normal incidence */
       F *= F;
       for (i = 0; i < 3; i++) {
              trgb[i] = fa->farg[i] * (1. - F)*(1. - F) /
                            (1. - F*F*fa->farg[i]*fa->farg[i]);
              rrgb[i] = F * (1. + (1. - 2.*F)*fa->farg[i]) /
                            (1. - F*F*fa->farg[i]*fa->farg[i]);
       }
       rgb_cie(cxyz, rrgb);               /* put reflected component */
       puts("\tc");
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\trs %.4f 0\n", cxyz[1]);
       rgb_cie(cxyz, trgb);               /* put transmitted component */
       puts("\tc");
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\tts %.4f 0\n", cxyz[1]);
       return(0);
}

Here is the call graph for this function:

int o_illum ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)
int o_instance ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)
int o_light ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)

Definition at line 778 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb;
       double d;

       if (fa->nfargs < 3)
              return(-1);
       newmat(id, NULL);
       rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2];
       rgb_cie(cxyz, rrgb);
       d = cxyz[0] + cxyz[1] + cxyz[2];
       puts("\tc");
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\ted %.4g\n", cxyz[1]*(PI*WHTEFFICACY));
       return(0);
}

Here is the call graph for this function:

int o_light ( char *  mod,
char *  typ,
char *  id,
register FUNARGS fa 
)

Definition at line 881 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb;
       double d;

       if (fa->nfargs < 3)
              return(-1);
       newmat(id, NULL);
       rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2];
       rgb_cie(cxyz, rrgb);
       d = cxyz[0] + cxyz[1] + cxyz[2];
       puts("\tc");
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\ted %.4g\n", cxyz[1]*(PI*WHTEFFICACY));
       return(0);
}

Here is the call graph for this function:

int o_metal ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)

Definition at line 618 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb;
       double d;

       if (fa->nfargs != (typ[5]=='2' ? 6 : 5))
              return(-1);
       newmat(id, NULL);
       rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2];
       rgb_cie(cxyz, rrgb);
       puts("\tc");                       /* put diffuse component */
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3]));
                                          /* put specular component */
       printf("\trs %.4f %.4f\n", cxyz[1]*fa->farg[3],
                     typ[5]=='2' ? .5*(fa->farg[4] + fa->farg[5]) :
                                   fa->farg[4]);
       return(0);
}

Here is the call graph for this function:

int o_metal ( char *  mod,
char *  typ,
char *  id,
register FUNARGS fa 
)

Definition at line 706 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb;
       double d;

       if (fa->nfargs != (typ[5]=='2' ? 6 : 5))
              return(-1);
       newmat(id, NULL);
       rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2];
       rgb_cie(cxyz, rrgb);
       puts("\tc");                       /* put diffuse component */
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3]));
                                          /* put specular component */
       printf("\trs %.4f %.4f\n", cxyz[1]*fa->farg[3],
                     typ[5]=='2' ? .5*(fa->farg[4] + fa->farg[5]) :
                                   fa->farg[4]);
       return(0);
}

Here is the call graph for this function:

int o_mirror ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)

Definition at line 713 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb;
       double d;

       if (fa->nsargs == 1) {                    /* use alternate material */
              newmat(id, fa->sarg[0]);
              return(0);
       }
       if (fa->nfargs != 3)
              return(-1);
       newmat(id, NULL);
       rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2];
       rgb_cie(cxyz, rrgb);
       puts("\tc");                       /* put specular component */
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\trs %.4f 0\n", cxyz[1]);
       return(0);
}

Here is the call graph for this function:

int o_mirror ( char *  mod,
char *  typ,
char *  id,
register FUNARGS fa 
)

Definition at line 810 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb;
       double d;

       if (fa->nsargs == 1) {                    /* use alternate material */
              newmat(id, fa->sarg[0]);
              return(0);
       }
       if (fa->nfargs != 3)
              return(-1);
       newmat(id, NULL);
       rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2];
       rgb_cie(cxyz, rrgb);
       puts("\tc");                       /* put specular component */
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\trs %.4f 0\n", cxyz[1]);
       return(0);
}

Here is the call graph for this function:

int o_plastic ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)

Definition at line 590 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb;
       double d;

       if (fa->nfargs != (typ[7]=='2' ? 6 : 5))
              return(-1);
       newmat(id, NULL);
       rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2];
       rgb_cie(cxyz, rrgb);
       puts("\tc");                       /* put diffuse component */
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3]));
       if (fa->farg[3] > FTINY) {         /* put specular component */
              puts("\tc");
              printf("\trs %.4f %.4f\n", fa->farg[3],
                            typ[7]=='2' ? .5*(fa->farg[4] + fa->farg[5]) :
                                          fa->farg[4]);
       }
       return(0);
}

Here is the call graph for this function:

int o_plastic ( char *  mod,
char *  typ,
char *  id,
register FUNARGS fa 
)

Definition at line 675 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb;
       double d;

       if (fa->nfargs != (typ[7]=='2' ? 6 : 5))
              return(-1);
       newmat(id, NULL);
       rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2];
       rgb_cie(cxyz, rrgb);
       puts("\tc");                       /* put diffuse component */
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3]));
       if (fa->farg[3] > FTINY) {         /* put specular component */
              puts("\tc");
              printf("\trs %.4f %.4f\n", fa->farg[3],
                            typ[7]=='2' ? .5*(fa->farg[4] + fa->farg[5]) :
                                          fa->farg[4]);
       }
       return(0);
}

Here is the call graph for this function:

int o_ring ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)

Definition at line 510 of file rad2mgf.c.

{
       if (fa->nfargs != 8)
              return(-1);
       setmat(mod);
       setobj(id);
       printf("v cent =\n\tp %.12g %.12g %.12g\n",
                     fa->farg[0], fa->farg[1], fa->farg[2]);
       printf("\tn %.12g %.12g %.12g\n",
                     fa->farg[3], fa->farg[4], fa->farg[5]);
       if (fa->farg[6] < fa->farg[7])
              printf("ring cent %.12g %.12g\n",
                            fa->farg[6], fa->farg[7]);
       else
              printf("ring cent %.12g %.12g\n",
                            fa->farg[7], fa->farg[6]);
       return(0);
}

Here is the call graph for this function:

int o_ring ( char *  mod,
char *  typ,
char *  id,
register FUNARGS fa 
)

Definition at line 586 of file rad2mgf.c.

{
       if (fa->nfargs != 8)
              return(-1);
       setmat(mod);
       setobj(id);
       printf("v cent =\n\tp %.12g %.12g %.12g\n",
                     fa->farg[0], fa->farg[1], fa->farg[2]);
       printf("\tn %.12g %.12g %.12g\n",
                     fa->farg[3], fa->farg[4], fa->farg[5]);
       if (fa->farg[6] < fa->farg[7])
              printf("ring cent %.12g %.12g\n",
                            fa->farg[6], fa->farg[7]);
       else
              printf("ring cent %.12g %.12g\n",
                            fa->farg[7], fa->farg[6]);
       return(0);
}

Here is the call graph for this function:

int o_sphere ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)

Definition at line 474 of file rad2mgf.c.

{
       char   cent[6];

       if (fa->nfargs != 4)
              return(-1);
       setmat(mod);
       setobj(id);
       printf("sph %s %.12g\n", getvertid(cent, fa->farg),
                     typ[0]=='b' ? -fa->farg[3] : fa->farg[3]);
       return(0);
}

Here is the call graph for this function:

int o_sphere ( char *  mod,
char *  typ,
char *  id,
register FUNARGS fa 
)

Definition at line 544 of file rad2mgf.c.

{
       char   cent[6];

       if (fa->nfargs != 4)
              return(-1);
       setmat(mod);
       setobj(id);
       printf("sph %s %.12g\n", getvertid(cent, fa->farg),
                     typ[0]=='b' ? -fa->farg[3] : fa->farg[3]);
       return(0);
}

Here is the call graph for this function:

int o_trans ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)

Definition at line 739 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb;
       double rough, trans, tspec, d;

       if (typ[4] == '2') {        /* trans2 */
              if (fa->nfargs != 8)
                     return(-1);
              rough = .5*(fa->farg[4] + fa->farg[5]);
              trans = fa->farg[6];
              tspec = fa->farg[7];
       } else {                    /* trans */
              if (fa->nfargs != 7)
                     return(-1);
              rough = fa->farg[4];
              trans = fa->farg[5];
              tspec = fa->farg[6];
       }
       newmat(id, NULL);
       rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2];
       rgb_cie(cxyz, rrgb);
       puts("\tc");                       /* put transmitted diffuse */
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\ttd %.4f\n", cxyz[1]*trans*(1. - fa->farg[3])*(1. - tspec));
                                          /* put transmitted specular */
       printf("\tts %.4f %.4f\n", cxyz[1]*trans*tspec*(1. - fa->farg[3]), rough);
                                          /* put reflected diffuse */
       printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3])*(1. - trans));
       puts("\tc");                       /* put reflected specular */
       printf("\trs %.4f %.4f\n", fa->farg[3], rough);
       return(0);
}

Here is the call graph for this function:

int o_trans ( char *  mod,
char *  typ,
char *  id,
register FUNARGS fa 
)

Definition at line 839 of file rad2mgf.c.

{
       COLOR  cxyz, rrgb;
       double rough, trans, tspec, d;

       if (typ[4] == '2') {        /* trans2 */
              if (fa->nfargs != 8)
                     return(-1);
              rough = .5*(fa->farg[4] + fa->farg[5]);
              trans = fa->farg[6];
              tspec = fa->farg[7];
       } else {                    /* trans */
              if (fa->nfargs != 7)
                     return(-1);
              rough = fa->farg[4];
              trans = fa->farg[5];
              tspec = fa->farg[6];
       }
       newmat(id, NULL);
       rrgb[0] = fa->farg[0]; rrgb[1] = fa->farg[1]; rrgb[2] = fa->farg[2];
       rgb_cie(cxyz, rrgb);
       puts("\tc");                       /* put transmitted diffuse */
       d = cxyz[0] + cxyz[1] + cxyz[2];
       if (d > FTINY)
              printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
       printf("\ttd %.4f\n", cxyz[1]*trans*(1. - fa->farg[3])*(1. - tspec));
                                          /* put transmitted specular */
       printf("\tts %.4f %.4f\n", cxyz[1]*trans*tspec*(1. - fa->farg[3]), rough);
                                          /* put reflected diffuse */
       printf("\trd %.4f\n", cxyz[1]*(1. - fa->farg[3])*(1. - trans));
       puts("\tc");                       /* put reflected specular */
       printf("\trs %.4f %.4f\n", fa->farg[3], rough);
       return(0);
}

Here is the call graph for this function:

int o_unsupported ( char *  mod,
char *  typ,
char *  id,
FUNARGS fa 
)
void rad2mgf ( char *  inp)
void setmat ( char *  id)
void setobj ( char *  id)
void uninit ( void  )
void unspace ( char *  s)

Definition at line 207 of file rad2mgf.c.

{
       while (*s) {
              if (isspace(*s))
                     *s = '_';
              ++s;
       }
}

Variable Documentation

char curmat[80]

Definition at line 27 of file rad2mgf.c.

char curobj[128] = "Untitled"

Definition at line 28 of file rad2mgf.c.

const char RCSid[] = "$Id: rad2mgf.c,v 2.25 2005/12/28 18:39:07 greg Exp $" [static]

Definition at line 2 of file rad2mgf.c.

LUTAB rdispatch = LU_SINIT(NULL,NULL)

Definition at line 25 of file rad2mgf.c.

LUTAB rmats = LU_SINIT(free,NULL)

Definition at line 23 of file rad2mgf.c.

double unit_mult = 1.

Definition at line 30 of file rad2mgf.c.

long vclock

Definition at line 45 of file rad2mgf.c.

struct vert vert[NVERTS]
LUTAB vertab = LU_SINIT(free,NULL)

Definition at line 52 of file rad2mgf.c.

char VKFMT[] = "%+16.9e %+16.9e %+16.9e"

Definition at line 38 of file rad2mgf.c.