1 /* Copyright (C) 1992-1998 The Geometry Center
2  * Copyright (C) 1998-2000 Stuart Levy, Tamara Munzner, Mark Phillips
3  *
4  * This file is part of Geomview.
5  *
6  * Geomview is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published
8  * by the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * Geomview is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with Geomview; see the file COPYING.  If not, write
18  * to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
19  * USA, or visit http://www.gnu.org.
20  */
21 
22 #if HAVE_CONFIG_H
23 # include "config.h"
24 #endif
25 
26 #if 0
27 static char copyright[] = "Copyright (C) 1992-1998 The Geometry Center\n\
28 Copyright (C) 1998-2000 Stuart Levy, Tamara Munzner, Mark Phillips";
29 #endif
30 
31 #include "geom.h"
32 #include "color.h"
33 #include "crayolaP.h"
34 
35 ColorA crayDefColor = {CRAY_DEFR, CRAY_DEFG, CRAY_DEFB, CRAY_DEFA};
36 
37 static char methods[][CRAYOLA_MAXNAME] =
38 {
39   CRAYOLA_METHNAMES
40 };
41 int sel[CRAYOLA_MAXMETH];
42 
crayolaInit(void)43 void crayolaInit(void)
44 {
45   int i;
46 
47   for (i = 0; i < CRAYOLA_MAXMETH; i++)
48     sel[i] = GeomNewMethod(methods[i], crayFalse);
49 
50   cray_bezier_init();
51   cray_inst_init();
52   cray_list_init();
53   cray_mesh_init();
54   cray_polylist_init();
55   cray_npolylist_init();
56   cray_quad_init();
57   cray_vect_init();
58   cray_skel_init();
59 }
60 
crayInitSpec(craySpecFunc * specfunc,int n_func,GeomClass * class)61 void crayInitSpec(craySpecFunc *specfunc, int n_func, GeomClass *class) {
62   int i;
63   for (i = 0; i < n_func; i++)
64     GeomSpecifyMethod(GeomMethodSel(specfunc[i].name), class,
65 				    specfunc[i].func);
66 }
67 
crayHasColor(Geom * geom,int * gpath)68 int crayHasColor(Geom *geom, int *gpath) {
69   return (int)(long)GeomCall(sel[0], geom, gpath);
70 }
71 
crayHasVColor(Geom * geom,int * gpath)72 int crayHasVColor(Geom *geom, int *gpath) {
73   return (int)(long)GeomCall(sel[1], geom, gpath);
74 }
75 
crayHasFColor(Geom * geom,int * gpath)76 int crayHasFColor(Geom *geom, int *gpath) {
77   return (int)(long)GeomCall(sel[2], geom, gpath);
78 }
79 
crayCanUseVColor(Geom * geom,int * gpath)80 int crayCanUseVColor(Geom *geom, int *gpath) {
81   return (int)(long)GeomCall(sel[3], geom, gpath);
82 }
83 
crayCanUseFColor(Geom * geom,int * gpath)84 int crayCanUseFColor(Geom *geom, int *gpath) {
85   return (int)(long)GeomCall(sel[4], geom, gpath);
86 }
87 
crayUseVColor(Geom * geom,ColorA * color,int * gpath)88 int crayUseVColor(Geom *geom, ColorA *color, int *gpath) {
89   return (int)(long)GeomCall(sel[5], geom, color, gpath);
90 }
91 
crayUseFColor(Geom * geom,ColorA * color,int * gpath)92 int crayUseFColor(Geom *geom, ColorA *color, int *gpath) {
93   return (int)(long)GeomCall(sel[6], geom, color, gpath);
94 }
95 
crayEliminateColor(Geom * geom,int * gpath)96 int crayEliminateColor(Geom *geom, int *gpath) {
97   return (int)(long)GeomCall(sel[7], geom, gpath);
98 }
99 
craySetColorAll(Geom * geom,ColorA * color,int * gpath)100 int craySetColorAll(Geom *geom, ColorA *color, int *gpath) {
101   return (int)(long)GeomCall(sel[8], geom, color, gpath);
102 }
103 
craySetColorAt(Geom * geom,ColorA * color,int vindex,int findex,int * edge,int * gpath,HPoint3 * pt)104 int craySetColorAt(Geom *geom, ColorA *color, int vindex, int findex,
105 		   int *edge, int *gpath, HPoint3 *pt) {
106   return (int)(long)GeomCall(sel[9], geom, color, vindex, findex, edge, gpath,
107 		       pt);
108 }
109 
craySetColorAtV(Geom * geom,ColorA * color,int index,int * gpath,HPoint3 * pt)110 int craySetColorAtV(Geom *geom, ColorA *color, int index, int *gpath,
111 		    HPoint3 *pt) {
112   return (int)(long)GeomCall(sel[10], geom, color, index, gpath, pt);
113 }
114 
craySetColorAtF(Geom * geom,ColorA * color,int index,int * gpath)115 int craySetColorAtF(Geom *geom, ColorA *color, int index, int *gpath) {
116   return (int)(long)GeomCall(sel[11], geom, color, index, gpath);
117 }
118 
crayGetColorAt(Geom * geom,ColorA * color,int vindex,int findex,int * edge,int * gpath,HPoint3 * pt)119 int crayGetColorAt(Geom *geom, ColorA *color, int vindex, int findex,
120 		   int *edge, int *gpath, HPoint3 *pt) {
121   return (int)(long)GeomCall(sel[12], geom, color, vindex, findex, edge, gpath, pt);
122 }
123 
crayGetColorAtV(Geom * geom,ColorA * color,int index,int * gpath,HPoint3 * pt)124 int crayGetColorAtV(Geom *geom, ColorA *color, int index, int *gpath,
125 		    HPoint3 *pt) {
126   return (int)(long)GeomCall(sel[13], geom, color, index, gpath, pt);
127 }
128 
crayGetColorAtF(Geom * geom,ColorA * color,int index,int * gpath)129 int crayGetColorAtF(Geom *geom, ColorA *color, int index, int *gpath) {
130   return (int)(long)GeomCall(sel[14], geom, color, index, gpath);
131 }
132 
crayTrue(int sel,Geom * geom,va_list * args)133 void *crayTrue(int sel, Geom *geom, va_list *args) {
134   return (void *)1;
135 }
136 
crayFalse(int sel,Geom * geom,va_list * args)137 void *crayFalse(int sel, Geom *geom, va_list *args) {
138   return (void *)0;
139 }
140 /*
141  * Local Variables: ***
142  * mode: c ***
143  * c-basic-offset: 2 ***
144  * End: ***
145  */
146