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.

81 lines
2.5 KiB

  1. /**************************************************************************
  2. * *
  3. * Copyright (C) 1992, Silicon Graphics, Inc. *
  4. * *
  5. * These coded instructions, statements, and computer programs contain *
  6. * unpublished proprietary information of Silicon Graphics, Inc., and *
  7. * are protected by Federal copyright law. They may not be disclosed *
  8. * to third parties or copied or duplicated in any form, in whole or *
  9. * in part, without the prior written consent of Silicon Graphics, Inc. *
  10. * *
  11. **************************************************************************/
  12. /*
  13. * curvesub.c++ - $Revision: 1.1 $
  14. * Derrick Burns - 1991
  15. */
  16. #include "glimport.h"
  17. #include "myassert.h"
  18. #include "mystdio.h"
  19. #include "subdivid.h"
  20. #include "renderhi.h"
  21. #include "backend.h"
  22. #include "quilt.h"
  23. #include "curvelis.h"
  24. #include "curve.h"
  25. #include "nurbscon.h"
  26. /*--------------------------------------------------------------------------
  27. * drawCurves - main curve rendering entry point
  28. *--------------------------------------------------------------------------
  29. */
  30. void
  31. Subdivider::drawCurves( void )
  32. {
  33. REAL from[1], to[1];
  34. Flist bpts;
  35. qlist->getRange( from, to, bpts );
  36. renderhints.init( );
  37. backend.bgncurv();
  38. for( int i=bpts.start; i<bpts.end-1; i++ ) {
  39. REAL pta, ptb;
  40. pta = bpts.pts[i];
  41. ptb = bpts.pts[i+1];
  42. qlist->downloadAll( &pta, &ptb, backend );
  43. Curvelist curvelist( qlist, pta, ptb );
  44. samplingSplit( curvelist, renderhints.maxsubdivisions );
  45. }
  46. backend.endcurv();
  47. }
  48. /*--------------------------------------------------------------------------
  49. * samplingSplit - recursively subdivide patch, cull check each subpatch
  50. *--------------------------------------------------------------------------
  51. */
  52. void
  53. Subdivider::samplingSplit( Curvelist& curvelist, int subdivisions )
  54. {
  55. if( curvelist.cullCheck() == CULL_TRIVIAL_REJECT ) return;
  56. curvelist.getstepsize();
  57. if( curvelist.needsSamplingSubdivision() && (subdivisions > 0) ) {
  58. REAL mid = ( curvelist.range[0] + curvelist.range[1] ) * 0.5;
  59. Curvelist lowerlist( curvelist, mid );
  60. samplingSplit( lowerlist, subdivisions-1 ); // lower
  61. samplingSplit( curvelist, subdivisions-1 ); // upper
  62. } else {
  63. long nu = 1 + ((long) (curvelist.range[2] / curvelist.stepsize));
  64. backend.curvgrid( curvelist.range[0], curvelist.range[1], nu );
  65. backend.curvmesh( 0, nu );
  66. }
  67. }