43 #include "glimports.h"
44 #include "glrenderer.h"
45 #include "glcurveval.h"
46 #include "nurbsconsts.h"
48 OpenGLCurveEvaluator::OpenGLCurveEvaluator(
void)
51 beginCallBackN = NULL;
53 vertexCallBackN = NULL;
54 normalCallBackN = NULL;
55 colorCallBackN = NULL;
56 texcoordCallBackN = NULL;
57 beginCallBackData = NULL;
58 endCallBackData = NULL;
59 vertexCallBackData = NULL;
60 normalCallBackData = NULL;
61 colorCallBackData = NULL;
62 texcoordCallBackData = NULL;
71 em_vertex.uprime = -1.0;
72 em_normal.uprime = -1.0;
73 em_color.uprime = -1.0;
74 em_texcoord.uprime = -1.0;
78 OpenGLCurveEvaluator::~OpenGLCurveEvaluator(
void)
84 OpenGLCurveEvaluator::addMap(CurveMap *m)
90 OpenGLCurveEvaluator::range1f(
long type, REAL *from, REAL *to)
98 OpenGLCurveEvaluator::domain1f(REAL ulo, REAL uhi)
105 OpenGLCurveEvaluator::bgnline(
void)
108 beginCallBack(GL_LINE_STRIP, userData);
111 glBegin((GLenum) GL_LINE_STRIP);
116 OpenGLCurveEvaluator::endline(
void)
119 endCallBack(userData);
131 OpenGLCurveEvaluator::disable(
long type)
133 glDisable((GLenum) type);
141 OpenGLCurveEvaluator::enable(
long type)
143 glEnable((GLenum) type);
151 OpenGLCurveEvaluator::mapgrid1f(
long nu, REAL u0, REAL u1)
157 global_grid_nu = (int) nu;
161 glMapGrid1f((GLint) nu, (GLfloat) u0, (GLfloat) u1);
170 OpenGLCurveEvaluator::bgnmap1f(
long)
183 glPushAttrib((GLbitfield) GL_EVAL_BIT);
192 OpenGLCurveEvaluator::endmap1f(
void)
209 OpenGLCurveEvaluator::map1f(
223 case GL_MAP1_VERTEX_3:
227 case GL_MAP1_VERTEX_4:
235 case GL_MAP1_COLOR_4:
243 case GL_MAP1_TEXTURE_COORD_1:
247 case GL_MAP1_TEXTURE_COORD_2:
252 case GL_MAP1_TEXTURE_COORD_3:
256 case GL_MAP1_TEXTURE_COORD_4:
261 inMap1f(which, dimension, ulo, uhi, stride, order, pts);
265 glMap1f((GLenum) type, (GLfloat) ulo, (GLfloat) uhi, (GLint) stride,
266 (GLint) order, (
const GLfloat *) pts);
274 void OpenGLCurveEvaluator::mapmesh1f(
long style,
long from,
long to)
278 inMapMesh1f((
int) from, (
int) to);
287 glEvalMesh1((GLenum) GL_LINE, (GLint) from, (GLint) to);
290 glEvalMesh1((GLenum) GL_POINT, (GLint) from, (GLint) to);
301 void OpenGLCurveEvaluator::evalpoint1i(
long i)
304 glEvalPoint1((GLint) i);
312 void OpenGLCurveEvaluator::evalcoord1f(
long, REAL u)
315 glEvalCoord1f((GLfloat) u);
321 OpenGLCurveEvaluator::putCallBack(GLenum which,
void (GLAPIENTRY *fn)())
323 OpenGLCurveEvaluator::putCallBack(GLenum which, _GLUfuncptr fn)
328 case GLU_NURBS_BEGIN:
329 beginCallBackN = (void (GLAPIENTRY *) (GLenum)) fn;
332 endCallBackN = (void (GLAPIENTRY *) (void)) fn;
334 case GLU_NURBS_VERTEX:
335 vertexCallBackN = (void (GLAPIENTRY *) (
const GLfloat*)) fn;
337 case GLU_NURBS_NORMAL:
338 normalCallBackN = (void (GLAPIENTRY *) (
const GLfloat*)) fn;
340 case GLU_NURBS_COLOR:
341 colorCallBackN = (void (GLAPIENTRY *) (
const GLfloat*)) fn;
343 case GLU_NURBS_TEXTURE_COORD:
344 texcoordCallBackN = (void (GLAPIENTRY *) (
const GLfloat*)) fn;
346 case GLU_NURBS_BEGIN_DATA:
347 beginCallBackData = (void (GLAPIENTRY *) (GLenum,
void*)) fn;
349 case GLU_NURBS_END_DATA:
350 endCallBackData = (void (GLAPIENTRY *) (
void*)) fn;
352 case GLU_NURBS_VERTEX_DATA:
353 vertexCallBackData = (void (GLAPIENTRY *) (
const GLfloat*,
void*)) fn;
355 case GLU_NURBS_NORMAL_DATA:
356 normalCallBackData = (void (GLAPIENTRY *) (
const GLfloat*,
void*)) fn;
358 case GLU_NURBS_COLOR_DATA:
359 colorCallBackData = (void (GLAPIENTRY *) (
const GLfloat*,
void*)) fn;
361 case GLU_NURBS_TEXTURE_COORD_DATA:
362 texcoordCallBackData = (void (GLAPIENTRY *) (
const GLfloat*,
void*)) fn;
368 OpenGLCurveEvaluator::beginCallBack(GLenum which,
void *data)
370 if(beginCallBackData)
371 beginCallBackData(which, data);
372 else if(beginCallBackN)
373 beginCallBackN(which);
377 OpenGLCurveEvaluator::endCallBack(
void *data)
380 endCallBackData(data);
381 else if(endCallBackN)
386 OpenGLCurveEvaluator::vertexCallBack(
const GLfloat *vert,
void* data)
388 if(vertexCallBackData)
389 vertexCallBackData(vert, data);
390 else if(vertexCallBackN)
391 vertexCallBackN(vert);
396 OpenGLCurveEvaluator::normalCallBack(
const GLfloat *normal,
void* data)
398 if(normalCallBackData)
399 normalCallBackData(normal, data);
400 else if(normalCallBackN)
401 normalCallBackN(normal);
405 OpenGLCurveEvaluator::colorCallBack(
const GLfloat *color,
void* data)
407 if(colorCallBackData)
408 colorCallBackData(color, data);
409 else if(colorCallBackN)
410 colorCallBackN(color);
414 OpenGLCurveEvaluator::texcoordCallBack(
const GLfloat *texcoord,
void* data)
416 if(texcoordCallBackData)
417 texcoordCallBackData(texcoord, data);
418 else if(texcoordCallBackN)
419 texcoordCallBackN(texcoord);