ReactOS  0.4.13-dev-73-gcfe54aa
mapdesc.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  * mapdesc.h
33  *
34  */
35 
36 #ifndef __glumapdesc_h_
37 #define __glumapdesc_h_
38 
39 //#include "mystdio.h"
40 #include "types.h"
41 #include "defines.h"
42 #include "bufpool.h"
43 #include "nurbsconsts.h"
44 
46 
47 class Backend;
48 
49 class Mapdesc : public PooledObj {
50  friend class Maplist;
51 
52 public:
53  Mapdesc( long, int, int, Backend & );
54  int isProperty( long );
55  REAL getProperty( long );
56  void setProperty( long, REAL );
57  int isConstantSampling( void );
58  int isDomainSampling( void );
59  int isRangeSampling( void );
60  int isSampling( void );
61  int isParametricDistanceSampling( void );
62  int isObjectSpaceParaSampling( void );
63  int isObjectSpacePathSampling( void );
64  int isSurfaceAreaSampling( void );
65  int isPathLengthSampling( void );
66  int isCulling( void );
67  int isBboxSubdividing( void );
68  long getType( void );
69 
70  /* curve routines */
71  void subdivide( REAL *, REAL *, REAL, int, int );
72  int cullCheck( REAL *, int, int );
73  void xformBounding( REAL *, int, int, REAL *, int );
74  void xformCulling( REAL *, int, int, REAL *, int );
75  void xformSampling( REAL *, int, int, REAL *, int );
76  void xformMat( Maxmatrix, REAL *, int, int, REAL *, int );
77  REAL calcPartialVelocity ( REAL *, int, int, int, REAL );
78  int project( REAL *, int, REAL *, int, int );
79  REAL calcVelocityRational( REAL *, int, int );
80  REAL calcVelocityNonrational( REAL *, int, int );
81 
82  /* surface routines */
83  void subdivide( REAL *, REAL *, REAL, int, int, int, int );
84  int cullCheck( REAL *, int, int, int, int );
85  void xformBounding( REAL *, int, int, int, int, REAL *, int, int );
86  void xformCulling( REAL *, int, int, int, int, REAL *, int, int );
87  void xformSampling( REAL *, int, int, int, int, REAL *, int, int );
88  void xformMat( Maxmatrix, REAL *, int, int, int, int, REAL *, int, int );
89  REAL calcPartialVelocity ( REAL *, REAL *, int, int, int, int, int, int, REAL, REAL, int );
90  int project( REAL *, int, int, REAL *, int, int, int, int);
91  void surfbbox( REAL bb[2][MAXCOORDS] );
92 
93  int bboxTooBig( REAL *, int, int, int, int, REAL [2][MAXCOORDS] );
94  int xformAndCullCheck( REAL *, int, int, int, int );
95 
96  void identify( REAL[MAXCOORDS][MAXCOORDS] );
97  void setBboxsize( INREAL *);
98  inline void setBmat( INREAL*, long, long );
99  inline void setCmat( INREAL*, long, long );
100  inline void setSmat( INREAL*, long, long );
101  inline int isRational( void );
102  inline int getNcoords( void );
103 
104  REAL pixel_tolerance; /* pathlength sampling tolerance */
105  REAL error_tolerance; /* parametric error sampling tolerance*/
106  REAL object_space_error_tolerance; /* object space tess*/
113 
114 private:
115  long type;
117  int ncoords;
118  int hcoords;
120  int mask;
124  REAL s_steps; /* max samples in s direction */
125  REAL t_steps; /* max samples in t direction */
127  REAL culling_method; /* check for culling */
131 
132  void bbox( REAL [2][MAXCOORDS], REAL *, int, int, int, int );
133  REAL maxDifference( int, REAL *, int );
134  static void copy( Maxmatrix, long, INREAL *, long, long );
135 
136  /* individual control point routines */
137  static void transform4d( float[4], float[4], float[4][4] );
138  static void multmatrix4d ( float[4][4], const float[4][4],
139  const float[4][4] );
140  void copyPt( REAL *, REAL * );
141  void sumPt( REAL *, REAL *, REAL *, REAL, REAL );
142  void xformSampling( REAL *, REAL * );
143  void xformCulling( REAL *, REAL * );
144  void xformRational( Maxmatrix, REAL *, REAL * );
145  void xformNonrational( Maxmatrix, REAL *, REAL * );
146  unsigned int clipbits( REAL * );
147 };
148 
149 inline void
150 Mapdesc::setBmat( INREAL *mat, long rstride, long cstride )
151 {
152  copy( bmat, hcoords, mat, rstride, cstride );
153 }
154 
155 inline void
156 Mapdesc::setCmat( INREAL *mat, long rstride, long cstride )
157 {
158  copy( cmat, hcoords, mat, rstride, cstride );
159 }
160 
161 inline void
162 Mapdesc::setSmat( INREAL *mat, long rstride, long cstride )
163 {
164  copy( smat, hcoords, mat, rstride, cstride );
165 }
166 
167 inline long
169 {
170  return type;
171 }
172 
173 inline void
175 {
176  if( isrational )
177  xformRational( cmat, d, s );
178  else
179  xformNonrational( cmat, d, s );
180 }
181 
182 inline void
184 {
185  if( isrational )
186  xformRational( smat, d, s );
187  else
188  xformNonrational( smat, d, s );
189 }
190 
191 inline int
193 {
194  return isrational ? 1 : 0;
195 }
196 
197 inline int
199 {
200  return ncoords;
201 }
202 
203 inline int
205 {
206  return ((sampling_method == N_FIXEDRATE) ? 1 : 0);
207 }
208 
209 inline int
211 {
212  return ((sampling_method == N_DOMAINDISTANCE) ? 1 : 0);
213 }
214 
215 inline int
217 {
218  return ((sampling_method == N_PARAMETRICDISTANCE) ? 1 : 0);
219 }
220 
221 inline int
223 {
224  return ((sampling_method == N_OBJECTSPACE_PARA) ? 1 : 0);
225 }
226 
227 inline int
229 {
230  return ((sampling_method == N_OBJECTSPACE_PATH) ? 1 : 0);
231 }
232 
233 inline int
235 {
236  return ((sampling_method == N_SURFACEAREA) ? 1 : 0);
237 }
238 
239 inline int
241 {
242  return ((sampling_method == N_PATHLENGTH) ? 1 : 0);
243 }
244 
245 inline int
247 {
252 }
253 
254 inline int
256 {
258 }
259 
260 inline int
262 {
263  return ((culling_method != N_NOCULLING) ? 1 : 0);
264 }
265 
266 inline int
268 {
269  return ((bbox_subdividing != N_NOBBOXSUBDIVISION) ? 1 : 0);
270 }
271 #endif /* __glumapdesc_h_ */
REAL maxDifference(int, REAL *, int)
int isrational
Definition: mapdesc.h:116
Maxmatrix bmat
Definition: mapdesc.h:121
int isSampling(void)
Definition: mapdesc.h:255
int mask
Definition: mapdesc.h:120
void xformCulling(REAL *, int, int, REAL *, int)
Definition: mapdesc.cc:472
int inhcoords
Definition: mapdesc.h:119
REAL calcPartialVelocity(REAL *, int, int, int, REAL)
Definition: mapdescv.cc:54
void copyPt(REAL *, REAL *)
Definition: mapdesc.cc:119
void surfbbox(REAL bb[2][MAXCOORDS])
Definition: mapdesc.cc:99
REAL s_steps
Definition: mapdesc.h:124
REAL bbox_subdividing
Definition: mapdesc.h:128
REAL maxsrate
Definition: mapdesc.h:110
int isDomainSampling(void)
Definition: mapdesc.h:210
int project(REAL *, int, REAL *, int, int)
Definition: mapdesc.cc:647
static const MAT2 mat
Definition: font.c:66
REAL calcVelocityRational(REAL *, int, int)
Definition: mapdesc.cc:723
#define N_NOCULLING
Definition: nurbsconsts.h:52
REAL getProperty(long)
Definition: mapdesc.cc:769
int isSurfaceAreaSampling(void)
Definition: mapdesc.h:234
void xformBounding(REAL *, int, int, REAL *, int)
Definition: mapdesc.cc:460
REAL Maxmatrix[MAXCOORDS][MAXCOORDS]
Definition: mapdesc.h:45
REAL t_steps
Definition: mapdesc.h:125
long getType(void)
Definition: mapdesc.h:168
int cullCheck(REAL *, int, int)
Definition: mapdesc.cc:425
REAL sampling_method
Definition: mapdesc.h:126
#define N_PARAMETRICDISTANCE
Definition: nurbsconsts.h:58
Maxmatrix cmat
Definition: mapdesc.h:122
int hcoords
Definition: mapdesc.h:118
int isParametricDistanceSampling(void)
Definition: mapdesc.h:216
REAL calcVelocityNonrational(REAL *, int, int)
Definition: mapdesc.cc:744
REAL object_space_error_tolerance
Definition: mapdesc.h:106
void setBboxsize(INREAL *)
Definition: mapdesc.cc:84
int isProperty(long)
Definition: mapdesc.cc:750
int getNcoords(void)
Definition: mapdesc.h:198
REAL bboxsize[MAXCOORDS]
Definition: mapdesc.h:112
REAL maxrate
Definition: mapdesc.h:109
#define N_FIXEDRATE
Definition: nurbsconsts.h:56
void setBmat(INREAL *, long, long)
Definition: mapdesc.h:150
REAL maxtrate
Definition: mapdesc.h:111
int bboxTooBig(REAL *, int, int, int, int, REAL [2][MAXCOORDS])
Definition: mapdesc.cc:663
void setProperty(long, REAL)
Definition: mapdesc.cc:797
#define N_NOBBOXSUBDIVISION
Definition: nurbsconsts.h:64
#define d
Definition: ke_i.h:81
void setCmat(INREAL *, long, long)
Definition: mapdesc.h:156
static void transform4d(float[4], float[4], float[4][4])
REAL error_tolerance
Definition: mapdesc.h:105
#define N_OBJECTSPACE_PATH
Definition: nurbsconsts.h:62
void bbox(REAL [2][MAXCOORDS], REAL *, int, int, int, int)
Definition: mapdesc.cc:696
void identify(REAL[MAXCOORDS][MAXCOORDS])
Definition: mapdesc.cc:91
unsigned int clipbits(REAL *)
Definition: mapdesc.cc:202
void subdivide(REAL *, REAL *, REAL, int, int)
Definition: mapdesc.cc:577
#define INREAL
Definition: types.h:40
void xformSampling(REAL *, int, int, REAL *, int)
Definition: mapdesc.cc:454
void setSmat(INREAL *, long, long)
Definition: mapdesc.h:162
GLdouble s
Definition: gl.h:2039
#define N_PATHLENGTH
Definition: nurbsconsts.h:59
int isBboxSubdividing(void)
Definition: mapdesc.h:267
int isObjectSpaceParaSampling(void)
Definition: mapdesc.h:222
#define N_DOMAINDISTANCE
Definition: nurbsconsts.h:57
long type
Definition: mapdesc.h:115
void xformRational(Maxmatrix, REAL *, REAL *)
Definition: mapdesc.cc:287
int isRational(void)
Definition: mapdesc.h:192
REAL pixel_tolerance
Definition: mapdesc.h:104
#define N_SURFACEAREA
Definition: nurbsconsts.h:60
void xformNonrational(Maxmatrix, REAL *, REAL *)
Definition: mapdesc.cc:321
static void copy(Maxmatrix, long, INREAL *, long, long)
Definition: mapdesc.cc:105
int isRangeSampling(void)
Definition: mapdesc.h:246
int isPathLengthSampling(void)
Definition: mapdesc.h:240
Mapdesc(long, int, int, Backend &)
Definition: mapdesc.cc:50
Mapdesc * next
Definition: mapdesc.h:129
#define N_OBJECTSPACE_PARA
Definition: nurbsconsts.h:61
REAL clampfactor
Definition: mapdesc.h:107
#define MAXCOORDS
Definition: defines.h:48
static void multmatrix4d(float[4][4], const float[4][4], const float[4][4])
float REAL
Definition: types.h:41
int isConstantSampling(void)
Definition: mapdesc.h:204
REAL minsavings
Definition: mapdesc.h:108
int xformAndCullCheck(REAL *, int, int, int, int)
Definition: mapdesc.cc:355
REAL culling_method
Definition: mapdesc.h:127
int isObjectSpacePathSampling(void)
Definition: mapdesc.h:228
void sumPt(REAL *, REAL *, REAL *, REAL, REAL)
Definition: mapdesc.cc:159
Backend & backend
Definition: mapdesc.h:130
Maxmatrix smat
Definition: mapdesc.h:123
int isCulling(void)
Definition: mapdesc.h:261
int ncoords
Definition: mapdesc.h:117
void xformMat(Maxmatrix, REAL *, int, int, REAL *, int)
Definition: mapdesc.cc:517