2 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice including the dates of first publication and
13 * either this permission notice or a reference to
14 * http://oss.sgi.com/projects/FreeB/
15 * shall be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * Except as contained in this notice, the name of Silicon Graphics, Inc.
26 * shall not be used in advertising or otherwise to promote the sale, use or
27 * other dealings in this Software without prior written authorization from
28 * Silicon Graphics, Inc.
36 #ifndef __gluglcurveval_h_
37 #define __gluglcurveval_h_
42 #include "basiccrveval.h"
46 /*for internal evaluator callback stuff*/
47 #ifndef IN_MAX_BEZIER_ORDER
48 #define IN_MAX_BEZIER_ORDER 40 /*XXX should be bigger than machine order*/
51 #ifndef IN_MAX_DIMENSION
52 #define IN_MAX_DIMENSION 4
55 typedef struct curveEvalMachine
{
56 REAL uprime
; //cached previously evaluated uprime
57 int k
; //the dimension
62 REAL ctlpoints
[IN_MAX_BEZIER_ORDER
*IN_MAX_DIMENSION
];
63 REAL ucoeff
[IN_MAX_BEZIER_ORDER
];//cache the polynomial values
66 class OpenGLCurveEvaluator
: public BasicCurveEvaluator
{
68 OpenGLCurveEvaluator(void);
69 virtual ~OpenGLCurveEvaluator(void);
70 void range1f(long, REAL
*, REAL
*);
71 void domain1f(REAL
, REAL
);
72 void addMap(CurveMap
*);
77 void map1f(long, REAL
, REAL
, long, long, REAL
*);
78 void mapgrid1f(long, REAL
, REAL
);
79 void mapmesh1f(long, long, long);
80 void evalpoint1i(long);
81 void evalcoord1f(long, REAL
);
87 void put_vertices_call_back(int flag
)
89 output_triangles
= flag
;
92 void putCallBack(GLenum which
, void (GLAPIENTRY
*fn
)() );
94 void putCallBack(GLenum which
, _GLUfuncptr fn
);
96 void set_callback_userData(void *data
)
101 /*------------------begin for curveEvalMachine------------*/
102 curveEvalMachine em_vertex
;
103 curveEvalMachine em_normal
;
104 curveEvalMachine em_color
;
105 curveEvalMachine em_texcoord
;
106 int vertex_flag
; //whether there is a vertex map or not
107 int normal_flag
; //whether there is a normal map or not
108 int color_flag
; //whether there is a color map or not
109 int texcoord_flag
; //whether there is a texture map or not
115 void inMap1f(int which
, //0: vert, 1: norm, 2: color, 3: tex
123 void inPreEvaluate(int order
, REAL vprime
, REAL
*coeff
);
124 void inDoDomain1(curveEvalMachine
*em
, REAL u
, REAL
*retPoint
);
125 void inDoEvalCoord1(REAL u
);
126 void inMapMesh1f(int umin
, int umax
);
128 void (GLAPIENTRY
*beginCallBackN
) (GLenum type
);
129 void (GLAPIENTRY
*endCallBackN
) (void);
130 void (GLAPIENTRY
*vertexCallBackN
) (const GLfloat
*vert
);
131 void (GLAPIENTRY
*normalCallBackN
) (const GLfloat
*normal
);
132 void (GLAPIENTRY
*colorCallBackN
) (const GLfloat
*color
);
133 void (GLAPIENTRY
*texcoordCallBackN
) (const GLfloat
*texcoord
);
135 void (GLAPIENTRY
*beginCallBackData
) (GLenum type
, void* data
);
136 void (GLAPIENTRY
*endCallBackData
) (void* data
);
137 void (GLAPIENTRY
*vertexCallBackData
) (const GLfloat
*vert
, void* data
);
138 void (GLAPIENTRY
*normalCallBackData
) (const GLfloat
*normal
, void* data
);
139 void (GLAPIENTRY
*colorCallBackData
) (const GLfloat
*color
, void* data
);
140 void (GLAPIENTRY
*texcoordCallBackData
) (const GLfloat
*texcoord
, void* data
);
142 void* userData
; //the opaque pointer for Data callback functions
143 void beginCallBack(GLenum type
, void* data
);
144 void endCallBack(void* data
);
145 void vertexCallBack(const GLfloat
*vert
, void *data
);
146 void normalCallBack(const GLfloat
*normal
, void* data
);
147 void colorCallBack(const GLfloat
*color
, void* data
);
148 void texcoordCallBack(const GLfloat
*texcoord
, void* data
);
151 /*------------------end for curveEvalMachine------------*/
154 int output_triangles
; //true 1; false 0
157 #endif /* __gluglcurveval_h_ */