source: trunk/src/opengl/glu/nurbs/internals/mapdesc.h

Last change on this file was 2689, checked in by jeroen, 26 years ago

* empty log message *

File size: 8.3 KB
Line 
1/* $Id: mapdesc.h,v 1.1 2000-02-09 08:49:52 jeroen Exp $ */
2/*
3** License Applicability. Except to the extent portions of this file are
4** made subject to an alternative license as permitted in the SGI Free
5** Software License B, Version 1.0 (the "License"), the contents of this
6** file are subject only to the provisions of the License. You may not use
7** this file except in compliance with the License. You may obtain a copy
8** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
9** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
10**
11** http://oss.sgi.com/projects/FreeB
12**
13** Note that, as provided in the License, the Software is distributed on an
14** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
15** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
16** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
17** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
18**
19** Original Code. The Original Code is: OpenGL Sample Implementation,
20** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
21** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
22** Copyright in any portions created by third parties is as indicated
23** elsewhere herein. All Rights Reserved.
24**
25** Additional Notice Provisions: The application programming interfaces
26** established by SGI in conjunction with the Original Code are The
27** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
28** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
29** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
30** Window System(R) (Version 1.3), released October 19, 1998. This software
31** was created using the OpenGL(R) version 1.2.1 Sample Implementation
32** published by SGI, but has not been independently verified as being
33** compliant with the OpenGL(R) version 1.2.1 Specification.
34*/
35
36/*
37 * mapdesc.h
38 *
39 * $Date: 2000-02-09 08:49:52 $ $Revision: 1.1 $
40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/internals/mapdesc.h,v 1.1 2000-02-09 08:49:52 jeroen Exp $
41 */
42
43#ifndef __glumapdesc_h_
44#define __glumapdesc_h_
45
46#include "mystdio.h"
47#include "types.h"
48#include "defines.h"
49#include "bufpool.h"
50#include "nurbsconsts.h"
51
52typedef REAL Maxmatrix[MAXCOORDS][MAXCOORDS];
53
54class Backend;
55
56class Mapdesc : public PooledObj {
57 friend class Maplist;
58
59public:
60 Mapdesc( long, int, int, Backend & );
61 int isProperty( long );
62 REAL getProperty( long );
63 void setProperty( long, REAL );
64 int isConstantSampling( void );
65 int isDomainSampling( void );
66 int isRangeSampling( void );
67 int isSampling( void );
68 int isParametricDistanceSampling( void );
69 int isObjectSpaceParaSampling( void );
70 int isObjectSpacePathSampling( void );
71 int isSurfaceAreaSampling( void );
72 int isPathLengthSampling( void );
73 int isCulling( void );
74 int isBboxSubdividing( void );
75 long getType( void );
76
77 /* curve routines */
78 void subdivide( REAL *, REAL *, REAL, int, int );
79 int cullCheck( REAL *, int, int );
80 void xformBounding( REAL *, int, int, REAL *, int );
81 void xformCulling( REAL *, int, int, REAL *, int );
82 void xformSampling( REAL *, int, int, REAL *, int );
83 void xformMat( Maxmatrix, REAL *, int, int, REAL *, int );
84 REAL calcPartialVelocity ( REAL *, int, int, int, REAL );
85 int project( REAL *, int, REAL *, int, int );
86 REAL calcVelocityRational( REAL *, int, int );
87 REAL calcVelocityNonrational( REAL *, int, int );
88
89 /* surface routines */
90 void subdivide( REAL *, REAL *, REAL, int, int, int, int );
91 int cullCheck( REAL *, int, int, int, int );
92 void xformBounding( REAL *, int, int, int, int, REAL *, int, int );
93 void xformCulling( REAL *, int, int, int, int, REAL *, int, int );
94 void xformSampling( REAL *, int, int, int, int, REAL *, int, int );
95 void xformMat( Maxmatrix, REAL *, int, int, int, int, REAL *, int, int );
96 REAL calcPartialVelocity ( REAL *, REAL *, int, int, int, int, int, int, REAL, REAL, int );
97 int project( REAL *, int, int, REAL *, int, int, int, int);
98 void surfbbox( REAL bb[2][MAXCOORDS] );
99
100 int bboxTooBig( REAL *, int, int, int, int, REAL [2][MAXCOORDS] );
101 int xformAndCullCheck( REAL *, int, int, int, int );
102
103 void identify( REAL[MAXCOORDS][MAXCOORDS] );
104 void setBboxsize( INREAL *);
105 inline void setBmat( INREAL*, long, long );
106 inline void setCmat( INREAL*, long, long );
107 inline void setSmat( INREAL*, long, long );
108 inline int isRational( void );
109 inline int getNcoords( void );
110
111 REAL pixel_tolerance; /* pathlength sampling tolerance */
112 REAL error_tolerance; /* parametric error sampling tolerance*/
113 REAL object_space_error_tolerance; /* object space tess*/
114 REAL clampfactor;
115 REAL minsavings;
116 REAL maxrate;
117 REAL maxsrate;
118 REAL maxtrate;
119 REAL bboxsize[MAXCOORDS];
120
121private:
122 long type;
123 int isrational;
124 int ncoords;
125 int hcoords;
126 int inhcoords;
127 int mask;
128 Maxmatrix bmat;
129 Maxmatrix cmat;
130 Maxmatrix smat;
131 REAL s_steps; /* max samples in s direction */
132 REAL t_steps; /* max samples in t direction */
133 REAL sampling_method;
134 REAL culling_method; /* check for culling */
135 REAL bbox_subdividing;
136 Mapdesc * next;
137 Backend & backend;
138
139 void bbox( REAL [2][MAXCOORDS], REAL *, int, int, int, int );
140 REAL maxDifference( int, REAL *, int );
141 static void copy( Maxmatrix, long, INREAL *, long, long );
142
143 /* individual control point routines */
144 static void transform4d( float[4], float[4], float[4][4] );
145 static void multmatrix4d ( float[4][4], float[4][4], float[4][4] );
146 void copyPt( REAL *, REAL * );
147 void sumPt( REAL *, REAL *, REAL *, REAL, REAL );
148 void xformSampling( REAL *, REAL * );
149 void xformCulling( REAL *, REAL * );
150 void xformRational( Maxmatrix, REAL *, REAL * );
151 void xformNonrational( Maxmatrix, REAL *, REAL * );
152 unsigned int clipbits( REAL * );
153};
154
155inline void
156Mapdesc::setBmat( INREAL *mat, long rstride, long cstride )
157{
158 copy( bmat, hcoords, mat, rstride, cstride );
159}
160
161inline void
162Mapdesc::setCmat( INREAL *mat, long rstride, long cstride )
163{
164 copy( cmat, hcoords, mat, rstride, cstride );
165}
166
167inline void
168Mapdesc::setSmat( INREAL *mat, long rstride, long cstride )
169{
170 copy( smat, hcoords, mat, rstride, cstride );
171}
172
173inline long
174Mapdesc::getType( void )
175{
176 return type;
177}
178
179inline void
180Mapdesc::xformCulling( REAL *d, REAL *s )
181{
182 if( isrational )
183 xformRational( cmat, d, s );
184 else
185 xformNonrational( cmat, d, s );
186}
187
188inline void
189Mapdesc::xformSampling( REAL *d, REAL *s )
190{
191 if( isrational )
192 xformRational( smat, d, s );
193 else
194 xformNonrational( smat, d, s );
195}
196
197inline int
198Mapdesc::isRational( void )
199{
200 return isrational ? 1 : 0;
201}
202
203inline int
204Mapdesc::getNcoords( void )
205{
206 return ncoords;
207}
208
209inline int
210Mapdesc::isConstantSampling( void )
211{
212 return ((sampling_method == N_FIXEDRATE) ? 1 : 0);
213}
214
215inline int
216Mapdesc::isDomainSampling( void )
217{
218 return ((sampling_method == N_DOMAINDISTANCE) ? 1 : 0);
219}
220
221inline int
222Mapdesc::isParametricDistanceSampling( void )
223{
224 return ((sampling_method == N_PARAMETRICDISTANCE) ? 1 : 0);
225}
226
227inline int
228Mapdesc::isObjectSpaceParaSampling( void )
229{
230 return ((sampling_method == N_OBJECTSPACE_PARA) ? 1 : 0);
231}
232
233inline int
234Mapdesc::isObjectSpacePathSampling( void )
235{
236 return ((sampling_method == N_OBJECTSPACE_PATH) ? 1 : 0);
237}
238
239inline int
240Mapdesc::isSurfaceAreaSampling( void )
241{
242 return ((sampling_method == N_SURFACEAREA) ? 1 : 0);
243}
244
245inline int
246Mapdesc::isPathLengthSampling( void )
247{
248 return ((sampling_method == N_PATHLENGTH) ? 1 : 0);
249}
250
251inline int
252Mapdesc::isRangeSampling( void )
253{
254 return ( isParametricDistanceSampling() || isPathLengthSampling() ||
255 isSurfaceAreaSampling() ||
256 isObjectSpaceParaSampling() ||
257 isObjectSpacePathSampling());
258}
259
260inline int
261Mapdesc::isSampling( void )
262{
263 return isRangeSampling() || isConstantSampling() || isDomainSampling();
264}
265
266inline int
267Mapdesc::isCulling( void )
268{
269 return ((culling_method != N_NOCULLING) ? 1 : 0);
270}
271
272inline int
273Mapdesc::isBboxSubdividing( void )
274{
275 return ((bbox_subdividing != N_NOBBOXSUBDIVISION) ? 1 : 0);
276}
277#endif /* __glumapdesc_h_ */
Note: See TracBrowser for help on using the repository browser.