4b44f6e847e242666174fe8cae06cf1964332661
[reactos.git] / reactos / dll / glu32 / libnurbs / interface / glcurveval.h
1 /*
2 ** License Applicability. Except to the extent portions of this file are
3 ** made subject to an alternative license as permitted in the SGI Free
4 ** Software License B, Version 1.1 (the "License"), the contents of this
5 ** file are subject only to the provisions of the License. You may not use
6 ** this file except in compliance with the License. You may obtain a copy
7 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
8 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
9 **
10 ** http://oss.sgi.com/projects/FreeB
11 **
12 ** Note that, as provided in the License, the Software is distributed on an
13 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
14 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
15 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
16 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
17 **
18 ** Original Code. The Original Code is: OpenGL Sample Implementation,
19 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
20 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
21 ** Copyright in any portions created by third parties is as indicated
22 ** elsewhere herein. All Rights Reserved.
23 **
24 ** Additional Notice Provisions: The application programming interfaces
25 ** established by SGI in conjunction with the Original Code are The
26 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
27 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
28 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
29 ** Window System(R) (Version 1.3), released October 19, 1998. This software
30 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
31 ** published by SGI, but has not been independently verified as being
32 ** compliant with the OpenGL(R) version 1.2.1 Specification.
33 */
34
35 /*
36 * glcurveval.h
37 *
38 */
39
40 #ifndef __gluglcurveval_h_
41 #define __gluglcurveval_h_
42
43 #include "gluos.h"
44 #include <GL/gl.h>
45 #include <GL/glu.h>
46 #include "basiccrveval.h"
47
48 class CurveMap;
49
50 /*for internal evaluator callback stuff*/
51 #ifndef IN_MAX_BEZIER_ORDER
52 #define IN_MAX_BEZIER_ORDER 40 /*XXX should be bigger than machine order*/
53 #endif
54
55 #ifndef IN_MAX_DIMENSION
56 #define IN_MAX_DIMENSION 4
57 #endif
58
59 typedef struct curveEvalMachine{
60 REAL uprime; //cached previously evaluated uprime
61 int k; //the dimension
62 REAL u1;
63 REAL u2;
64 int ustride;
65 int uorder;
66 REAL ctlpoints[IN_MAX_BEZIER_ORDER*IN_MAX_DIMENSION];
67 REAL ucoeff[IN_MAX_BEZIER_ORDER];//cache the polynomial values
68 } curveEvalMachine;
69
70 class OpenGLCurveEvaluator : public BasicCurveEvaluator {
71 public:
72 OpenGLCurveEvaluator(void);
73 virtual ~OpenGLCurveEvaluator(void);
74 void range1f(long, REAL *, REAL *);
75 void domain1f(REAL, REAL);
76 void addMap(CurveMap *);
77
78 void enable(long);
79 void disable(long);
80 void bgnmap1f(long);
81 void map1f(long, REAL, REAL, long, long, REAL *);
82 void mapgrid1f(long, REAL, REAL);
83 void mapmesh1f(long, long, long);
84 void evalpoint1i(long);
85 void evalcoord1f(long, REAL);
86 void endmap1f(void);
87
88 void bgnline(void);
89 void endline(void);
90
91 void put_vertices_call_back(int flag)
92 {
93 output_triangles = flag;
94 }
95 #ifdef _WIN32
96 void putCallBack(GLenum which, void (APIENTRY *fn)() );
97 #else
98 void putCallBack(GLenum which, _GLUfuncptr fn );
99 #endif
100 void set_callback_userData(void *data)
101 {
102 userData = data;
103 }
104
105 /*------------------begin for curveEvalMachine------------*/
106 curveEvalMachine em_vertex;
107 curveEvalMachine em_normal;
108 curveEvalMachine em_color;
109 curveEvalMachine em_texcoord;
110 int vertex_flag; //whether there is a vertex map or not
111 int normal_flag; //whether there is a normal map or not
112 int color_flag; //whether there is a color map or not
113 int texcoord_flag; //whether there is a texture map or not
114
115 REAL global_grid_u0;
116 REAL global_grid_u1;
117 int global_grid_nu;
118
119 void inMap1f(int which, //0: vert, 1: norm, 2: color, 3: tex
120 int dimension,
121 REAL ulower,
122 REAL uupper,
123 int ustride,
124 int uorder,
125 REAL *ctlpoints);
126
127 void inPreEvaluate(int order, REAL vprime, REAL *coeff);
128 void inDoDomain1(curveEvalMachine *em, REAL u, REAL *retPoint);
129 void inDoEvalCoord1(REAL u);
130 void inMapMesh1f(int umin, int umax);
131
132 void (GLAPIENTRY *beginCallBackN) (GLenum type);
133 void (GLAPIENTRY *endCallBackN) (void);
134 void (GLAPIENTRY *vertexCallBackN) (const GLfloat *vert);
135 void (GLAPIENTRY *normalCallBackN) (const GLfloat *normal);
136 void (GLAPIENTRY *colorCallBackN) (const GLfloat *color);
137 void (GLAPIENTRY *texcoordCallBackN) (const GLfloat *texcoord);
138
139 void (GLAPIENTRY *beginCallBackData) (GLenum type, void* data);
140 void (GLAPIENTRY *endCallBackData) (void* data);
141 void (GLAPIENTRY *vertexCallBackData) (const GLfloat *vert, void* data);
142 void (GLAPIENTRY *normalCallBackData) (const GLfloat *normal, void* data);
143 void (GLAPIENTRY *colorCallBackData) (const GLfloat *color, void* data);
144 void (GLAPIENTRY *texcoordCallBackData) (const GLfloat *texcoord, void* data);
145
146 void* userData; //the opaque pointer for Data callback functions
147 void beginCallBack(GLenum type, void* data);
148 void endCallBack(void* data);
149 void vertexCallBack(const GLfloat *vert, void *data);
150 void normalCallBack(const GLfloat *normal, void* data);
151 void colorCallBack(const GLfloat *color, void* data);
152 void texcoordCallBack(const GLfloat *texcoord, void* data);
153
154
155 /*------------------end for curveEvalMachine------------*/
156
157 private:
158 int output_triangles; //true 1; false 0
159 };
160
161 #endif /* __gluglcurveval_h_ */