2 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice including the dates of first publication and
13 * either this permission notice or a reference to
14 * http://oss.sgi.com/projects/FreeB/
15 * shall be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * Except as contained in this notice, the name of Silicon Graphics, Inc.
26 * shall not be used in advertising or otherwise to promote the sale, use or
27 * other dealings in this Software without prior written authorization from
28 * Silicon Graphics, Inc.
36 #ifndef __glusubdivider_h_
37 #define __glusubdivider_h_
44 #include "trimvertex.h"
45 #include "trimvertpool.h"
57 Subdivider( Renderhints
&, Backend
& );
61 void beginTrims( void ) {}
62 void beginLoop( void );
63 void addArc( REAL
*, Quilt
*, long );
64 void addArc( int, TrimVertex
*, long );
65 void endLoop( void ) {}
66 void endTrims( void ) {}
68 void beginQuilts( void );
69 void addQuilt( Quilt
* );
70 void endQuilts( void ) {}
72 void drawCurves( void );
73 void drawSurfaces( long );
75 int ccwTurn_sl( Arc_ptr
, Arc_ptr
);
76 int ccwTurn_sr( Arc_ptr
, Arc_ptr
);
77 int ccwTurn_tl( Arc_ptr
, Arc_ptr
);
78 int ccwTurn_tr( Arc_ptr
, Arc_ptr
);
80 void setJumpbuffer( JumpBuffer
* );
82 void set_domain_distance_u_rate(REAL u_rate
)
84 domain_distance_u_rate
= u_rate
;
86 void set_domain_distance_v_rate(REAL v_rate
)
88 domain_distance_v_rate
= v_rate
;
90 void set_is_domain_distance_sampling(int flag
)
92 is_domain_distance_sampling
= flag
;
96 void classify_headonleft_s( Bin
&, Bin
&, Bin
&, REAL
);
97 void classify_tailonleft_s( Bin
&, Bin
&, Bin
&, REAL
);
98 void classify_headonright_s( Bin
&, Bin
&, Bin
&, REAL
);
99 void classify_tailonright_s( Bin
&, Bin
&, Bin
&, REAL
);
100 void classify_headonleft_t( Bin
&, Bin
&, Bin
&, REAL
);
101 void classify_tailonleft_t( Bin
&, Bin
&, Bin
&, REAL
);
102 void classify_headonright_t( Bin
&, Bin
&, Bin
&, REAL
);
103 void classify_tailonright_t( Bin
&, Bin
&, Bin
&, REAL
);
105 enum dir
{ down
, same
, up
, none
};
106 void tessellate( Arc_ptr
, REAL
);
107 void monotonize( Arc_ptr
, Bin
& );
108 int isMonotone( Arc_ptr
);
109 int decompose( Bin
&, REAL
);
113 ArcTessellator arctessellator
;
117 TrimVertexPool trimvertexpool
;
119 JumpBuffer
* jumpbuffer
;
120 Renderhints
& renderhints
;
136 void samplingSplit( Curvelist
&, int );
138 void subdivideInS( Bin
& );
139 void splitInS( Bin
&, int, int );
140 void splitInT( Bin
&, int, int );
141 void samplingSplit( Bin
&, Patchlist
&, int, int );
142 void nonSamplingSplit( Bin
&, Patchlist
&, int, int );
143 void tessellation( Bin
&, Patchlist
& );
144 void monosplitInS( Bin
&, int, int );
145 void monosplitInT( Bin
&, int, int );
147 void outline( Bin
& );
148 void freejarcs( Bin
& );
149 void render( Bin
& );
150 void split( Bin
&, Bin
&, Bin
&, int, REAL
);
151 void tessellate( Bin
&, REAL
, REAL
, REAL
, REAL
);
153 inline void setDegenerate( void ) { showDegenerate
= 1; }
154 inline void setNonDegenerate( void ) { showDegenerate
= 0; }
155 inline int showingDegenerate( void ) { return showDegenerate
; }
156 inline void setArcTypeBezier( void ) { isArcTypeBezier
= 1; }
157 inline void setArcTypePwl( void ) { isArcTypeBezier
= 0; }
158 inline int isBezierArcType( void ) { return isArcTypeBezier
; }
160 void makeBorderTrim( const REAL
*, const REAL
* );
161 void split( Bin
&, int, const REAL
*, int, int );
162 void partition( Bin
&, Bin
&, Bin
&, Bin
&, Bin
&, int, REAL
);
163 void findIrregularS( Bin
& );
164 void findIrregularT( Bin
& );
167 inline int bbox( TrimVertex
*, TrimVertex
*, TrimVertex
*, int );
168 static int bbox( REAL
, REAL
, REAL
, REAL
, REAL
, REAL
);
169 static int ccw( TrimVertex
*, TrimVertex
*, TrimVertex
* );
170 void join_s( Bin
&, Bin
&, Arc_ptr
, Arc_ptr
);
171 void join_t( Bin
&, Bin
&, Arc_ptr
, Arc_ptr
);
172 int arc_split( Arc_ptr
, int, REAL
, int );
173 void check_s( Arc_ptr
, Arc_ptr
);
174 void check_t( Arc_ptr
, Arc_ptr
);
175 inline void link( Arc_ptr
, Arc_ptr
, Arc_ptr
, Arc_ptr
);
176 inline void simple_link( Arc_ptr
, Arc_ptr
);
178 Bin
* makePatchBoundary( const REAL
*from
, const REAL
*to
);
180 /*in domain distance method, the tessellation is controled by two numbers:
181 *GLU_U_STEP: number of u-segments per unit u length of domain
182 *GLU_V_STEP: number of v-segments per unit v length of domain
183 *These two numbers are normally stored in mapdesc->maxs(t)rate.
184 *I (ZL) put these two numbers here so that I can optimize the untrimmed
185 *case in the case of domain distance sampling.
186 *These two numbers are set by set_domain_distance_u_rate() and ..._v_..().
188 REAL domain_distance_u_rate
;
189 REAL domain_distance_v_rate
;
190 int is_domain_distance_sampling
;
194 Subdivider::beginLoop( void )
200 #endif /* __glusubdivider_h_ */