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:
10 ** http://oss.sgi.com/projects/FreeB
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.
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.
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.
40 #ifndef __gluglcurveval_h_
41 #define __gluglcurveval_h_
46 #include "basiccrveval.h"
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*/
55 #ifndef IN_MAX_DIMENSION
56 #define IN_MAX_DIMENSION 4
59 typedef struct curveEvalMachine
{
60 REAL uprime
; //cached previously evaluated uprime
61 int k
; //the dimension
66 REAL ctlpoints
[IN_MAX_BEZIER_ORDER
*IN_MAX_DIMENSION
];
67 REAL ucoeff
[IN_MAX_BEZIER_ORDER
];//cache the polynomial values
70 class OpenGLCurveEvaluator
: public BasicCurveEvaluator
{
72 OpenGLCurveEvaluator(void);
73 virtual ~OpenGLCurveEvaluator(void);
74 void range1f(long, REAL
*, REAL
*);
75 void domain1f(REAL
, REAL
);
76 void addMap(CurveMap
*);
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
);
91 void put_vertices_call_back(int flag
)
93 output_triangles
= flag
;
96 void putCallBack(GLenum which
, void (GLAPIENTRY
*fn
)() );
98 void putCallBack(GLenum which
, _GLUfuncptr fn
);
100 void set_callback_userData(void *data
)
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
119 void inMap1f(int which
, //0: vert, 1: norm, 2: color, 3: tex
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
);
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
);
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
);
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
);
155 /*------------------end for curveEvalMachine------------*/
158 int output_triangles
; //true 1; false 0
161 #endif /* __gluglcurveval_h_ */