2 ** License Applicability. Except to the extent portions of this file are
3 ** made subject to an alternative license as permitted in the SGI Free
4 ** Software License B, Version 1.1 (the "License"), the contents of this
5 ** file are subject only to the provisions of the License. You may not use
6 ** this file except in compliance with the License. You may obtain a copy
7 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
8 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
10 ** http://oss.sgi.com/projects/FreeB
12 ** Note that, as provided in the License, the Software is distributed on an
13 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
14 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
15 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
16 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
18 ** Original Code. The Original Code is: OpenGL Sample Implementation,
19 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
20 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
21 ** Copyright in any portions created by third parties is as indicated
22 ** elsewhere herein. All Rights Reserved.
24 ** Additional Notice Provisions: The application programming interfaces
25 ** established by SGI in conjunction with the Original Code are The
26 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
27 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
28 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
29 ** Window System(R) (Version 1.3), released October 19, 1998. This software
30 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
31 ** published by SGI, but has not been independently verified as being
32 ** compliant with the OpenGL(R) version 1.2.1 Specification.
38 * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
39 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mapdesc.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
42 #ifndef __glumapdesc_h_
43 #define __glumapdesc_h_
49 #include "nurbsconsts.h"
51 typedef REAL Maxmatrix
[MAXCOORDS
][MAXCOORDS
];
55 class Mapdesc
: public PooledObj
{
59 Mapdesc( long, int, int, Backend
& );
60 int isProperty( long );
61 REAL
getProperty( long );
62 void setProperty( long, REAL
);
63 int isConstantSampling( void );
64 int isDomainSampling( void );
65 int isRangeSampling( void );
66 int isSampling( void );
67 int isParametricDistanceSampling( void );
68 int isObjectSpaceParaSampling( void );
69 int isObjectSpacePathSampling( void );
70 int isSurfaceAreaSampling( void );
71 int isPathLengthSampling( void );
72 int isCulling( void );
73 int isBboxSubdividing( void );
77 void subdivide( REAL
*, REAL
*, REAL
, int, int );
78 int cullCheck( REAL
*, int, int );
79 void xformBounding( REAL
*, int, int, REAL
*, int );
80 void xformCulling( REAL
*, int, int, REAL
*, int );
81 void xformSampling( REAL
*, int, int, REAL
*, int );
82 void xformMat( Maxmatrix
, REAL
*, int, int, REAL
*, int );
83 REAL
calcPartialVelocity ( REAL
*, int, int, int, REAL
);
84 int project( REAL
*, int, REAL
*, int, int );
85 REAL
calcVelocityRational( REAL
*, int, int );
86 REAL
calcVelocityNonrational( REAL
*, int, int );
88 /* surface routines */
89 void subdivide( REAL
*, REAL
*, REAL
, int, int, int, int );
90 int cullCheck( REAL
*, int, int, int, int );
91 void xformBounding( REAL
*, int, int, int, int, REAL
*, int, int );
92 void xformCulling( REAL
*, int, int, int, int, REAL
*, int, int );
93 void xformSampling( REAL
*, int, int, int, int, REAL
*, int, int );
94 void xformMat( Maxmatrix
, REAL
*, int, int, int, int, REAL
*, int, int );
95 REAL
calcPartialVelocity ( REAL
*, REAL
*, int, int, int, int, int, int, REAL
, REAL
, int );
96 int project( REAL
*, int, int, REAL
*, int, int, int, int);
97 void surfbbox( REAL bb
[2][MAXCOORDS
] );
99 int bboxTooBig( REAL
*, int, int, int, int, REAL
[2][MAXCOORDS
] );
100 int xformAndCullCheck( REAL
*, int, int, int, int );
102 void identify( REAL
[MAXCOORDS
][MAXCOORDS
] );
103 void setBboxsize( INREAL
*);
104 inline void setBmat( INREAL
*, long, long );
105 inline void setCmat( INREAL
*, long, long );
106 inline void setSmat( INREAL
*, long, long );
107 inline int isRational( void );
108 inline int getNcoords( void );
110 REAL pixel_tolerance
; /* pathlength sampling tolerance */
111 REAL error_tolerance
; /* parametric error sampling tolerance*/
112 REAL object_space_error_tolerance
; /* object space tess*/
118 REAL bboxsize
[MAXCOORDS
];
130 REAL s_steps
; /* max samples in s direction */
131 REAL t_steps
; /* max samples in t direction */
132 REAL sampling_method
;
133 REAL culling_method
; /* check for culling */
134 REAL bbox_subdividing
;
138 void bbox( REAL
[2][MAXCOORDS
], REAL
*, int, int, int, int );
139 REAL
maxDifference( int, REAL
*, int );
140 static void copy( Maxmatrix
, long, INREAL
*, long, long );
142 /* individual control point routines */
143 static void transform4d( float[4], float[4], float[4][4] );
144 static void multmatrix4d ( float[4][4], const 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
* );
156 Mapdesc::setBmat( INREAL
*mat
, long rstride
, long cstride
)
158 copy( bmat
, hcoords
, mat
, rstride
, cstride
);
162 Mapdesc::setCmat( INREAL
*mat
, long rstride
, long cstride
)
164 copy( cmat
, hcoords
, mat
, rstride
, cstride
);
168 Mapdesc::setSmat( INREAL
*mat
, long rstride
, long cstride
)
170 copy( smat
, hcoords
, mat
, rstride
, cstride
);
174 Mapdesc::getType( void )
180 Mapdesc::xformCulling( REAL
*d
, REAL
*s
)
183 xformRational( cmat
, d
, s
);
185 xformNonrational( cmat
, d
, s
);
189 Mapdesc::xformSampling( REAL
*d
, REAL
*s
)
192 xformRational( smat
, d
, s
);
194 xformNonrational( smat
, d
, s
);
198 Mapdesc::isRational( void )
200 return isrational
? 1 : 0;
204 Mapdesc::getNcoords( void )
210 Mapdesc::isConstantSampling( void )
212 return ((sampling_method
== N_FIXEDRATE
) ? 1 : 0);
216 Mapdesc::isDomainSampling( void )
218 return ((sampling_method
== N_DOMAINDISTANCE
) ? 1 : 0);
222 Mapdesc::isParametricDistanceSampling( void )
224 return ((sampling_method
== N_PARAMETRICDISTANCE
) ? 1 : 0);
228 Mapdesc::isObjectSpaceParaSampling( void )
230 return ((sampling_method
== N_OBJECTSPACE_PARA
) ? 1 : 0);
234 Mapdesc::isObjectSpacePathSampling( void )
236 return ((sampling_method
== N_OBJECTSPACE_PATH
) ? 1 : 0);
240 Mapdesc::isSurfaceAreaSampling( void )
242 return ((sampling_method
== N_SURFACEAREA
) ? 1 : 0);
246 Mapdesc::isPathLengthSampling( void )
248 return ((sampling_method
== N_PATHLENGTH
) ? 1 : 0);
252 Mapdesc::isRangeSampling( void )
254 return ( isParametricDistanceSampling() || isPathLengthSampling() ||
255 isSurfaceAreaSampling() ||
256 isObjectSpaceParaSampling() ||
257 isObjectSpacePathSampling());
261 Mapdesc::isSampling( void )
263 return isRangeSampling() || isConstantSampling() || isDomainSampling();
267 Mapdesc::isCulling( void )
269 return ((culling_method
!= N_NOCULLING
) ? 1 : 0);
273 Mapdesc::isBboxSubdividing( void )
275 return ((bbox_subdividing
!= N_NOBBOXSUBDIVISION
) ? 1 : 0);
277 #endif /* __glumapdesc_h_ */