include glu.h
[mesa.git] / src / glu / sgi / 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 * $Date: 2001/07/17 15:39:13 $ $Revision: 1.3 $
39 * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.h,v 1.3 2001/07/17 15:39:13 brianp Exp $
40 */
41
42 #ifndef __gluglcurveval_h_
43 #define __gluglcurveval_h_
44
45 #include "gluos.h"
46 #include "GL/gl.h"
47 #include "GL/glu.h"
48 #include "basiccrveval.h"
49
50 class CurveMap;
51
52 /*for internal evaluator callback stuff*/
53 #ifndef IN_MAX_BEZIER_ORDER
54 #define IN_MAX_BEZIER_ORDER 40 /*XXX should be bigger than machine order*/
55 #endif
56
57 #ifndef IN_MAX_DIMENSION
58 #define IN_MAX_DIMENSION 4
59 #endif
60
61 typedef struct curveEvalMachine{
62 REAL uprime; //cached previously evaluated uprime
63 int k; //the dimension
64 REAL u1;
65 REAL u2;
66 int ustride;
67 int uorder;
68 REAL ctlpoints[IN_MAX_BEZIER_ORDER*IN_MAX_DIMENSION];
69 REAL ucoeff[IN_MAX_BEZIER_ORDER];//cache the polynomial values
70 } curveEvalMachine;
71
72 class OpenGLCurveEvaluator : public BasicCurveEvaluator {
73 public:
74 OpenGLCurveEvaluator(void);
75 ~OpenGLCurveEvaluator(void);
76 void range1f(long, REAL *, REAL *);
77 void domain1f(REAL, REAL);
78 void addMap(CurveMap *);
79
80 void enable(long);
81 void disable(long);
82 void bgnmap1f(long);
83 void map1f(long, REAL, REAL, long, long, REAL *);
84 void mapgrid1f(long, REAL, REAL);
85 void mapmesh1f(long, long, long);
86 void evalpoint1i(long);
87 void evalcoord1f(long, REAL);
88 void endmap1f(void);
89
90 void bgnline(void);
91 void endline(void);
92
93 void put_vertices_call_back(int flag)
94 {
95 output_triangles = flag;
96 }
97 void putCallBack(GLenum which, _GLUfuncptr fn );
98 void set_callback_userData(void *data)
99 {
100 userData = data;
101 }
102
103 /*------------------begin for curveEvalMachine------------*/
104 curveEvalMachine em_vertex;
105 curveEvalMachine em_normal;
106 curveEvalMachine em_color;
107 curveEvalMachine em_texcoord;
108 int vertex_flag; //whether there is a vertex map or not
109 int normal_flag; //whether there is a normal map or not
110 int color_flag; //whether there is a color map or not
111 int texcoord_flag; //whether there is a texture map or not
112
113 int global_grid_u0;
114 int global_grid_u1;
115 int global_grid_nu;
116
117 void inMap1f(int which, //0: vert, 1: norm, 2: color, 3: tex
118 int dimension,
119 REAL ulower,
120 REAL uupper,
121 int ustride,
122 int uorder,
123 REAL *ctlpoints);
124
125 void inPreEvaluate(int order, REAL vprime, REAL *coeff);
126 void inDoDomain1(curveEvalMachine *em, REAL u, REAL *retPoint);
127 void inDoEvalCoord1(REAL u);
128 void inMapMesh1f(int umin, int umax);
129
130 void (GLAPIENTRY *beginCallBackN) (GLenum type);
131 void (GLAPIENTRY *endCallBackN) (void);
132 void (GLAPIENTRY *vertexCallBackN) (const GLfloat *vert);
133 void (GLAPIENTRY *normalCallBackN) (const GLfloat *normal);
134 void (GLAPIENTRY *colorCallBackN) (const GLfloat *color);
135 void (GLAPIENTRY *texcoordCallBackN) (const GLfloat *texcoord);
136
137 void (GLAPIENTRY *beginCallBackData) (GLenum type, void* data);
138 void (GLAPIENTRY *endCallBackData) (void* data);
139 void (GLAPIENTRY *vertexCallBackData) (const GLfloat *vert, void* data);
140 void (GLAPIENTRY *normalCallBackData) (const GLfloat *normal, void* data);
141 void (GLAPIENTRY *colorCallBackData) (const GLfloat *color, void* data);
142 void (GLAPIENTRY *texcoordCallBackData) (const GLfloat *texcoord, void* data);
143
144 void* userData; //the opaque pointer for Data callback functions
145 void beginCallBack(GLenum type, void* data);
146 void endCallBack(void* data);
147 void vertexCallBack(const GLfloat *vert, void *data);
148 void normalCallBack(const GLfloat *normal, void* data);
149 void colorCallBack(const GLfloat *color, void* data);
150 void texcoordCallBack(const GLfloat *texcoord, void* data);
151
152
153 /*------------------end for curveEvalMachine------------*/
154
155 private:
156 int output_triangles; //true 1; false 0
157 };
158
159 #endif /* __gluglcurveval_h_ */