ReactOS 0.4.15-dev-7897-g78dc504
glinterface.cc File Reference
#include "gluos.h"
#include "glrenderer.h"
Include dependency graph for glinterface.cc:

Go to the source code of this file.

Functions

void glu_LOD_eval_list (GLUnurbs *nurb, int level)
 
GLUnurbs *GLAPIENTRY gluNewNurbsRenderer (void)
 
void GLAPIENTRY gluDeleteNurbsRenderer (GLUnurbs *r)
 
void GLAPIENTRY gluDeleteNurbsTessellatorEXT (GLUnurbsObj *r)
 
void GLAPIENTRY gluBeginSurface (GLUnurbs *r)
 
void GLAPIENTRY gluBeginCurve (GLUnurbs *r)
 
void GLAPIENTRY gluEndCurve (GLUnurbs *r)
 
void GLAPIENTRY gluEndSurface (GLUnurbs *r)
 
void GLAPIENTRY gluBeginTrim (GLUnurbs *r)
 
void GLAPIENTRY gluEndTrim (GLUnurbs *r)
 
void GLAPIENTRY gluPwlCurve (GLUnurbs *r, GLint count, INREAL array[], GLint stride, GLenum type)
 
void GLAPIENTRY gluNurbsCurve (GLUnurbs *r, GLint nknots, INREAL knot[], GLint stride, INREAL ctlarray[], GLint order, GLenum type)
 
void GLAPIENTRY gluNurbsSurface (GLUnurbs *r, GLint sknot_count, GLfloat *sknot, GLint tknot_count, GLfloat *tknot, GLint s_stride, GLint t_stride, GLfloat *ctlarray, GLint sorder, GLint torder, GLenum type)
 
void GLAPIENTRY gluLoadSamplingMatrices (GLUnurbs *r, const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4])
 
void GLAPIENTRY gluNurbsProperty (GLUnurbs *r, GLenum property, GLfloat value)
 
void GLAPIENTRY gluGetNurbsProperty (GLUnurbs *r, GLenum property, GLfloat *value)
 
void GLAPIENTRY gluNurbsCallback (GLUnurbs *r, GLenum which, _GLUfuncptr fn)
 
void GLAPIENTRY gluNurbsCallbackDataEXT (GLUnurbs *r, void *userData)
 
void GLAPIENTRY gluNurbsCallbackData (GLUnurbs *r, void *userData)
 

Function Documentation

◆ glu_LOD_eval_list()

void glu_LOD_eval_list ( GLUnurbs nurb,
int  level 
)

Definition at line 60 of file glinterface.cc.

61{
62 nurb->LOD_eval_list(level);
63}
void LOD_eval_list(int level)
Definition: glrenderer.h:112
GLint level
Definition: gl.h:1546

◆ gluBeginCurve()

void GLAPIENTRY gluBeginCurve ( GLUnurbs r)

Definition at line 99 of file glinterface.cc.

100{
101 r->bgncurve(0);
102}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055

◆ gluBeginSurface()

void GLAPIENTRY gluBeginSurface ( GLUnurbs r)

Definition at line 89 of file glinterface.cc.

90{
91#ifdef DOWN_LOAD_NURBS
92surfcount++;
93tempTrim = OTL_make(10,10);
94#endif
95 r->bgnsurface(0);
96}

◆ gluBeginTrim()

void GLAPIENTRY gluBeginTrim ( GLUnurbs r)

Definition at line 131 of file glinterface.cc.

132{
133#ifdef DOWN_LOAD_NURBS
134OTL_bgnTrim(tempTrim);
135#endif
136
137 r->bgntrim();
138}

◆ gluDeleteNurbsRenderer()

void GLAPIENTRY gluDeleteNurbsRenderer ( GLUnurbs r)

Definition at line 75 of file glinterface.cc.

76{
77 delete r;
78}

◆ gluDeleteNurbsTessellatorEXT()

void GLAPIENTRY gluDeleteNurbsTessellatorEXT ( GLUnurbsObj r)

Definition at line 83 of file glinterface.cc.

84{
85 delete r;
86}

◆ gluEndCurve()

