Source code of Windows XP (NT5)
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.

173 lines
4.5 KiB

  1. /**************************************************************************
  2. * *
  3. * Copyright (C) 1991, 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. * glcurveval.c++ - curve evaluator
  14. *
  15. * $Revision: 1.1 $
  16. */
  17. /* Polynomial Evaluator Interface */
  18. #include <glos.h>
  19. #include <GL/gl.h>
  20. #include "glimport.h"
  21. #include "glrender.h"
  22. #include "glcurvev.h"
  23. #include "nurbscon.h"
  24. OpenGLCurveEvaluator::OpenGLCurveEvaluator(void)
  25. {
  26. }
  27. OpenGLCurveEvaluator::~OpenGLCurveEvaluator(void)
  28. {
  29. }
  30. /* added nonsense to avoid the warning messages at compile time */
  31. void
  32. OpenGLCurveEvaluator::addMap(CurveMap *m)
  33. {
  34. m = m;
  35. }
  36. void
  37. OpenGLCurveEvaluator::range1f(long type, REAL *from, REAL *to)
  38. {
  39. type = type;
  40. from = from;
  41. to = to;
  42. }
  43. void
  44. OpenGLCurveEvaluator::domain1f(REAL ulo, REAL uhi)
  45. {
  46. ulo = ulo;
  47. uhi = uhi;
  48. }
  49. void
  50. OpenGLCurveEvaluator::bgnline(void)
  51. {
  52. glBegin((GLenum) GL_LINE_STRIP);
  53. }
  54. void
  55. OpenGLCurveEvaluator::endline(void)
  56. {
  57. glEnd();
  58. }
  59. /*---------------------------------------------------------------------------
  60. * disable - turn off a curve map
  61. *---------------------------------------------------------------------------
  62. */
  63. void
  64. OpenGLCurveEvaluator::disable(long type)
  65. {
  66. glDisable((GLenum) type);
  67. }
  68. /*---------------------------------------------------------------------------
  69. * enable - turn on a curve map
  70. *---------------------------------------------------------------------------
  71. */
  72. void
  73. OpenGLCurveEvaluator::enable(long type)
  74. {
  75. glEnable((GLenum) type);
  76. }
  77. /*-------------------------------------------------------------------------
  78. * mapgrid1f - define a lattice of points with origin and offset
  79. *-------------------------------------------------------------------------
  80. */
  81. void
  82. OpenGLCurveEvaluator::mapgrid1f(long nu, REAL u0, REAL u1)
  83. {
  84. glMapGrid1f((GLint) nu, (GLfloat) u0, (GLfloat) u1);
  85. }
  86. /*-------------------------------------------------------------------------
  87. * bgnmap1 - preamble to curve definition and evaluations
  88. *-------------------------------------------------------------------------
  89. */
  90. void
  91. OpenGLCurveEvaluator::bgnmap1f(long)
  92. {
  93. glPushAttrib((GLbitfield) GL_EVAL_BIT);
  94. }
  95. /*-------------------------------------------------------------------------
  96. * endmap1 - postamble to a curve map
  97. *-------------------------------------------------------------------------
  98. */
  99. void
  100. OpenGLCurveEvaluator::endmap1f(void)
  101. {
  102. glPopAttrib();
  103. }
  104. /*-------------------------------------------------------------------------
  105. * map1f - pass a desription of a curve map
  106. *-------------------------------------------------------------------------
  107. */
  108. void
  109. OpenGLCurveEvaluator::map1f(
  110. long type, /* map type */
  111. REAL ulo, /* lower parametric bound */
  112. REAL uhi, /* upper parametric bound */
  113. long stride, /* distance to next point in REALS */
  114. long order, /* parametric order */
  115. REAL *pts /* control points */
  116. )
  117. {
  118. glMap1f((GLenum) type, (GLfloat) ulo, (GLfloat) uhi, (GLint) stride,
  119. (GLint) order, (const GLfloat *) pts);
  120. }
  121. /*-------------------------------------------------------------------------
  122. * mapmesh1f - evaluate a mesh of points on lattice
  123. *-------------------------------------------------------------------------
  124. */
  125. void OpenGLCurveEvaluator::mapmesh1f(long style, long from, long to)
  126. {
  127. switch(style) {
  128. default:
  129. case N_MESHFILL:
  130. case N_MESHLINE:
  131. glEvalMesh1((GLenum) GL_LINE, (GLint) from, (GLint) to);
  132. break;
  133. case N_MESHPOINT:
  134. glEvalMesh1((GLenum) GL_POINT, (GLint) from, (GLint) to);
  135. break;
  136. }
  137. }
  138. /*-------------------------------------------------------------------------
  139. * evalpoint1i - evaluate a point on a curve
  140. *-------------------------------------------------------------------------
  141. */
  142. void OpenGLCurveEvaluator::evalpoint1i(long i)
  143. {
  144. glEvalPoint1((GLint) i);
  145. }
  146. /*-------------------------------------------------------------------------
  147. * evalcoord1f - evaluate a point on a curve
  148. *-------------------------------------------------------------------------
  149. */
  150. void OpenGLCurveEvaluator::evalcoord1f(long, REAL u)
  151. {
  152. glEvalCoord1f((GLfloat) u);
  153. }