Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
6.7 KiB

  1. #ifndef __glumapdesc_h_
  2. #define __glumapdesc_h_
  3. /**************************************************************************
  4. * *
  5. * Copyright (C) 1992, Silicon Graphics, Inc. *
  6. * *
  7. * These coded instructions, statements, and computer programs contain *
  8. * unpublished proprietary information of Silicon Graphics, Inc., and *
  9. * are protected by Federal copyright law. They may not be disclosed *
  10. * to third parties or copied or duplicated in any form, in whole or *
  11. * in part, without the prior written consent of Silicon Graphics, Inc. *
  12. * *
  13. **************************************************************************/
  14. /*
  15. * mapdesc.h - $Revision: 1.1 $
  16. */
  17. #include "mystdio.h"
  18. #include "types.h"
  19. #include "defines.h"
  20. #include "bufpool.h"
  21. #include "nurbscon.h"
  22. typedef REAL Maxmatrix[MAXCOORDS][MAXCOORDS];
  23. class Backend;
  24. class Mapdesc : public PooledObj {
  25. friend class Maplist;
  26. public:
  27. Mapdesc( long, int, int, Backend & );
  28. int isProperty( long );
  29. REAL getProperty( long );
  30. void setProperty( long, REAL );
  31. int isConstantSampling( void );
  32. int isDomainSampling( void );
  33. int isRangeSampling( void );
  34. int isSampling( void );
  35. int isParametricDistanceSampling( void );
  36. int isSurfaceAreaSampling( void );
  37. int isPathLengthSampling( void );
  38. int isCulling( void );
  39. int isBboxSubdividing( void );
  40. long getType( void );
  41. /* curve routines */
  42. void subdivide( REAL *, REAL *, REAL, int, int );
  43. int cullCheck( REAL *, int, int );
  44. void xformBounding( REAL *, int, int, REAL *, int );
  45. void xformCulling( REAL *, int, int, REAL *, int );
  46. void xformSampling( REAL *, int, int, REAL *, int );
  47. void xformMat( Maxmatrix, REAL *, int, int, REAL *, int );
  48. REAL calcPartialVelocity ( REAL *, int, int, int, REAL );
  49. int project( REAL *, int, REAL *, int, int );
  50. REAL calcVelocityRational( REAL *, int, int );
  51. REAL calcVelocityNonrational( REAL *, int, int );
  52. /* surface routines */
  53. void subdivide( REAL *, REAL *, REAL, int, int, int, int );
  54. int cullCheck( REAL *, int, int, int, int );
  55. void xformBounding( REAL *, int, int, int, int, REAL *, int, int );
  56. void xformCulling( REAL *, int, int, int, int, REAL *, int, int );
  57. void xformSampling( REAL *, int, int, int, int, REAL *, int, int );
  58. void xformMat( Maxmatrix, REAL *, int, int, int, int, REAL *, int, int );
  59. REAL calcPartialVelocity ( REAL *, REAL *, int, int, int, int, int, int, REAL, REAL, int );
  60. int project( REAL *, int, int, REAL *, int, int, int, int);
  61. void surfbbox( REAL bb[2][MAXCOORDS] );
  62. int bboxTooBig( REAL *, int, int, int, int, REAL [2][MAXCOORDS] );
  63. int xformAndCullCheck( REAL *, int, int, int, int );
  64. void identify( REAL[MAXCOORDS][MAXCOORDS] );
  65. void setBboxsize( INREAL *);
  66. inline void setBmat( INREAL*, long, long );
  67. inline void setCmat( INREAL*, long, long );
  68. inline void setSmat( INREAL*, long, long );
  69. inline int isRational( void );
  70. inline int getNcoords( void );
  71. REAL pixel_tolerance; /* pathlength sampling tolerance */
  72. REAL error_tolerance; /* parametric error sampling tolerance*/
  73. REAL clampfactor;
  74. REAL minsavings;
  75. REAL maxrate;
  76. REAL maxsrate;
  77. REAL maxtrate;
  78. REAL bboxsize[MAXCOORDS];
  79. private:
  80. long type;
  81. int isrational;
  82. int ncoords;
  83. int hcoords;
  84. int inhcoords;
  85. #ifdef NT
  86. unsigned int mask;
  87. #else
  88. int mask;
  89. #endif
  90. Maxmatrix bmat;
  91. Maxmatrix cmat;
  92. Maxmatrix smat;
  93. REAL s_steps; /* max samples in s direction */
  94. REAL t_steps; /* max samples in t direction */
  95. REAL sampling_method;
  96. REAL culling_method; /* check for culling */
  97. REAL bbox_subdividing;
  98. Mapdesc * next;
  99. Backend & backend;
  100. void bbox( REAL [2][MAXCOORDS], REAL *, int, int, int, int );
  101. REAL maxDifference( int, REAL *, int );
  102. static void copy( Maxmatrix, long, INREAL *, long, long );
  103. /* individual control point routines */
  104. static void transform4d( float[4], float[4], float[4][4] );
  105. static void multmatrix4d ( float[4][4], float[4][4], float[4][4] );
  106. void copyPt( REAL *, REAL * );
  107. void sumPt( REAL *, REAL *, REAL *, REAL, REAL );
  108. void xformSampling( REAL *, REAL * );
  109. void xformCulling( REAL *, REAL * );
  110. void xformRational( Maxmatrix, REAL *, REAL * );
  111. void xformNonrational( Maxmatrix, REAL *, REAL * );
  112. unsigned int clipbits( REAL * );
  113. };
  114. inline void
  115. Mapdesc::setBmat( INREAL *mat, long rstride, long cstride )
  116. {
  117. copy( bmat, hcoords, mat, rstride, cstride );
  118. }
  119. inline void
  120. Mapdesc::setCmat( INREAL *mat, long rstride, long cstride )
  121. {
  122. copy( cmat, hcoords, mat, rstride, cstride );
  123. }
  124. inline void
  125. Mapdesc::setSmat( INREAL *mat, long rstride, long cstride )
  126. {
  127. copy( smat, hcoords, mat, rstride, cstride );
  128. }
  129. inline long
  130. Mapdesc::getType( void )
  131. {
  132. return type;
  133. }
  134. inline void
  135. Mapdesc::xformCulling( REAL *d, REAL *s )
  136. {
  137. if( isrational )
  138. xformRational( cmat, d, s );
  139. else
  140. xformNonrational( cmat, d, s );
  141. }
  142. inline void
  143. Mapdesc::xformSampling( REAL *d, REAL *s )
  144. {
  145. if( isrational )
  146. xformRational( smat, d, s );
  147. else
  148. xformNonrational( smat, d, s );
  149. }
  150. inline int
  151. Mapdesc::isRational( void )
  152. {
  153. return isrational ? 1 : 0;
  154. }
  155. inline int
  156. Mapdesc::getNcoords( void )
  157. {
  158. return ncoords;
  159. }
  160. inline int
  161. Mapdesc::isConstantSampling( void )
  162. {
  163. return ((sampling_method == N_FIXEDRATE) ? 1 : 0);
  164. }
  165. inline int
  166. Mapdesc::isDomainSampling( void )
  167. {
  168. return ((sampling_method == N_DOMAINDISTANCE) ? 1 : 0);
  169. }
  170. inline int
  171. Mapdesc::isParametricDistanceSampling( void )
  172. {
  173. return ((sampling_method == N_PARAMETRICDISTANCE) ? 1 : 0);
  174. }
  175. inline int
  176. Mapdesc::isSurfaceAreaSampling( void )
  177. {
  178. return ((sampling_method == N_SURFACEAREA) ? 1 : 0);
  179. }
  180. inline int
  181. Mapdesc::isPathLengthSampling( void )
  182. {
  183. return ((sampling_method == N_PATHLENGTH) ? 1 : 0);
  184. }
  185. inline int
  186. Mapdesc::isRangeSampling( void )
  187. {
  188. return ( isParametricDistanceSampling() || isPathLengthSampling() ||
  189. isSurfaceAreaSampling() );
  190. }
  191. inline int
  192. Mapdesc::isSampling( void )
  193. {
  194. return isRangeSampling() || isConstantSampling() || isDomainSampling();
  195. }
  196. inline int
  197. Mapdesc::isCulling( void )
  198. {
  199. return ((culling_method != N_NOCULLING) ? 1 : 0);
  200. }
  201. inline int
  202. Mapdesc::isBboxSubdividing( void )
  203. {
  204. return ((bbox_subdividing != N_NOBBOXSUBDIVISION) ? 1 : 0);
  205. }
  206. #endif /* __glumapdesc_h_ */