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.

158 lines
4.8 KiB

  1. #ifndef __glusubdivider_h_
  2. #define __glusubdivider_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. * subdivider.h - $Revision: 1.1 $
  16. */
  17. #include "mysetjmp.h"
  18. #include "bin.h"
  19. #include "flist.h"
  20. #include "slicer.h"
  21. #include "arctess.h"
  22. #include "trimvert.h"
  23. #include "trimpool.h"
  24. class Arc;
  25. class Pool;
  26. class Renderhints;
  27. class Backend;
  28. class Quilt;
  29. class Patchlist;
  30. class Curvelist;
  31. #ifdef NT
  32. struct JumpBuffer;
  33. #else
  34. class JumpBuffer;
  35. #endif
  36. class Subdivider {
  37. public:
  38. Subdivider( Renderhints&, Backend& );
  39. ~Subdivider( void );
  40. void clear( void );
  41. void beginTrims( void ) {}
  42. void beginLoop( void );
  43. void addArc( REAL *, Quilt *, long );
  44. void addArc( int, TrimVertex *, long );
  45. void endLoop( void ) {}
  46. void endTrims( void ) {}
  47. void beginQuilts( void );
  48. void addQuilt( Quilt * );
  49. void endQuilts( void ) {}
  50. void drawCurves( void );
  51. void drawSurfaces( long );
  52. int ccwTurn_sl( Arc *, Arc * );
  53. int ccwTurn_sr( Arc *, Arc * );
  54. int ccwTurn_tl( Arc *, Arc * );
  55. int ccwTurn_tr( Arc *, Arc * );
  56. void setJumpbuffer( JumpBuffer * );
  57. private:
  58. void classify_headonleft_s( Bin &, Bin &, Bin &, REAL );
  59. void classify_tailonleft_s( Bin &, Bin &, Bin &, REAL );
  60. void classify_headonright_s( Bin &, Bin &, Bin &, REAL );
  61. void classify_tailonright_s( Bin &, Bin &, Bin &, REAL );
  62. void classify_headonleft_t( Bin &, Bin &, Bin &, REAL );
  63. void classify_tailonleft_t( Bin &, Bin &, Bin &, REAL );
  64. void classify_headonright_t( Bin &, Bin &, Bin &, REAL );
  65. void classify_tailonright_t( Bin &, Bin &, Bin &, REAL );
  66. enum dir { down, same, up, none };
  67. void tessellate( Arc *, REAL );
  68. void monotonize( Arc *, Bin & );
  69. int isMonotone( Arc * );
  70. int decompose( Bin &, REAL );
  71. Slicer slicer;
  72. ArcTessellator arctessellator;
  73. Pool arcpool;
  74. Pool bezierarcpool;
  75. Pool pwlarcpool;
  76. TrimVertexPool trimvertexpool;
  77. JumpBuffer* jumpbuffer;
  78. Renderhints& renderhints;
  79. Backend& backend;
  80. Bin initialbin;
  81. Arc * pjarc;
  82. int s_index;
  83. int t_index;
  84. Quilt * qlist;
  85. Flist spbrkpts;
  86. Flist tpbrkpts;
  87. Flist smbrkpts;
  88. Flist tmbrkpts;
  89. REAL stepsizes[4];
  90. int showDegenerate;
  91. int isArcTypeBezier;
  92. void samplingSplit( Curvelist&, int );
  93. void subdivideInS( Bin& );
  94. void splitInS( Bin&, int, int );
  95. void splitInT( Bin&, int, int );
  96. void samplingSplit( Bin&, Patchlist&, int, int );
  97. void nonSamplingSplit( Bin&, Patchlist&, int, int );
  98. void tessellation( Bin&, Patchlist& );
  99. void monosplitInS( Bin&, int, int );
  100. void monosplitInT( Bin&, int, int );
  101. void outline( Bin & );
  102. void freejarcs( Bin & );
  103. void render( Bin & );
  104. void split( Bin &, Bin &, Bin &, int, REAL );
  105. void tessellate( Bin &, REAL, REAL, REAL, REAL );
  106. inline void setDegenerate( void ) { showDegenerate = 1; }
  107. inline void setNonDegenerate( void ) { showDegenerate = 0; }
  108. inline int showingDegenerate( void ) { return showDegenerate; }
  109. inline void setArcTypeBezier( void ) { isArcTypeBezier = 1; }
  110. inline void setArcTypePwl( void ) { isArcTypeBezier = 0; }
  111. inline int isBezierArcType( void ) { return isArcTypeBezier; }
  112. void makeBorderTrim( const REAL *, const REAL * );
  113. void split( Bin &, int, const REAL *, int, int );
  114. void partition( Bin &, Bin &, Bin &, Bin &, Bin &, int, REAL );
  115. void findIrregularS( Bin & );
  116. void findIrregularT( Bin & );
  117. inline int bbox( TrimVertex *, TrimVertex *, TrimVertex *, int );
  118. static int bbox( REAL, REAL, REAL, REAL, REAL, REAL );
  119. static int ccw( TrimVertex *, TrimVertex *, TrimVertex * );
  120. void join_s( Bin &, Bin &, Arc *, Arc * );
  121. void join_t( Bin &, Bin &, Arc *, Arc * );
  122. int arc_split( Arc *, int, REAL, int );
  123. void check_s( Arc *, Arc * );
  124. void check_t( Arc *, Arc * );
  125. inline void link( Arc *, Arc *, Arc *, Arc * );
  126. inline void simple_link( Arc *, Arc * );
  127. };
  128. inline void
  129. Subdivider::beginLoop( void )
  130. {
  131. pjarc = 0;
  132. }
  133. #endif /* __glusubdivider_h_ */