ReactOS  0.4.12-dev-36-g472787f
subdivider.h
Go to the documentation of this file.
1 /*
2  * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3  * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
4  *
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:
11  *
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.
16  *
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
23  * SOFTWARE.
24  *
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.
29  */
30 
31 /*
32  * subdivider.h
33  *
34  */
35 
36 #ifndef __glusubdivider_h_
37 #define __glusubdivider_h_
38 
39 #include "mysetjmp.h"
40 #include "bin.h"
41 #include "flist.h"
42 #include "slicer.h"
43 #include "arctess.h"
44 //#include "trimvertex.h"
45 #include "trimvertpool.h"
46 
47 class Arc;
48 class Pool;
49 class Renderhints;
50 class Quilt;
51 class Patchlist;
52 class Curvelist;
53 struct JumpBuffer;
54 
55 class Subdivider {
56 public:
58  ~Subdivider( void );
59  void clear( void );
60 
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 ) {}
67 
68  void beginQuilts( void );
69  void addQuilt( Quilt * );
70  void endQuilts( void ) {}
71 
72  void drawCurves( void );
73  void drawSurfaces( long );
74 
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 );
79 
80  void setJumpbuffer( JumpBuffer * );
81 
83  {
84  domain_distance_u_rate = u_rate;
85  }
87  {
88  domain_distance_v_rate = v_rate;
89  }
91  {
93  }
94 
95 private:
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 );
104 
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 );
110 
111 
118 
119  JumpBuffer* jumpbuffer;
122 
125  int s_index;
126  int t_index;
135 
136  void samplingSplit( Curvelist&, int );
137 
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 );
146 
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 );
152 
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; }
159 
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 & );
165 
166 
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 );
177 
178  Bin* makePatchBoundary( const REAL *from, const REAL *to );
179 
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_..().
187  */
191 };
192 
193 inline void
195 {
196  pjarc = 0;
197 }
198 
199 
200 #endif /* __glusubdivider_h_ */
Backend & backend
Definition: subdivider.h:121
void monotonize(Arc_ptr, Bin &)
Definition: monotonizer.cc:114
void classify_tailonright_t(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:583
void drawCurves(void)
Definition: curvesub.cc:56
void beginTrims(void)
Definition: subdivider.h:61
void freejarcs(Bin &)
Definition: subdivider.cc:846
Definition: quilt.h:64
int is_domain_distance_sampling
Definition: subdivider.h:190
void addArc(REAL *, Quilt *, long)
Definition: subdivider.cc:157
Flist tpbrkpts
Definition: subdivider.h:129
int bbox(TrimVertex *, TrimVertex *, TrimVertex *, int)
Definition: ccw.cc:50
Definition: flist.h:42
void setJumpbuffer(JumpBuffer *)
Definition: subdivider.cc:124
void setArcTypeBezier(void)
Definition: subdivider.h:156
void render(Bin &)
Definition: subdivider.cc:795
void outline(Bin &)
Definition: subdivider.cc:824
void partition(Bin &, Bin &, Bin &, Bin &, Bin &, int, REAL)
Definition: intersect.cc:61
void join_s(Bin &, Bin &, Arc_ptr, Arc_ptr)
Definition: splitarcs.cc:180
Bin initialbin
Definition: subdivider.h:123
Flist tmbrkpts
Definition: subdivider.h:131
void check_t(Arc_ptr, Arc_ptr)
Definition: splitarcs.cc:221
void samplingSplit(Curvelist &, int)
Definition: curvesub.cc:85
int showingDegenerate(void)
Definition: subdivider.h:155
void setArcTypePwl(void)
Definition: subdivider.h:157
Pool pwlarcpool
Definition: subdivider.h:116
void split(Bin &, Bin &, Bin &, int, REAL)
Definition: splitarcs.cc:58
Definition: arc.h:55
Pool arcpool
Definition: subdivider.h:114
void beginQuilts(void)
Definition: subdivider.cc:186
int ccwTurn_sl(Arc_ptr, Arc_ptr)
Definition: ccw.cc:170
void findIrregularS(Bin &)
Definition: subdivider.cc:658
void splitInS(Bin &, int, int)
Definition: subdivider.cc:391
void monosplitInT(Bin &, int, int)
Definition: subdivider.cc:626
void setNonDegenerate(void)
Definition: subdivider.h:154
void set_domain_distance_u_rate(REAL u_rate)
Definition: subdivider.h:82
Arc_ptr pjarc
Definition: subdivider.h:124
Definition: bin.h:43
int ccwTurn_sr(Arc_ptr, Arc_ptr)
Definition: ccw.cc:57
void tessellate(Arc_ptr, REAL)
Definition: monotonizer.cc:83
void nonSamplingSplit(Bin &, Patchlist &, int, int)
Definition: subdivider.cc:520
void drawSurfaces(long)
Definition: subdivider.cc:204
void findIrregularT(Bin &)
Definition: subdivider.cc:722
void monosplitInS(Bin &, int, int)
Definition: subdivider.cc:597
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean flag
Definition: glfuncs.h:72
void classify_headonright_t(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:639
Definition: bufpool.h:50
int isMonotone(Arc_ptr)
Definition: monotonizer.cc:210
void check_s(Arc_ptr, Arc_ptr)
Definition: splitarcs.cc:122
void endQuilts(void)
Definition: subdivider.h:70
Bin * makePatchBoundary(const REAL *from, const REAL *to)
Definition: subdivider.cc:73
void simple_link(Arc_ptr, Arc_ptr)
Definition: splitarcs.cc:164
int isArcTypeBezier
Definition: subdivider.h:134
REAL stepsizes[4]
Definition: subdivider.h:132
REAL domain_distance_v_rate
Definition: subdivider.h:189
void set_domain_distance_v_rate(REAL v_rate)
Definition: subdivider.h:86
ArcTessellator arctessellator
Definition: subdivider.h:113
void splitInT(Bin &, int, int)
Definition: subdivider.cc:422
void setDegenerate(void)
Definition: subdivider.h:153
void link(Arc_ptr, Arc_ptr, Arc_ptr, Arc_ptr)
Definition: splitarcs.cc:148
REAL domain_distance_u_rate
Definition: subdivider.h:188
void makeBorderTrim(const REAL *, const REAL *)
Definition: subdivider.cc:757
Flist smbrkpts
Definition: subdivider.h:130
void classify_tailonleft_s(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:445
void addQuilt(Quilt *)
Definition: subdivider.cc:192
void classify_headonright_s(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:611
Flist spbrkpts
Definition: subdivider.h:128
void clear(void)
Definition: subdivider.cc:135
Subdivider(Renderhints &, Backend &)
Definition: subdivider.cc:112
class Arc * Arc_ptr
Definition: arc.h:50
TrimVertexPool trimvertexpool
Definition: subdivider.h:117
void endLoop(void)
Definition: subdivider.h:65
void classify_tailonleft_t(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:472
void subdivideInS(Bin &)
Definition: subdivider.cc:372
JumpBuffer * jumpbuffer
Definition: subdivider.h:119
Renderhints & renderhints
Definition: subdivider.h:120
int arc_split(Arc_ptr, int, REAL, int)
Definition: intersect.cc:175
~Subdivider(void)
Definition: subdivider.cc:148
void tessellation(Bin &, Patchlist &)
Definition: subdivider.cc:571
Pool bezierarcpool
Definition: subdivider.h:115
void classify_headonleft_t(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:527
void set_is_domain_distance_sampling(int flag)
Definition: subdivider.h:90
int isBezierArcType(void)
Definition: subdivider.h:158
Definition: slicer.h:49
int showDegenerate
Definition: subdivider.h:133
void join_t(Bin &, Bin &, Arc_ptr, Arc_ptr)
Definition: splitarcs.cc:252
int ccwTurn_tl(Arc_ptr, Arc_ptr)
Definition: ccw.cc:396
static int ccw(TrimVertex *, TrimVertex *, TrimVertex *)
Definition: ccw.cc:560
float REAL
Definition: types.h:41
void classify_headonleft_s(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:499
CardRegion * from
Definition: spigame.cpp:19
void beginLoop(void)
Definition: subdivider.h:194
int ccwTurn_tr(Arc_ptr, Arc_ptr)
Definition: ccw.cc:283
int decompose(Bin &, REAL)
Definition: monotonizer.cc:56
Quilt * qlist
Definition: subdivider.h:127
void classify_tailonright_s(Bin &, Bin &, Bin &, REAL)
Definition: intersect.cc:555
void endTrims(void)
Definition: subdivider.h:66
Slicer slicer
Definition: subdivider.h:112