void GLAPIENTRY gluEndCurve ( GLUnurbs r)

Definition at line 105 of file glinterface.cc.

106{
107 r->endcurve();
108}

◆ gluEndSurface()

void GLAPIENTRY gluEndSurface ( GLUnurbs r)

Definition at line 111 of file glinterface.cc.

112{
113#ifdef DOWN_LOAD_NURBS
114if(surfcount == 1)
115 otn = OTN_make(1);
116OTN_insert(otn, tempNurb, tempTrim);
117if(surfcount >= 1)
118{
119#ifdef DEBUG
120printf("write file\n");
121#endif
122OTN_write(otn, "out.otn");
123
124}
125#endif
126
127 r->endsurface();
128}
#define printf
Definition: freeldr.h:93

◆ gluEndTrim()

void GLAPIENTRY gluEndTrim ( GLUnurbs r)

Definition at line 141 of file glinterface.cc.

142{
143#ifdef DOWN_LOAD_NURBS
144OTL_endTrim(tempTrim);
145#endif
146 r->endtrim();
147}

◆ gluGetNurbsProperty()

void GLAPIENTRY gluGetNurbsProperty ( GLUnurbs r,
GLenum  property,
GLfloat value 
)

Definition at line 359 of file glinterface.cc.

360{
361 GLfloat nurbsValue;
362
363 switch(property) {
365 if (r->getautoloadmode()) {
366 *value = GL_TRUE;
367 } else {
368 *value = GL_FALSE;
369 }
370 break;
371 case GLU_CULLING:
372 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_CULLING, &nurbsValue);
373 if (nurbsValue == N_CULLINGON) {
374 *value = GL_TRUE;
375 } else {
376 *value = GL_FALSE;
377 }
378 break;
380 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, value);
381 if(*value == N_PATHLENGTH)
383 else if(*value == N_PARAMETRICDISTANCE)
385 else if(*value == N_DOMAINDISTANCE)
387 else if(*value == N_OBJECTSPACE_PATH)
389 else if(*value == N_OBJECTSPACE_PARA)
391 break;
393 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, value);
394 break;
396 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, value);
397 break;
398
399 case GLU_U_STEP:
400 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, value);
401 break;
402 case GLU_V_STEP:
403 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_T_STEPS, value);
404 break;
405 case GLU_DISPLAY_MODE:
406 r->getnurbsproperty(N_DISPLAY, &nurbsValue);
407 if (nurbsValue == N_FILL) {
408 *value = GLU_FILL;
409 } else if (nurbsValue == N_OUTLINE_POLY) {
411 } else {
413 }
414 break;
415
416 case GLU_NURBS_MODE:
417 if(r->is_callback())
419 else
421 break;
422
423 default:
424 r->postError(GLU_INVALID_ENUM);
425 return;
426 }
427}
#define GLU_PATH_LENGTH
Definition: glu.h:187
#define GLU_INVALID_ENUM
Definition: glu.h:88
#define GLU_OUTLINE_PATCH
Definition: glu.h:97
#define GLU_AUTO_LOAD_MATRIX
Definition: glu.h:167
#define GLU_NURBS_RENDERER
Definition: glu.h:179
#define GLU_SAMPLING_TOLERANCE
Definition: glu.h:169
#define GLU_OBJECT_PARAMETRIC_ERROR
Definition: glu.h:183
#define GLU_OBJECT_PATH_LENGTH
Definition: glu.h:185
#define GLU_U_STEP
Definition: glu.h:173
#define GLU_DISPLAY_MODE
Definition: glu.h:170
#define GLU_DOMAIN_DISTANCE
Definition: glu.h:189
#define GLU_CULLING
Definition: glu.h:168
#define GLU_V_STEP
Definition: glu.h:174
#define GLU_NURBS_MODE
Definition: glu.h:175
#define GLU_OUTLINE_POLYGON
Definition: glu.h:96
#define GLU_PARAMETRIC_ERROR
Definition: glu.h:188
#define GLU_FILL
Definition: glu.h:198
#define GLU_PARAMETRIC_TOLERANCE
Definition: glu.h:171
#define GLU_NURBS_TESSELLATOR
Definition: glu.h:177
#define GLU_SAMPLING_METHOD
Definition: glu.h:172
#define GL_TRUE
Definition: gl.h:174
float GLfloat
Definition: gl.h:161
#define GL_MAP2_VERTEX_3
Definition: gl.h:567
#define GL_FALSE
Definition: gl.h:173
#define N_CULLINGON
Definition: nurbsconsts.h:53
#define N_DISPLAY
Definition: nurbsconsts.h:70
#define N_PATHLENGTH
Definition: nurbsconsts.h:59
#define N_OUTLINE_POLY
Definition: nurbsconsts.h:72
#define N_S_STEPS
Definition: nurbsconsts.h:99
#define N_OBJECTSPACE_PARA
Definition: nurbsconsts.h:61
#define N_T_STEPS
Definition: nurbsconsts.h:100
#define N_OBJECTSPACE_PATH
Definition: nurbsconsts.h:62
#define N_PIXEL_TOLERANCE
Definition: nurbsconsts.h:89
#define N_FILL
Definition: nurbsconsts.h:71
#define N_PARAMETRICDISTANCE
Definition: nurbsconsts.h:58
#define N_ERROR_TOLERANCE
Definition: nurbsconsts.h:90
#define N_SAMPLINGMETHOD
Definition: nurbsconsts.h:54
#define N_DOMAINDISTANCE
Definition: nurbsconsts.h:57
#define N_CULLING
Definition: nurbsconsts.h:51
Definition: pdh_main.c:94

