| 1 | /* $Id: glcurveval.h,v 1.2 2000-03-11 09:05:02 jeroen Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | ** License Applicability. Except to the extent portions of this file are
|
|---|
| 4 | ** made subject to an alternative license as permitted in the SGI Free
|
|---|
| 5 | ** Software License B, Version 1.0 (the "License"), the contents of this
|
|---|
| 6 | ** file are subject only to the provisions of the License. You may not use
|
|---|
| 7 | ** this file except in compliance with the License. You may obtain a copy
|
|---|
| 8 | ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
|---|
| 9 | ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
|---|
| 10 | **
|
|---|
| 11 | ** http://oss.sgi.com/projects/FreeB
|
|---|
| 12 | **
|
|---|
| 13 | ** Note that, as provided in the License, the Software is distributed on an
|
|---|
| 14 | ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
|---|
| 15 | ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
|---|
| 16 | ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
|---|
| 17 | ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|---|
| 18 | **
|
|---|
| 19 | ** Original Code. The Original Code is: OpenGL Sample Implementation,
|
|---|
| 20 | ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
|---|
| 21 | ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
|---|
| 22 | ** Copyright in any portions created by third parties is as indicated
|
|---|
| 23 | ** elsewhere herein. All Rights Reserved.
|
|---|
| 24 | **
|
|---|
| 25 | ** Additional Notice Provisions: The application programming interfaces
|
|---|
| 26 | ** established by SGI in conjunction with the Original Code are The
|
|---|
| 27 | ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
|---|
| 28 | ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
|---|
| 29 | ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
|---|
| 30 | ** Window System(R) (Version 1.3), released October 19, 1998. This software
|
|---|
| 31 | ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
|---|
| 32 | ** published by SGI, but has not been independently verified as being
|
|---|
| 33 | ** compliant with the OpenGL(R) version 1.2.1 Specification.
|
|---|
| 34 | */
|
|---|
| 35 |
|
|---|
| 36 | /*
|
|---|
| 37 | * glcurveval.h
|
|---|
| 38 | *
|
|---|
| 39 | * $Date: 2000-03-11 09:05:02 $ $Revision: 1.2 $
|
|---|
| 40 | * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/glcurveval.h,v 1.2 2000-03-11 09:05:02 jeroen Exp $
|
|---|
| 41 | */
|
|---|
| 42 |
|
|---|
| 43 | #ifndef __gluglcurveval_h_
|
|---|
| 44 | #define __gluglcurveval_h_
|
|---|
| 45 |
|
|---|
| 46 | #include "gluos.h"
|
|---|
| 47 | #include "gl.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, GLvoid (GLCALLBACK *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 (GLCALLBACK *beginCallBackN) (GLenum type);
|
|---|
| 131 | void (GLCALLBACK *endCallBackN) (void);
|
|---|
| 132 | void (GLCALLBACK *vertexCallBackN) (const GLfloat *vert);
|
|---|
| 133 | void (GLCALLBACK *normalCallBackN) (const GLfloat *normal);
|
|---|
| 134 | void (GLCALLBACK *colorCallBackN) (const GLfloat *color);
|
|---|
| 135 | void (GLCALLBACK *texcoordCallBackN) (const GLfloat *texcoord);
|
|---|
| 136 |
|
|---|
| 137 | void (GLCALLBACK *beginCallBackData) (GLenum type, void* data);
|
|---|
| 138 | void (GLCALLBACK *endCallBackData) (void* data);
|
|---|
| 139 | void (GLCALLBACK *vertexCallBackData) (const GLfloat *vert, void* data);
|
|---|
| 140 | void (GLCALLBACK *normalCallBackData) (const GLfloat *normal, void* data);
|
|---|
| 141 | void (GLCALLBACK *colorCallBackData) (const GLfloat *color, void* data);
|
|---|
| 142 | void (GLCALLBACK *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_ */
|
|---|