Back to index

radiance  4R0+20100331
otypes.h
Go to the documentation of this file.
00001 /* RCSid $Id: otypes.h,v 2.15 2004/03/28 20:33:12 schorsch Exp $ */
00002 /*
00003  *  otypes.h - defines for object types.
00004  */
00005 #ifndef _RAD_OTYPES_H_
00006 #define _RAD_OTYPES_H_
00007 #ifdef __cplusplus
00008 extern "C" {
00009 #endif
00010 
00011 typedef struct {
00012        char  *funame;                     /* function name */
00013        int  flags;                 /* type flags */
00014 #ifdef FUN_ARGLIST
00015        int  (*funp)(FUN_ARGLIST);  /* pointer to function */
00016 #else
00017        int  (*funp)();                    /* pointer to function */
00018 #endif
00019 }  FUN;
00020 
00021 #ifdef FUN_ARGLIST
00022 extern int  o_default(FUN_ARGLIST);
00023 #else
00024 extern int  o_default(); /* XXX conflict with radogl.h */
00025 #endif
00026 
00027 /* extern void initotypes(void);*/ /* XXX don't mess with the linker... */
00028 
00029                             /* object types in decreasing frequency */
00030 #define  OBJ_FACE    0             /* polygon */
00031 #define  OBJ_CONE    1             /* cone */
00032 #define  OBJ_SPHERE  2             /* sphere */
00033 #define  TEX_FUNC    3             /* surface texture function */
00034 #define  OBJ_RING    4             /* disk */
00035 #define  OBJ_CYLINDER       5             /* cylinder */
00036 #define  OBJ_INSTANCE       6             /* octree instance */
00037 #define  OBJ_CUP     7             /* inverted cone */
00038 #define  OBJ_BUBBLE  8             /* inverted sphere */
00039 #define  OBJ_TUBE    9             /* inverted cylinder */
00040 #define  OBJ_MESH    10            /* mesh instance */
00041 #define  MOD_ALIAS   11            /* modifier alias */
00042 #define  MAT_PLASTIC 12            /* plastic surface */
00043 #define  MAT_METAL   13            /* metal surface */
00044 #define  MAT_GLASS   14            /* thin glass surface */
00045 #define  MAT_TRANS   15            /* translucent material */
00046 #define  MAT_DIELECTRIC     16            /* dielectric material */
00047 #define  MAT_PLASTIC2       17            /* anisotropic plastic */
00048 #define  MAT_METAL2  18            /* anisotropic metal */
00049 #define  MAT_TRANS2  19            /* anisotropic translucent material */
00050 #define  MAT_INTERFACE      20            /* dielectric interface */
00051 #define  MAT_PFUNC   21            /* plastic brdf function */
00052 #define  MAT_MFUNC   22            /* metal brdf function */
00053 #define  PAT_BFUNC   23            /* brightness function */
00054 #define  PAT_BDATA   24            /* brightness data */
00055 #define  PAT_BTEXT   25            /* monochromatic text */
00056 #define  PAT_CPICT   26            /* color picture */
00057 #define  MAT_GLOW    27            /* proximity light source */
00058 #define  OBJ_SOURCE  28            /* distant source */
00059 #define  MAT_LIGHT   29            /* primary light source */
00060 #define  MAT_ILLUM   30            /* secondary light source */
00061 #define  MAT_SPOT    31            /* spot light source */
00062 #define  MAT_MIST    32            /* mist medium */
00063 #define  MAT_MIRROR  33            /* mirror (secondary source) */
00064 #define  MAT_TFUNC   34            /* trans brdf function */
00065 #define  MAT_BRTDF   35            /* brtd function */
00066 #define  MAT_PDATA   36            /* plastic brdf data */
00067 #define  MAT_MDATA   37            /* metal brdf data */
00068 #define  MAT_TDATA   38            /* trans brdf data */
00069 #define  PAT_CFUNC   39            /* color function */
00070 #define  MAT_CLIP    40            /* clipping surface */
00071 #define  PAT_CDATA   41            /* color data */
00072 #define  PAT_CTEXT   42            /* colored text */
00073 #define  TEX_DATA    43            /* surface texture data */
00074 #define  MIX_FUNC    44            /* mixing function */
00075 #define  MIX_DATA    45            /* mixing data */
00076 #define  MIX_TEXT    46            /* mixing text */
00077 #define  MIX_PICT    47            /* mixing picture */
00078 #define  MAT_DIRECT1 48            /* unidirecting material */
00079 #define  MAT_DIRECT2 49            /* bidirecting material */
00080                             /* number of object types */
00081 #define  NUMOTYPE    50
00082                             /* type flags */
00083 #define  T_S         01            /* surface (object) */
00084 #define  T_M         02            /* material */
00085 #define  T_P         04            /* pattern */
00086 #define  T_T         010           /* texture */
00087 #define  T_X         020           /* mixture */
00088 #define  T_V         040           /* volume */
00089 #define  T_L         0100          /* light source modifier */
00090 #define  T_LV        0200          /* virtual light source modifier */
00091 #define  T_F         0400          /* function */
00092 #define  T_D         01000         /* data */
00093 #define  T_I         02000         /* picture */
00094 #define  T_E         04000         /* text */
00095                             /* user-defined types */
00096 #define  T_SP1              010000
00097 #define  T_SP2              020000
00098 #define  T_SP3              040000
00099 
00100 extern FUN  ofun[];                /* our type list */
00101 
00102 #define  issurface(t)       (ofun[t].flags & T_S)
00103 #define  isvolume(t) (ofun[t].flags & T_V)
00104 #define  ismodifier(t)      (!(ofun[t].flags & (T_S|T_V)))
00105 #define  ismaterial(t)      (ofun[t].flags & T_M)
00106 #define  ispattern(t)       (ofun[t].flags & T_P)
00107 #define  istexture(t)       (ofun[t].flags & T_T)
00108 #define  ismixture(t)       (ofun[t].flags & T_X)
00109 #define  islight(t)  (ofun[t].flags & T_L)
00110 #define  isvlight(t) (ofun[t].flags & T_LV)
00111 #define  hasdata(t)  (ofun[t].flags & (T_D|T_I))
00112 #define  hasfunc(t)  (ofun[t].flags & (T_F|T_D|T_I))
00113 #define  hastext(t)  (ofun[t].flags & T_E)
00114 #define  isflat(t)   ((t)==OBJ_FACE || (t)==OBJ_RING)
00115 
00116 #define  ALIASKEY    "alias"                     /* alias keyword */
00117 #define  ALIASMOD    "inherit"            /* inherit target modifier */
00118 
00119                                    /* type list initialization */
00120 #define  INIT_OTYPE  {      { "polygon",  T_S,          o_default }, \
00121                             { "cone",     T_S,          o_default }, \
00122                             { "sphere",   T_S,          o_default }, \
00123                             { "texfunc",  T_T|T_F,      o_default }, \
00124                             { "ring",     T_S,          o_default }, \
00125                             { "cylinder", T_S,          o_default }, \
00126                             { "instance", T_V,          o_default }, \
00127                             { "cup",      T_S,          o_default }, \
00128                             { "bubble",   T_S,          o_default }, \
00129                             { "tube",     T_S,          o_default }, \
00130                             { "mesh",     T_V,          o_default }, \
00131                             { ALIASKEY,   0,            o_default }, \
00132                             { "plastic",  T_M,          o_default }, \
00133                             { "metal",    T_M,          o_default }, \
00134                             { "glass",    T_M,          o_default }, \
00135                             { "trans",    T_M,          o_default }, \
00136                             { "dielectric",      T_M,          o_default }, \
00137                             { "plastic2", T_M|T_F,      o_default }, \
00138                             { "metal2",   T_M|T_F,      o_default }, \
00139                             { "trans2",   T_M|T_F,      o_default }, \
00140                             { "interface",       T_M,          o_default }, \
00141                             { "plasfunc", T_M|T_F,      o_default }, \
00142                             { "metfunc",  T_M|T_F,      o_default }, \
00143                             { "brightfunc",      T_P|T_F,      o_default }, \
00144                             { "brightdata",      T_P|T_D,      o_default }, \
00145                             { "brighttext",      T_P|T_E,      o_default }, \
00146                             { "colorpict",       T_P|T_I,      o_default }, \
00147                             { "glow",     T_M|T_L,      o_default }, \
00148                             { "source",   T_S,          o_default }, \
00149                             { "light",    T_M|T_L,      o_default }, \
00150                             { "illum",    T_M|T_L,      o_default }, \
00151                             { "spotlight",       T_M|T_L,      o_default }, \
00152                             { "mist",     T_M,          o_default }, \
00153                             { "mirror",   T_M|T_LV,     o_default }, \
00154                             { "transfunc",       T_M|T_F,      o_default }, \
00155                             { "BRTDfunc", T_M|T_F,      o_default }, \
00156                             { "plasdata", T_M|T_D,      o_default }, \
00157                             { "metdata",  T_M|T_D,      o_default }, \
00158                             { "transdata",       T_M|T_D,      o_default }, \
00159                             { "colorfunc",       T_P|T_F,      o_default }, \
00160                             { "antimatter",      T_M,          o_default }, \
00161                             { "colordata",       T_P|T_D,      o_default }, \
00162                             { "colortext",       T_P|T_E,      o_default }, \
00163                             { "texdata",  T_T|T_D,      o_default }, \
00164                             { "mixfunc",  T_X|T_F,      o_default }, \
00165                             { "mixdata",  T_X|T_D,      o_default }, \
00166                             { "mixtext",  T_X|T_E,      o_default }, \
00167                             { "mixpict",  T_X|T_I,      o_default }, \
00168                             { "prism1",   T_M|T_F|T_LV, o_default }, \
00169                             { "prism2",   T_M|T_F|T_LV, o_default }, \
00170                      }
00171 
00172 
00173 #ifdef __cplusplus
00174 }
00175 #endif
00176 #endif /* _RAD_OTYPES_H_ */