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
32
33 /* Author: Timothy Rowley */
34
35 #include <limits.h>
36 #include "mgP.h"
37 #include "mgbufP.h"
38
39 void
Xmgr_gradWrapper(unsigned char * buf,float * zbuf,int zwidth,int width,int height,CPoint3 * p0,CPoint3 * p1,int lwidth,void (* flat)(unsigned char *,float *,int,int,int,CPoint3 *,CPoint3 *,int,int *),void (* smooth)(unsigned char *,float *,int,int,int,CPoint3 *,CPoint3 *,int,int *))40 Xmgr_gradWrapper(unsigned char *buf, float *zbuf, int zwidth, int width,
41 int height, CPoint3 *p0, CPoint3 *p1, int lwidth,
42 void (*flat)(unsigned char *, float *, int, int, int, CPoint3 *,
43 CPoint3 *, int, int *),
44 void (*smooth)(unsigned char *, float *, int, int, int, CPoint3 *,
45 CPoint3 *, int, int *))
46 {
47 int color[3];
48
49 if ((p0->vcol.r == p1->vcol.r) && (p0->vcol.g == p1->vcol.g) &&
50 (p0->vcol.b == p1->vcol.b))
51 {
52 color[0] = 255*p0->vcol.r;
53 color[1] = 255*p0->vcol.g;
54 color[2] = 255*p0->vcol.b;
55 flat(buf, zbuf, zwidth, width, height, p0, p1, lwidth, color);
56 }
57 else
58 smooth(buf, zbuf, zwidth, width, height, p0, p1, lwidth, color);
59 }
60
61 void
oldXmgr_gradWrapper(unsigned char * buf,float * zbuf,int zwidth,int width,int height,CPoint3 * p0,CPoint3 * p1,int lwidth,void (* flat)(unsigned char *,float *,int,int,int,int,int,float,int,int,float,int,int *),void (* smooth)(unsigned char *,float *,int,int,int,CPoint3 *,CPoint3 *,int))62 oldXmgr_gradWrapper(unsigned char *buf, float *zbuf, int zwidth, int width,
63 int height, CPoint3 *p0, CPoint3 *p1, int lwidth,
64 void (*flat)(unsigned char *, float *, int, int, int, int, int, float,
65 int, int, float, int, int *),
66 void (*smooth)(unsigned char *, float *, int, int, int, CPoint3 *,
67 CPoint3 *, int))
68 {
69 int color[3];
70
71 if ((p0->vcol.r == p1->vcol.r) && (p0->vcol.g == p1->vcol.g) &&
72 (p0->vcol.b == p1->vcol.b))
73 {
74 color[0] = 255*p0->vcol.r;
75 color[1] = 255*p0->vcol.g;
76 color[2] = 255*p0->vcol.b;
77 flat(buf, zbuf, zwidth, width, height, p0->x, p0->y, p0->z,
78 p1->x, p1->y, p1->z, lwidth, color);
79 }
80 else
81 smooth(buf, zbuf, zwidth, width, height, p0, p1, lwidth);
82 }
83
84 #define NAME Xmgr_polyscan
85 #include "MGRpolyscan.h"
86
87 #define NAME Xmgr_Zpolyscan
88 #define ZBUFFER
89 #include "MGRpolyscan.h"
90
91 #define NAME Xmgr_Graypolyscan
92 #define GOURAUD
93 #include "MGRpolyscan.h"
94
95 #define NAME Xmgr_GrayZpolyscan
96 #define ZBUFFER
97 #define GOURAUD
98 #include "MGRpolyscan.h"
99
100 #define NAME Xmgr_Gpolyscan
101 #define GOURAUD
102 #define COLOR
103 #include "MGRpolyscan.h"
104
105 #define NAME Xmgr_GZpolyscan
106 #define GOURAUD
107 #define COLOR
108 #define ZBUFFER
109 #include "MGRpolyscan.h"
110