10 |
|
|
11 |
|
typedef struct { |
12 |
|
char *funame; /* function name */ |
13 |
+ |
int flags; /* type flags */ |
14 |
|
int (*funp)(); /* pointer to function */ |
15 |
|
} FUN; |
16 |
< |
/* surface types */ |
17 |
< |
#define OBJ_MIN 0 |
18 |
< |
#define OBJ_SOURCE (OBJ_MIN+0) /* distant source */ |
19 |
< |
#define OBJ_SPHERE (OBJ_MIN+1) /* sphere */ |
20 |
< |
#define OBJ_BUBBLE (OBJ_MIN+2) /* inverted sphere */ |
21 |
< |
#define OBJ_FACE (OBJ_MIN+3) /* polygon */ |
22 |
< |
#define OBJ_CONE (OBJ_MIN+4) /* cone */ |
23 |
< |
#define OBJ_CUP (OBJ_MIN+5) /* inverted cone */ |
24 |
< |
#define OBJ_CYLINDER (OBJ_MIN+6) /* cylinder */ |
25 |
< |
#define OBJ_TUBE (OBJ_MIN+7) /* inverted cylinder */ |
26 |
< |
#define OBJ_RING (OBJ_MIN+8) /* disk */ |
27 |
< |
#define OBJ_INSTANCE (OBJ_MIN+9) /* octree instance */ |
28 |
< |
#define OBJ_CNT 10 |
29 |
< |
/* material types */ |
30 |
< |
#define MOD_MIN MAT_MIN |
31 |
< |
#define MAT_MIN (OBJ_MIN+OBJ_CNT) |
32 |
< |
#define MAT_LIGHT (MAT_MIN+0) /* primary light source */ |
33 |
< |
#define MAT_ILLUM (MAT_MIN+1) /* secondary light source */ |
34 |
< |
#define MAT_GLOW (MAT_MIN+2) /* proximity light source */ |
35 |
< |
#define MAT_SPOT (MAT_MIN+3) /* spot light source */ |
36 |
< |
#define MAT_PLASTIC (MAT_MIN+4) /* plastic surface */ |
37 |
< |
#define MAT_METAL (MAT_MIN+5) /* metal surface */ |
38 |
< |
#define MAT_TRANS (MAT_MIN+6) /* translucent material */ |
39 |
< |
#define MAT_DIELECTRIC (MAT_MIN+7) /* dielectric material */ |
40 |
< |
#define MAT_INTERFACE (MAT_MIN+8) /* dielectric interface */ |
41 |
< |
#define MAT_GLASS (MAT_MIN+9) /* thin glass surface */ |
42 |
< |
#define MAT_CLIP (MAT_MIN+10) /* clipping surface */ |
43 |
< |
#define MAT_CNT 11 |
44 |
< |
/* textures and patterns */ |
45 |
< |
#define TP_MIN (MAT_MIN+MAT_CNT) |
46 |
< |
#define TEX_FUNC (TP_MIN+0) /* surface texture function */ |
47 |
< |
#define TEX_DATA (TP_MIN+1) /* surface texture data */ |
48 |
< |
#define PAT_CFUNC (TP_MIN+2) /* color function */ |
49 |
< |
#define PAT_BFUNC (TP_MIN+3) /* brightness function */ |
50 |
< |
#define PAT_CPICT (TP_MIN+4) /* color picture */ |
51 |
< |
#define PAT_CDATA (TP_MIN+5) /* color data */ |
52 |
< |
#define PAT_BDATA (TP_MIN+6) /* brightness data */ |
53 |
< |
#define PAT_CTEXT (TP_MIN+7) /* colored text */ |
54 |
< |
#define PAT_BTEXT (TP_MIN+8) /* monochromatic text */ |
54 |
< |
#define MIX_FUNC (TP_MIN+9) /* mixing function */ |
55 |
< |
#define MIX_DATA (TP_MIN+10) /* mixing data */ |
56 |
< |
#define MIX_TEXT (TP_MIN+11) /* mixing text */ |
57 |
< |
#define TP_CNT 12 |
58 |
< |
#define MOD_CNT (MAT_CNT+TP_CNT) |
16 |
> |
/* object types in decreasing frequency */ |
17 |
> |
#define OBJ_FACE 0 /* polygon */ |
18 |
> |
#define OBJ_CONE 1 /* cone */ |
19 |
> |
#define OBJ_SPHERE 2 /* sphere */ |
20 |
> |
#define TEX_FUNC 3 /* surface texture function */ |
21 |
> |
#define OBJ_RING 4 /* disk */ |
22 |
> |
#define OBJ_CYLINDER 5 /* cylinder */ |
23 |
> |
#define OBJ_INSTANCE 6 /* octree instance */ |
24 |
> |
#define OBJ_CUP 7 /* inverted cone */ |
25 |
> |
#define OBJ_BUBBLE 8 /* inverted sphere */ |
26 |
> |
#define OBJ_TUBE 9 /* inverted cylinder */ |
27 |
> |
#define MAT_PLASTIC 10 /* plastic surface */ |
28 |
> |
#define MAT_METAL 11 /* metal surface */ |
29 |
> |
#define OBJ_SOURCE 12 /* distant source */ |
30 |
> |
#define MAT_GLASS 13 /* thin glass surface */ |
31 |
> |
#define MAT_TRANS 14 /* translucent material */ |
32 |
> |
#define MAT_DIELECTRIC 15 /* dielectric material */ |
33 |
> |
#define MAT_INTERFACE 16 /* dielectric interface */ |
34 |
> |
#define MAT_PFUNC 17 /* plastic brdf function */ |
35 |
> |
#define MAT_MFUNC 18 /* metal brdf function */ |
36 |
> |
#define PAT_BFUNC 19 /* brightness function */ |
37 |
> |
#define PAT_BDATA 20 /* brightness data */ |
38 |
> |
#define PAT_BTEXT 21 /* monochromatic text */ |
39 |
> |
#define PAT_CPICT 22 /* color picture */ |
40 |
> |
#define MAT_LIGHT 23 /* primary light source */ |
41 |
> |
#define MAT_ILLUM 24 /* secondary light source */ |
42 |
> |
#define MAT_GLOW 25 /* proximity light source */ |
43 |
> |
#define MAT_BRTDF 26 /* brtd function */ |
44 |
> |
#define MAT_PDATA 27 /* plastic brdf data */ |
45 |
> |
#define MAT_MDATA 28 /* metal brdf data */ |
46 |
> |
#define MAT_SPOT 29 /* spot light source */ |
47 |
> |
#define PAT_CFUNC 30 /* color function */ |
48 |
> |
#define MAT_CLIP 31 /* clipping surface */ |
49 |
> |
#define PAT_CDATA 32 /* color data */ |
50 |
> |
#define PAT_CTEXT 33 /* colored text */ |
51 |
> |
#define TEX_DATA 34 /* surface texture data */ |
52 |
> |
#define MIX_FUNC 35 /* mixing function */ |
53 |
> |
#define MIX_DATA 36 /* mixing data */ |
54 |
> |
#define MIX_TEXT 37 /* mixing text */ |
55 |
|
/* number of object types */ |
56 |
< |
#define NUMOTYPE (OBJ_CNT+MAT_CNT+TP_CNT) |
56 |
> |
#define NUMOTYPE 38 |
57 |
> |
/* type flags */ |
58 |
> |
#define T_S 01 /* surface (object) */ |
59 |
> |
#define T_M 02 /* material */ |
60 |
> |
#define T_P 04 /* pattern */ |
61 |
> |
#define T_T 010 /* texture */ |
62 |
> |
#define T_X 020 /* mixture */ |
63 |
> |
#define T_V 040 /* volume */ |
64 |
> |
#define T_L 0100 /* light source modifier */ |
65 |
> |
#define T_F 0200 /* function */ |
66 |
> |
#define T_D 0400 /* data */ |
67 |
> |
#define T_I 01000 /* picture */ |
68 |
> |
#define T_E 02000 /* text */ |
69 |
> |
/* user-defined types */ |
70 |
> |
#define T_SP1 010000 |
71 |
> |
#define T_SP2 020000 |
72 |
> |
#define T_SP3 040000 |
73 |
|
|
74 |
< |
#define issurface(t) ((t) >= OBJ_MIN && (t) < OBJ_MIN+OBJ_CNT) |
63 |
< |
#define ismodifier(t) ((t) >= MOD_MIN && (t) < MOD_MIN+MOD_CNT) |
64 |
< |
#define ismaterial(t) ((t) >= MAT_MIN && (t) < MAT_MIN+MAT_CNT) |
65 |
< |
#define istexture(t) ((t) >= TP_MIN && (t) < TP_MIN+TP_CNT) |
74 |
> |
extern FUN ofun[]; /* our type list */ |
75 |
|
|
76 |
< |
extern int o_source(); |
77 |
< |
extern int o_sphere(); |
78 |
< |
extern int o_face(); |
79 |
< |
extern int o_cone(); |
80 |
< |
extern int o_instance(); |
81 |
< |
extern int m_light(); |
82 |
< |
extern int m_normal(); |
83 |
< |
extern int m_dielectric(); |
84 |
< |
extern int m_glass(); |
76 |
< |
extern int m_clip(); |
77 |
< |
extern int t_func(), t_data(); |
78 |
< |
extern int p_cfunc(), p_bfunc(); |
79 |
< |
extern int p_pdata(), p_cdata(), p_bdata(); |
80 |
< |
extern int mx_func(), mx_data(); |
81 |
< |
extern int text(); |
76 |
> |
#define issurface(t) (ofun[t].flags & T_S) |
77 |
> |
#define isvolume(t) (ofun[t].flags & T_V) |
78 |
> |
#define ismodifier(t) (!issurface(t)) |
79 |
> |
#define ismaterial(t) (ofun[t].flags & T_M) |
80 |
> |
#define istexture(t) (ofun[t].flags & (T_P|T_T|T_X)) |
81 |
> |
#define islight(t) (ofun[t].flags & T_L) |
82 |
> |
#define hasdata(t) (ofun[t].flags & (T_D|T_I)) |
83 |
> |
#define hasfunc(t) (ofun[t].flags & (T_F|T_D|T_I)) |
84 |
> |
#define hastext(t) (ofun[t].flags & T_E) |
85 |
|
|
86 |
< |
#define INIT_OTYPE { { "source", o_source }, \ |
87 |
< |
{ "sphere", o_sphere }, \ |
88 |
< |
{ "bubble", o_sphere }, \ |
89 |
< |
{ "polygon", o_face }, \ |
90 |
< |
{ "cone", o_cone }, \ |
91 |
< |
{ "cup", o_cone }, \ |
92 |
< |
{ "cylinder", o_cone }, \ |
93 |
< |
{ "tube", o_cone }, \ |
94 |
< |
{ "ring", o_cone }, \ |
95 |
< |
{ "instance", o_instance }, \ |
96 |
< |
{ "light", m_light }, \ |
97 |
< |
{ "illum", m_light }, \ |
98 |
< |
{ "glow", m_light }, \ |
99 |
< |
{ "spotlight", m_light }, \ |
100 |
< |
{ "plastic", m_normal }, \ |
101 |
< |
{ "metal", m_normal }, \ |
102 |
< |
{ "trans", m_normal }, \ |
103 |
< |
{ "dielectric", m_dielectric }, \ |
104 |
< |
{ "interface", m_dielectric }, \ |
105 |
< |
{ "glass", m_glass }, \ |
106 |
< |
{ "antimatter", m_clip }, \ |
107 |
< |
{ "texfunc", t_func }, \ |
108 |
< |
{ "texdata", t_data }, \ |
109 |
< |
{ "colorfunc", p_cfunc }, \ |
110 |
< |
{ "brightfunc", p_bfunc }, \ |
111 |
< |
{ "colorpict", p_pdata }, \ |
112 |
< |
{ "colordata", p_cdata }, \ |
113 |
< |
{ "brightdata", p_bdata }, \ |
114 |
< |
{ "colortext", text }, \ |
115 |
< |
{ "brighttext", text }, \ |
116 |
< |
{ "mixfunc", mx_func }, \ |
117 |
< |
{ "mixdata", mx_data }, \ |
118 |
< |
{ "mixtext", text } } |
86 |
> |
extern int o_default(); |
87 |
> |
/* type list initialization */ |
88 |
> |
#define INIT_OTYPE { { "polygon", T_S, o_default }, \ |
89 |
> |
{ "cone", T_S, o_default }, \ |
90 |
> |
{ "sphere", T_S, o_default }, \ |
91 |
> |
{ "texfunc", T_T|T_F, o_default }, \ |
92 |
> |
{ "ring", T_S, o_default }, \ |
93 |
> |
{ "cylinder", T_S, o_default }, \ |
94 |
> |
{ "instance", T_S|T_V, o_default }, \ |
95 |
> |
{ "cup", T_S, o_default }, \ |
96 |
> |
{ "bubble", T_S, o_default }, \ |
97 |
> |
{ "tube", T_S, o_default }, \ |
98 |
> |
{ "plastic", T_M, o_default }, \ |
99 |
> |
{ "metal", T_M, o_default }, \ |
100 |
> |
{ "source", T_S, o_default }, \ |
101 |
> |
{ "glass", T_M, o_default }, \ |
102 |
> |
{ "trans", T_M, o_default }, \ |
103 |
> |
{ "dielectric", T_M, o_default }, \ |
104 |
> |
{ "interface", T_M, o_default }, \ |
105 |
> |
{ "plasfunc", T_M|T_F, o_default }, \ |
106 |
> |
{ "metfunc", T_M|T_F, o_default }, \ |
107 |
> |
{ "brightfunc", T_P|T_F, o_default }, \ |
108 |
> |
{ "brightdata", T_P|T_D, o_default }, \ |
109 |
> |
{ "brighttext", T_P|T_E, o_default }, \ |
110 |
> |
{ "colorpict", T_P|T_I, o_default }, \ |
111 |
> |
{ "light", T_M|T_L, o_default }, \ |
112 |
> |
{ "illum", T_M|T_L, o_default }, \ |
113 |
> |
{ "glow", T_M|T_L, o_default }, \ |
114 |
> |
{ "BRTDfunc", T_M|T_F, o_default }, \ |
115 |
> |
{ "plasdata", T_M|T_D, o_default }, \ |
116 |
> |
{ "metdata", T_M|T_D, o_default }, \ |
117 |
> |
{ "spotlight", T_M|T_L, o_default }, \ |
118 |
> |
{ "colorfunc", T_P|T_F, o_default }, \ |
119 |
> |
{ "antimatter", T_M, o_default }, \ |
120 |
> |
{ "colordata", T_P|T_D, o_default }, \ |
121 |
> |
{ "colortext", T_P|T_E, o_default }, \ |
122 |
> |
{ "texdata", T_T|T_D, o_default }, \ |
123 |
> |
{ "mixfunc", T_X|T_F, o_default }, \ |
124 |
> |
{ "mixdata", T_X|T_D, o_default }, \ |
125 |
> |
{ "mixtext", T_X|T_E, o_default }, \ |
126 |
> |
} |
127 |
|
|
128 |
|
#define ALIASID "alias" /* alias type identifier */ |
118 |
– |
|
119 |
– |
extern FUN ofun[]; |