1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3*c2c66affSColin Finck  * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
4*c2c66affSColin Finck  *
5*c2c66affSColin Finck  * Permission is hereby granted, free of charge, to any person obtaining a
6*c2c66affSColin Finck  * copy of this software and associated documentation files (the "Software"),
7*c2c66affSColin Finck  * to deal in the Software without restriction, including without limitation
8*c2c66affSColin Finck  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9*c2c66affSColin Finck  * and/or sell copies of the Software, and to permit persons to whom the
10*c2c66affSColin Finck  * Software is furnished to do so, subject to the following conditions:
11*c2c66affSColin Finck  *
12*c2c66affSColin Finck  * The above copyright notice including the dates of first publication and
13*c2c66affSColin Finck  * either this permission notice or a reference to
14*c2c66affSColin Finck  * http://oss.sgi.com/projects/FreeB/
15*c2c66affSColin Finck  * shall be included in all copies or substantial portions of the Software.
16*c2c66affSColin Finck  *
17*c2c66affSColin Finck  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18*c2c66affSColin Finck  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19*c2c66affSColin Finck  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20*c2c66affSColin Finck  * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21*c2c66affSColin Finck  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22*c2c66affSColin Finck  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23*c2c66affSColin Finck  * SOFTWARE.
24*c2c66affSColin Finck  *
25*c2c66affSColin Finck  * Except as contained in this notice, the name of Silicon Graphics, Inc.
26*c2c66affSColin Finck  * shall not be used in advertising or otherwise to promote the sale, use or
27*c2c66affSColin Finck  * other dealings in this Software without prior written authorization from
28*c2c66affSColin Finck  * Silicon Graphics, Inc.
29*c2c66affSColin Finck  */
30*c2c66affSColin Finck 
31*c2c66affSColin Finck /*
32*c2c66affSColin Finck  * backend.h
33*c2c66affSColin Finck  *
34*c2c66affSColin Finck  */
35*c2c66affSColin Finck 
36*c2c66affSColin Finck #ifndef __glubackend_h_
37*c2c66affSColin Finck #define __glubackend_h_
38*c2c66affSColin Finck 
39*c2c66affSColin Finck //#include "trimvertex.h"
40*c2c66affSColin Finck //#include "gridvertex.h"
41*c2c66affSColin Finck #include "gridtrimvertex.h"
42*c2c66affSColin Finck 
43*c2c66affSColin Finck class BasicCurveEvaluator;
44*c2c66affSColin Finck class BasicSurfaceEvaluator;
45*c2c66affSColin Finck 
46*c2c66affSColin Finck class Backend {
47*c2c66affSColin Finck private:
48*c2c66affSColin Finck     BasicCurveEvaluator&	curveEvaluator;
49*c2c66affSColin Finck     BasicSurfaceEvaluator&	surfaceEvaluator;
50*c2c66affSColin Finck public:
Backend(BasicCurveEvaluator & c,BasicSurfaceEvaluator & e)51*c2c66affSColin Finck   			Backend( BasicCurveEvaluator &c, BasicSurfaceEvaluator& e )
52*c2c66affSColin Finck 			: curveEvaluator(c), surfaceEvaluator(e) {}
53*c2c66affSColin Finck 
54*c2c66affSColin Finck     /* surface backend routines */
55*c2c66affSColin Finck     void		bgnsurf( int, int, long  );
56*c2c66affSColin Finck     void		patch( REAL, REAL, REAL, REAL );
57*c2c66affSColin Finck     void		surfpts( long, REAL *, long, long, int, int,
58*c2c66affSColin Finck           			 REAL, REAL, REAL, REAL );
59*c2c66affSColin Finck     void		surfbbox( long, REAL *, REAL * );
60*c2c66affSColin Finck     void		surfgrid( REAL, REAL, long, REAL, REAL, long );
61*c2c66affSColin Finck     void		surfmesh( long, long, long, long );
62*c2c66affSColin Finck     void		bgntmesh( const char * );
63*c2c66affSColin Finck     void		endtmesh( void );
64*c2c66affSColin Finck     void		swaptmesh( void );
65*c2c66affSColin Finck     void		tmeshvert( GridTrimVertex * );
66*c2c66affSColin Finck     void		tmeshvert( TrimVertex * );
67*c2c66affSColin Finck     void		tmeshvert( GridVertex * );
68*c2c66affSColin Finck     void		tmeshvert( REAL u,  REAL v );
69*c2c66affSColin Finck     void		linevert( TrimVertex * );
70*c2c66affSColin Finck     void		linevert( GridVertex * );
71*c2c66affSColin Finck     void		bgnoutline( void );
72*c2c66affSColin Finck     void		endoutline( void );
73*c2c66affSColin Finck     void		endsurf( void );
74*c2c66affSColin Finck     void		triangle( TrimVertex*, TrimVertex*, TrimVertex* );
75*c2c66affSColin Finck 
76*c2c66affSColin Finck     void                bgntfan();
77*c2c66affSColin Finck     void                endtfan();
78*c2c66affSColin Finck     void                bgnqstrip();
79*c2c66affSColin Finck     void                endqstrip();
80*c2c66affSColin Finck     void                evalUStrip(int n_upper, REAL v_upper, REAL* upper_val,
81*c2c66affSColin Finck 				   int n_lower, REAL v_lower, REAL* lower_val
82*c2c66affSColin Finck 				   );
83*c2c66affSColin Finck     void                evalVStrip(int n_left, REAL u_left, REAL* left_val,
84*c2c66affSColin Finck 				   int n_right, REAL v_right, REAL* right_val
85*c2c66affSColin Finck 				   );
86*c2c66affSColin Finck     void                tmeshvertNOGE(TrimVertex *t);
87*c2c66affSColin Finck     void                tmeshvertNOGE_BU(TrimVertex *t);
88*c2c66affSColin Finck     void                tmeshvertNOGE_BV(TrimVertex *t);
89*c2c66affSColin Finck     void                preEvaluateBU(REAL u);
90*c2c66affSColin Finck     void                preEvaluateBV(REAL v);
91*c2c66affSColin Finck 
92*c2c66affSColin Finck 
93*c2c66affSColin Finck     /* curve backend routines */
94*c2c66affSColin Finck     void		bgncurv( void );
95*c2c66affSColin Finck     void		segment( REAL, REAL );
96*c2c66affSColin Finck     void		curvpts( long, REAL *, long, int, REAL, REAL );
97*c2c66affSColin Finck     void		curvgrid( REAL, REAL, long );
98*c2c66affSColin Finck     void		curvmesh( long, long );
99*c2c66affSColin Finck     void		curvpt( REAL  );
100*c2c66affSColin Finck     void		bgnline( void );
101*c2c66affSColin Finck     void		endline( void );
102*c2c66affSColin Finck     void		endcurv( void );
103*c2c66affSColin Finck private:
104*c2c66affSColin Finck #ifndef NOWIREFRAME
105*c2c66affSColin Finck     int			wireframetris;
106*c2c66affSColin Finck     int			wireframequads;
107*c2c66affSColin Finck     int			npts;
108*c2c66affSColin Finck     REAL		mesh[3][4];
109*c2c66affSColin Finck     int			meshindex;
110*c2c66affSColin Finck #endif
111*c2c66affSColin Finck };
112*c2c66affSColin Finck 
113*c2c66affSColin Finck #endif /* __glubackend_h_ */
114