◆ gluLoadSamplingMatrices()

void GLAPIENTRY gluLoadSamplingMatrices ( GLUnurbs r,
const GLfloat  modelMatrix[16],
const GLfloat  projMatrix[16],
const GLint  viewport[4] 
)

Definition at line 235 of file glinterface.cc.

238{
239 r->useGLMatrices(modelMatrix, projMatrix, viewport);
240}

◆ gluNewNurbsRenderer()

GLUnurbs *GLAPIENTRY gluNewNurbsRenderer ( void  )

Definition at line 66 of file glinterface.cc.

67{
68 GLUnurbs *t;
69
70 t = new GLUnurbs();
71 return t;
72}
GLdouble GLdouble t
Definition: gl.h:2047

◆ gluNurbsCallback()

void GLAPIENTRY gluNurbsCallback ( GLUnurbs r,
GLenum  which,
_GLUfuncptr  fn 
)

Definition at line 430 of file glinterface.cc.

431{
432 switch (which) {
433 case GLU_NURBS_BEGIN:
434 case GLU_NURBS_END:
435 case GLU_NURBS_VERTEX:
436 case GLU_NURBS_NORMAL:
438 case GLU_NURBS_COLOR:
445 r->putSurfCallBack(which, fn);
446 break;
447
448 case GLU_NURBS_ERROR:
449 r->errorCallback = (void (APIENTRY *)( GLenum e )) fn;
450 break;
451 default:
452 r->postError(GLU_INVALID_ENUM);
453 return;
454 }
455}
#define GLU_NURBS_END
Definition: glu.h:112
#define GLU_NURBS_ERROR
Definition: glu.h:100
#define GLU_NURBS_NORMAL
Definition: glu.h:106
#define GLU_NURBS_COLOR
Definition: glu.h:108
#define GLU_NURBS_TEXTURE_COORD
Definition: glu.h:110
#define GLU_NURBS_VERTEX_DATA
Definition: glu.h:116
#define GLU_NURBS_TEXTURE_COORD_DATA
Definition: glu.h:122
#define GLU_NURBS_VERTEX
Definition: glu.h:104
#define GLU_NURBS_COLOR_DATA
Definition: glu.h:120
#define GLU_NURBS_BEGIN_DATA
Definition: glu.h:114
#define GLU_NURBS_END_DATA
Definition: glu.h:124
#define GLU_NURBS_BEGIN
Definition: glu.h:102
#define GLU_NURBS_NORMAL_DATA
Definition: glu.h:118
#define APIENTRY
Definition: api.h:79
unsigned int GLenum
Definition: gl.h:150
#define e
Definition: ke_i.h:82
static GLenum which
Definition: wgl_font.c:159
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159

◆ gluNurbsCallbackData()

void GLAPIENTRY gluNurbsCallbackData ( GLUnurbs r,
void userData 
)

Definition at line 466 of file glinterface.cc.

467{
468 gluNurbsCallbackDataEXT(r,userData);
469}
#define gluNurbsCallbackDataEXT
Definition: glu_mangle.h:84

◆ gluNurbsCallbackDataEXT()

void GLAPIENTRY gluNurbsCallbackDataEXT ( GLUnurbs r,
void userData 
)

Definition at line 459 of file glinterface.cc.

460{
461 r->setNurbsCallbackData(userData);
462}

◆ gluNurbsCurve()

void GLAPIENTRY gluNurbsCurve ( GLUnurbs r,
GLint  nknots,
INREAL  knot[],
GLint  stride,
INREAL  ctlarray[],
GLint  order,
GLenum  type 
)

Definition at line 173 of file glinterface.cc.

175{
176#ifdef DOWN_LOAD_NURBS
177OTL_nurbsCurve(tempTrim, nknots, knot, stride, ctlarray, order, type);
178#endif
179
180 int realType;
181
182 switch(type) {
183 case GLU_MAP1_TRIM_2:
184 realType = N_P2D;
185 break;
186 case GLU_MAP1_TRIM_3:
187 realType = N_P2DR;
188 break;
189 default:
190 realType = type;
191 break;
192 }
193
194 r->nurbscurve(nknots, knot, sizeof(INREAL) * stride, ctlarray, order,
195 realType);
196}
#define GLU_MAP1_TRIM_3
Definition: glu.h:193
#define GLU_MAP1_TRIM_2
Definition: glu.h:192
#define INREAL
Definition: types.h:40
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizei stride
Definition: glext.h:5848
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
#define N_P2D
Definition: nurbsconsts.h:116
#define N_P2DR
Definition: nurbsconsts.h:117

◆ gluNurbsProperty()

void GLAPIENTRY gluNurbsProperty ( GLUnurbs r,
GLenum  property,
GLfloat  value 
)

Definition at line 243 of file glinterface.cc.

244{
245 GLfloat nurbsValue;
246
247 switch (property) {
249 r->setautoloadmode(value);
250 return;
251
252 case GLU_CULLING:
253 if (value != 0.0) {
254 nurbsValue = N_CULLINGON;
255 } else {
256 nurbsValue = N_NOCULLING;
257 }
258 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLING, nurbsValue);
259 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLING, nurbsValue);
260 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLING, nurbsValue);
261 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLING, nurbsValue);
262 return;
263
265 if (value == GLU_PATH_LENGTH) {
266 nurbsValue = N_PATHLENGTH;
267 } else if (value == GLU_PARAMETRIC_ERROR) {
268 nurbsValue = N_PARAMETRICDISTANCE;
269 } else if (value == GLU_DOMAIN_DISTANCE) {
270 nurbsValue = N_DOMAINDISTANCE;
271 r->set_is_domain_distance_sampling(1); //optimzing untrimmed case
272
273 } else if (value == GLU_OBJECT_PARAMETRIC_ERROR) {
274 nurbsValue = N_OBJECTSPACE_PARA;
275 r->setautoloadmode( 0.0 );
276 r->setSamplingMatrixIdentity();
277 } else if (value == GLU_OBJECT_PATH_LENGTH) {
278 nurbsValue = N_OBJECTSPACE_PATH;
279 r->setautoloadmode( 0.0 );
280 r->setSamplingMatrixIdentity();
281 } else {
282 r->postError(GLU_INVALID_VALUE);
283 return;
284 }
285
286 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, nurbsValue);
287 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMETHOD, nurbsValue);
288 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMETHOD, nurbsValue);
289 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMETHOD, nurbsValue);
290 return;
291
293 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, value);
294 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_PIXEL_TOLERANCE, value);
295 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_PIXEL_TOLERANCE, value);
296 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_PIXEL_TOLERANCE, value);
297 return;
298
300 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, value);
301 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_ERROR_TOLERANCE, value);
302 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_ERROR_TOLERANCE, value);
303 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_ERROR_TOLERANCE, value);
304 return;
305
306
307 case GLU_DISPLAY_MODE:
308
309 if (value == GLU_FILL) {
310 nurbsValue = N_FILL;
311 } else if (value == GLU_OUTLINE_POLYGON) {
312 nurbsValue = N_OUTLINE_POLY;
313 } else if (value == GLU_OUTLINE_PATCH) {
314 nurbsValue = N_OUTLINE_PATCH;
315 } else {
316 r->postError(GLU_INVALID_VALUE);
317 return;
318 }
319 r->setnurbsproperty(N_DISPLAY, nurbsValue);
320
321 break;
322
323 case GLU_U_STEP:
324 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_S_STEPS, value);
325 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_S_STEPS, value);
326 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, value);
327 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_S_STEPS, value);
328
329 //added for optimizing untrimmed case
330 r->set_domain_distance_u_rate(value);
331 break;
332
333 case GLU_V_STEP:
334 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_T_STEPS, value);
335 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_T_STEPS, value);
336 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_T_STEPS, value);
337 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_T_STEPS, value);
338
339 //added for optimizing untrimmed case
340 r->set_domain_distance_v_rate(value);
341 break;
342
343 case GLU_NURBS_MODE:
345 r->put_callbackFlag(0);
346 else if(value == GLU_NURBS_TESSELLATOR)
347 r->put_callbackFlag(1);
348 else
349 r->postError(GLU_INVALID_ENUM);
350 break;
351
352 default:
353 r->postError(GLU_INVALID_ENUM);
354 return;
355 }
356}
#define GLU_INVALID_VALUE
Definition: glu.h:89
#define GL_MAP1_VERTEX_3
Definition: gl.h:558
#define GL_MAP2_VERTEX_4
Definition: gl.h:568
#define GL_MAP1_VERTEX_4
Definition: gl.h:559
#define N_OUTLINE_PATCH
Definition: nurbsconsts.h:75
#define N_NOCULLING
Definition: nurbsconsts.h:52

◆ gluNurbsSurface()

void GLAPIENTRY gluNurbsSurface ( GLUnurbs r,
GLint  sknot_count,
GLfloat sknot,
GLint  tknot_count,
GLfloat tknot,
GLint  s_stride,
GLint  t_stride,
GLfloat ctlarray,
GLint  sorder,
GLint  torder,
GLenum  type 
)

Definition at line 199 of file glinterface.cc.

204{
205#ifdef DOWN_LOAD_NURBS
206 {
207 int dimension;
208 switch(type){
209 case GL_MAP2_VERTEX_3:
210 dimension = 3;
211 break;
212 case GL_MAP2_VERTEX_4:
213 dimension = 4;
214 break;
215 default:
216 fprintf(stderr, "error in glinterface.c++, type no implemented\n");
217 exit(1);
218 }
219tempNurb = nurbSurfMake(sknot_count, sknot,
220 tknot_count, tknot,
221 sorder, torder,
222 dimension,
223 ctlarray,
224 s_stride, t_stride);
225
226 }
227#endif
228
229 r->nurbssurface(sknot_count, sknot, tknot_count, tknot,
230 sizeof(INREAL) * s_stride, sizeof(INREAL) * t_stride,
231 ctlarray, sorder, torder, type);
232}
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
#define exit(n)
Definition: config.h:202

◆ gluPwlCurve()

void GLAPIENTRY gluPwlCurve ( GLUnurbs r,
GLint  count,
INREAL  array[],
GLint  stride,
GLenum  type 
)

Definition at line 150 of file glinterface.cc.

152{
153#ifdef DOWN_LOAD_NURBS
154OTL_pwlCurve(tempTrim, count, array, stride, type);
155#endif
156
157 int realType;
158 switch(type) {
159 case GLU_MAP1_TRIM_2:
160 realType = N_P2D;
161 break;
162 case GLU_MAP1_TRIM_3:
163 realType = N_P2DR;
164 break;
165 default:
166 realType = type;
167 break;
168 }
169 r->pwlcurve(count, array, sizeof(INREAL) * stride, realType);
170}
GLuint GLuint GLsizei count
Definition: gl.h:1545