- Timestamp:
- Mar 11, 2000, 10:05:07 AM (26 years ago)
- Location:
- trunk/src/opengl
- Files:
-
- 18 edited
-
glu/nurbs/interface/glcurveval.cpp (modified) (9 diffs)
-
glu/nurbs/interface/glcurveval.h (modified) (5 diffs)
-
glu/nurbs/interface/glinterface.cpp (modified) (12 diffs)
-
glu/nurbs/interface/glrenderer.h (modified) (5 diffs)
-
glu/nurbs/interface/glsurfeval.cpp (modified) (5 diffs)
-
glu/nurbs/interface/glsurfeval.h (modified) (14 diffs)
-
glu/nurbs/interface/insurfeval.cpp (modified) (21 diffs)
-
glu/nurbs/internals/slicer.cpp (modified) (42 diffs)
-
glu/tess/tess.c (modified) (28 diffs)
-
glu/tess/tess.h (modified) (4 diffs)
-
glu/util/quad.c (modified) (24 diffs)
-
glut/glut_event.c (modified) (6 diffs)
-
glut/glut_term.c (modified) (2 diffs)
-
glut/glut_win.c (modified) (4 diffs)
-
glut/glutint.h (modified) (4 diffs)
-
glut/win32_menu.c (modified) (2 diffs)
-
mesa/GL/glu.h (modified) (9 diffs)
-
mesa/api1.c (modified) (42 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/opengl/glu/nurbs/interface/glcurveval.cpp
r2689 r3079 1 /* $Id: glcurveval.cpp,v 1. 1 2000-02-09 08:49:00jeroen Exp $ */1 /* $Id: glcurveval.cpp,v 1.2 2000-03-11 09:05:01 jeroen Exp $ */ 2 2 /* 3 3 ** License Applicability. Except to the extent portions of this file are … … 37 37 * glcurveval.c++ 38 38 * 39 * $Date: 2000-0 2-09 08:49:00 $ $Revision: 1.1$40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/glcurveval.cpp,v 1. 1 2000-02-09 08:49:00jeroen Exp $39 * $Date: 2000-03-11 09:05:01 $ $Revision: 1.2 $ 40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/glcurveval.cpp,v 1.2 2000-03-11 09:05:01 jeroen Exp $ 41 41 */ 42 42 … … 88 88 OpenGLCurveEvaluator::addMap(CurveMap *m) 89 89 { 90 m = m;90 m = m; 91 91 } 92 92 … … 94 94 OpenGLCurveEvaluator::range1f(long type, REAL *from, REAL *to) 95 95 { 96 type = type;97 from = from;98 to = to;96 type = type; 97 from = from; 98 to = to; 99 99 } 100 100 … … 102 102 OpenGLCurveEvaluator::domain1f(REAL ulo, REAL uhi) 103 103 { 104 ulo = ulo;105 uhi = uhi;104 ulo = ulo; 105 uhi = uhi; 106 106 } 107 107 … … 202 202 void 203 203 OpenGLCurveEvaluator::map1f( 204 long type, /* map type */205 REAL ulo, /* lower parametric bound */206 REAL uhi, /* upper parametric bound */207 long stride, /* distance to next point in REALS */208 long order, /* parametric order */209 REAL *pts /* control points */204 long type, /* map type */ 205 REAL ulo, /* lower parametric bound */ 206 REAL uhi, /* upper parametric bound */ 207 long stride, /* distance to next point in REALS */ 208 long order, /* parametric order */ 209 REAL *pts /* control points */ 210 210 ) 211 211 { … … 216 216 switch(type){ 217 217 case GL_MAP1_VERTEX_3: 218 which = 0;219 dimension = 3;220 break;218 which = 0; 219 dimension = 3; 220 break; 221 221 case GL_MAP1_VERTEX_4: 222 which=0;223 dimension = 4;224 break;222 which=0; 223 dimension = 4; 224 break; 225 225 case GL_MAP1_INDEX: 226 which=2;227 dimension = 1;228 break;226 which=2; 227 dimension = 1; 228 break; 229 229 case GL_MAP1_COLOR_4: 230 which=2;231 dimension = 4;232 break;230 which=2; 231 dimension = 4; 232 break; 233 233 case GL_MAP1_NORMAL: 234 which=1;235 dimension = 3;236 break;234 which=1; 235 dimension = 3; 236 break; 237 237 case GL_MAP1_TEXTURE_COORD_1: 238 which=3;239 dimension = 1;240 break;238 which=3; 239 dimension = 1; 240 break; 241 241 case GL_MAP1_TEXTURE_COORD_2: 242 which=3;243 dimension = 2;244 break;245 242 which=3; 243 dimension = 2; 244 break; 245 246 246 case GL_MAP1_TEXTURE_COORD_3: 247 which=3;248 dimension = 3;249 break;247 which=3; 248 dimension = 3; 249 break; 250 250 case GL_MAP1_TEXTURE_COORD_4: 251 which=3;252 dimension = 4;253 break; 251 which=3; 252 dimension = 4; 253 break; 254 254 } 255 inMap1f(which, dimension, ulo, uhi, stride, order, pts); 255 inMap1f(which, dimension, ulo, uhi, stride, order, pts); 256 256 } 257 257 else 258 258 glMap1f((GLenum) type, (GLfloat) ulo, (GLfloat) uhi, (GLint) stride, 259 (GLint) order, (const GLfloat *) pts);259 (GLint) order, (const GLfloat *) pts); 260 260 } 261 261 … … 276 276 case N_MESHFILL: 277 277 case N_MESHLINE: 278 glEvalMesh1((GLenum) GL_LINE, (GLint) from, (GLint) to);279 break;278 glEvalMesh1((GLenum) GL_LINE, (GLint) from, (GLint) to); 279 break; 280 280 case N_MESHPOINT: 281 glEvalMesh1((GLenum) GL_POINT, (GLint) from, (GLint) to);282 break;281 glEvalMesh1((GLenum) GL_POINT, (GLint) from, (GLint) to); 282 break; 283 283 } 284 284 } … … 304 304 305 305 void 306 OpenGLCurveEvaluator::putCallBack(GLenum which, GLvoid (GL API*fn)(...))306 OpenGLCurveEvaluator::putCallBack(GLenum which, GLvoid (GLCALLBACK *fn)(...)) 307 307 { 308 308 switch(which) 309 309 { 310 310 case GLU_NURBS_BEGIN: 311 beginCallBackN = (void (GL API*) (GLenum)) fn;311 beginCallBackN = (void (GLCALLBACK *) (GLenum)) fn; 312 312 break; 313 313 case GLU_NURBS_END: 314 endCallBackN = (void (GL API*) (void)) fn;314 endCallBackN = (void (GLCALLBACK *) (void)) fn; 315 315 break; 316 316 case GLU_NURBS_VERTEX: 317 vertexCallBackN = (void (GL API*) (const GLfloat*)) fn;317 vertexCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn; 318 318 break; 319 319 case GLU_NURBS_NORMAL: 320 normalCallBackN = (void (GL API*) (const GLfloat*)) fn;320 normalCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn; 321 321 break; 322 322 case GLU_NURBS_COLOR: 323 colorCallBackN = (void (GL API*) (const GLfloat*)) fn;323 colorCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn; 324 324 break; 325 325 case GLU_NURBS_TEXTURE_COORD: 326 texcoordCallBackN = (void (GL API*) (const GLfloat*)) fn;326 texcoordCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn; 327 327 break; 328 328 case GLU_NURBS_BEGIN_DATA: 329 beginCallBackData = (void (GL API*) (GLenum, void*)) fn;329 beginCallBackData = (void (GLCALLBACK *) (GLenum, void*)) fn; 330 330 break; 331 331 case GLU_NURBS_END_DATA: 332 endCallBackData = (void (GL API*) (void*)) fn;332 endCallBackData = (void (GLCALLBACK *) (void*)) fn; 333 333 break; 334 334 case GLU_NURBS_VERTEX_DATA: 335 vertexCallBackData = (void (GL API*) (const GLfloat*, void*)) fn;335 vertexCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn; 336 336 break; 337 337 case GLU_NURBS_NORMAL_DATA: 338 normalCallBackData = (void (GL API*) (const GLfloat*, void*)) fn;338 normalCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn; 339 339 break; 340 340 case GLU_NURBS_COLOR_DATA: 341 colorCallBackData = (void (GL API*) (const GLfloat*, void*)) fn;341 colorCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn; 342 342 break; 343 343 case GLU_NURBS_TEXTURE_COORD_DATA: 344 texcoordCallBackData = (void (GL API*) (const GLfloat*, void*)) fn;344 texcoordCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn; 345 345 break; 346 346 } -
trunk/src/opengl/glu/nurbs/interface/glcurveval.h
r2689 r3079 1 /* $Id: glcurveval.h,v 1. 1 2000-02-09 08:49:01jeroen Exp $ */1 /* $Id: glcurveval.h,v 1.2 2000-03-11 09:05:02 jeroen Exp $ */ 2 2 /* 3 3 ** License Applicability. Except to the extent portions of this file are … … 37 37 * glcurveval.h 38 38 * 39 * $Date: 2000-0 2-09 08:49:01 $ $Revision: 1.1$40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/glcurveval.h,v 1. 1 2000-02-09 08:49:01jeroen Exp $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 41 */ 42 42 … … 72 72 class OpenGLCurveEvaluator : public BasicCurveEvaluator { 73 73 public: 74 OpenGLCurveEvaluator(void);75 ~OpenGLCurveEvaluator(void);76 void range1f(long, REAL *, REAL *);77 void domain1f(REAL, REAL);78 void addMap(CurveMap *);74 OpenGLCurveEvaluator(void); 75 ~OpenGLCurveEvaluator(void); 76 void range1f(long, REAL *, REAL *); 77 void domain1f(REAL, REAL); 78 void addMap(CurveMap *); 79 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);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 89 90 void bgnline(void);91 void endline(void);90 void bgnline(void); 91 void endline(void); 92 92 93 93 void put_vertices_call_back(int flag) 94 94 { 95 output_triangles = flag;95 output_triangles = flag; 96 96 } 97 void putCallBack(GLenum which, GLvoid (GL API*fn)(...));97 void putCallBack(GLenum which, GLvoid (GLCALLBACK *fn)(...)); 98 98 void set_callback_userData(void *data) 99 99 { 100 userData = data;100 userData = data; 101 101 } 102 102 … … 116 116 117 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);118 int dimension, 119 REAL ulower, 120 REAL uupper, 121 int ustride, 122 int uorder, 123 REAL *ctlpoints); 124 124 125 125 void inPreEvaluate(int order, REAL vprime, REAL *coeff); … … 128 128 void inMapMesh1f(int umin, int umax); 129 129 130 void (GL API*beginCallBackN) (GLenum type);131 void (GL API*endCallBackN) (void);132 void (GL API*vertexCallBackN) (const GLfloat *vert);133 void (GL API*normalCallBackN) (const GLfloat *normal);134 void (GL API*colorCallBackN) (const GLfloat *color);135 void (GL API*texcoordCallBackN) (const GLfloat *texcoord);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 136 137 void (GL API*beginCallBackData) (GLenum type, void* data);138 void (GL API*endCallBackData) (void* data);139 void (GL API*vertexCallBackData) (const GLfloat *vert, void* data);140 void (GL API*normalCallBackData) (const GLfloat *normal, void* data);141 void (GL API*colorCallBackData) (const GLfloat *color, void* data);142 void (GL API*texcoordCallBackData) (const GLfloat *texcoord, void* data);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 143 144 void* userData; //the opaque pointer for Data callback functions145 void beginCallBack(GLenum type, void* data);144 void* userData; /* the opaque pointer for Data callback functions*/ 145 void beginCallBack(GLenum type, void* data); 146 146 void endCallBack(void* data); 147 147 void vertexCallBack(const GLfloat *vert, void *data); -
trunk/src/opengl/glu/nurbs/interface/glinterface.cpp
r2945 r3079 1 /* $Id: glinterface.cpp,v 1. 2 2000-02-29 13:56:48 sandervlExp $ */1 /* $Id: glinterface.cpp,v 1.3 2000-03-11 09:05:02 jeroen Exp $ */ 2 2 /* 3 3 ** License Applicability. Except to the extent portions of this file are … … 33 33 ** compliant with the OpenGL(R) version 1.2.1 Specification. 34 34 ** 35 ** $Date: 2000-0 2-29 13:56:48 $ $Revision: 1.2$35 ** $Date: 2000-03-11 09:05:02 $ $Revision: 1.3 $ 36 36 */ 37 37 /* 38 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/glinterface.cpp,v 1. 2 2000-02-29 13:56:48 sandervlExp $38 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/glinterface.cpp,v 1.3 2000-03-11 09:05:02 jeroen Exp $ 39 39 */ 40 40 … … 63 63 void glu_LOD_eval_list(GLUnurbs *nurb, int level) 64 64 { 65 nurb->LOD_eval_list(level);65 nurb->LOD_eval_list(level); 66 66 } 67 67 … … 152 152 void GLAPI 153 153 gluPwlCurve(GLUnurbs *r, GLint count, INREAL array[], 154 GLint stride, GLenum type)154 GLint stride, GLenum type) 155 155 { 156 156 #ifdef DOWN_LOAD_NURBS … … 161 161 switch(type) { 162 162 case GLU_MAP1_TRIM_2: 163 realType = N_P2D;164 break;163 realType = N_P2D; 164 break; 165 165 case GLU_MAP1_TRIM_3: 166 realType = N_P2DR;167 break;166 realType = N_P2DR; 167 break; 168 168 default: 169 realType = type;170 break;169 realType = type; 170 break; 171 171 } 172 172 r->pwlcurve(count, array, sizeof(INREAL) * stride, realType); … … 175 175 void GLAPI 176 176 gluNurbsCurve(GLUnurbs *r, GLint nknots, INREAL knot[], GLint stride, 177 INREAL ctlarray[], GLint order, GLenum type)177 INREAL ctlarray[], GLint order, GLenum type) 178 178 { 179 179 #ifdef DOWN_LOAD_NURBS … … 185 185 switch(type) { 186 186 case GLU_MAP1_TRIM_2: 187 realType = N_P2D;188 break;187 realType = N_P2D; 188 break; 189 189 case GLU_MAP1_TRIM_3: 190 realType = N_P2DR;191 break;190 realType = N_P2DR; 191 break; 192 192 default: 193 realType = type;194 break;193 realType = type; 194 break; 195 195 } 196 196 197 197 r->nurbscurve(nknots, knot, sizeof(INREAL) * stride, ctlarray, order, 198 realType);198 realType); 199 199 } 200 200 201 201 void GLAPI 202 202 gluNurbsSurface(GLUnurbs *r, GLint sknot_count, GLfloat *sknot, 203 GLint tknot_count, GLfloat *tknot,204 GLint s_stride, GLint t_stride,205 GLfloat *ctlarray, GLint sorder, GLint torder,206 GLenum type)203 GLint tknot_count, GLfloat *tknot, 204 GLint s_stride, GLint t_stride, 205 GLfloat *ctlarray, GLint sorder, GLint torder, 206 GLenum type) 207 207 { 208 208 #ifdef DOWN_LOAD_NURBS … … 221 221 } 222 222 tempNurb = nurbSurfMake(sknot_count, sknot, 223 tknot_count, tknot,224 sorder, torder,225 dimension,226 ctlarray,227 s_stride, t_stride);228 223 tknot_count, tknot, 224 sorder, torder, 225 dimension, 226 ctlarray, 227 s_stride, t_stride); 228 229 229 } 230 230 #endif 231 231 232 232 r->nurbssurface(sknot_count, sknot, tknot_count, tknot, 233 sizeof(INREAL) * s_stride, sizeof(INREAL) * t_stride,234 ctlarray, sorder, torder, type);233 sizeof(INREAL) * s_stride, sizeof(INREAL) * t_stride, 234 ctlarray, sorder, torder, type); 235 235 } 236 236 237 237 void GLAPI 238 238 gluLoadSamplingMatrices(GLUnurbs *r, const GLfloat modelMatrix[16], 239 const GLfloat projMatrix[16],240 const GLint viewport[4])239 const GLfloat projMatrix[16], 240 const GLint viewport[4]) 241 241 { 242 242 r->useGLMatrices(modelMatrix, projMatrix, viewport); … … 251 251 case GLU_AUTO_LOAD_MATRIX: 252 252 r->setautoloadmode(value); 253 return;253 return; 254 254 255 255 case GLU_CULLING: 256 if (value != 0.0) {257 nurbsValue = N_CULLINGON;258 } else {259 nurbsValue = N_NOCULLING;260 }261 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLING, nurbsValue);262 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLING, nurbsValue);263 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLING, nurbsValue);264 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLING, nurbsValue);256 if (value != 0.0) { 257 nurbsValue = N_CULLINGON; 258 } else { 259 nurbsValue = N_NOCULLING; 260 } 261 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLING, nurbsValue); 262 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLING, nurbsValue); 263 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLING, nurbsValue); 264 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLING, nurbsValue); 265 265 return; 266 266 267 267 case GLU_SAMPLING_METHOD: 268 if (value == GLU_PATH_LENGTH) {269 nurbsValue = N_PATHLENGTH;270 } else if (value == GLU_PARAMETRIC_ERROR) {271 nurbsValue = N_PARAMETRICDISTANCE;272 } else if (value == GLU_DOMAIN_DISTANCE) {273 nurbsValue = N_DOMAINDISTANCE;268 if (value == GLU_PATH_LENGTH) { 269 nurbsValue = N_PATHLENGTH; 270 } else if (value == GLU_PARAMETRIC_ERROR) { 271 nurbsValue = N_PARAMETRICDISTANCE; 272 } else if (value == GLU_DOMAIN_DISTANCE) { 273 nurbsValue = N_DOMAINDISTANCE; 274 274 r->set_is_domain_distance_sampling(1); //optimzing untrimmed case 275 275 276 } else if (value == GLU_OBJECT_PARAMETRIC_ERROR) {277 nurbsValue = N_OBJECTSPACE_PARA;278 r->setautoloadmode( 0.0 );279 r->setSamplingMatrixIdentity();280 } else if (value == GLU_OBJECT_PATH_LENGTH) {281 nurbsValue = N_OBJECTSPACE_PATH;282 r->setautoloadmode( 0.0 );283 r->setSamplingMatrixIdentity();284 } else {276 } else if (value == GLU_OBJECT_PARAMETRIC_ERROR) { 277 nurbsValue = N_OBJECTSPACE_PARA; 278 r->setautoloadmode( 0.0 ); 279 r->setSamplingMatrixIdentity(); 280 } else if (value == GLU_OBJECT_PATH_LENGTH) { 281 nurbsValue = N_OBJECTSPACE_PATH; 282 r->setautoloadmode( 0.0 ); 283 r->setSamplingMatrixIdentity(); 284 } else { 285 285 r->postError(GLU_INVALID_VALUE); 286 286 return; 287 287 } 288 288 289 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, nurbsValue);290 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMETHOD, nurbsValue);291 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMETHOD, nurbsValue);292 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMETHOD, nurbsValue);293 return;289 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, nurbsValue); 290 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMETHOD, nurbsValue); 291 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMETHOD, nurbsValue); 292 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMETHOD, nurbsValue); 293 return; 294 294 295 295 case GLU_SAMPLING_TOLERANCE: 296 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, value);297 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_PIXEL_TOLERANCE, value);298 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_PIXEL_TOLERANCE, value);299 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_PIXEL_TOLERANCE, value);300 return;296 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, value); 297 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_PIXEL_TOLERANCE, value); 298 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_PIXEL_TOLERANCE, value); 299 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_PIXEL_TOLERANCE, value); 300 return; 301 301 302 302 case GLU_PARAMETRIC_TOLERANCE: 303 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, value);303 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, value); 304 304 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_ERROR_TOLERANCE, value); 305 305 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_ERROR_TOLERANCE, value); 306 306 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_ERROR_TOLERANCE, value); 307 307 return; 308 308 309 309 310 310 case GLU_DISPLAY_MODE: 311 312 if (value == GLU_FILL) {313 nurbsValue = N_FILL;314 } else if (value == GLU_OUTLINE_POLYGON) {315 nurbsValue = N_OUTLINE_POLY;316 } else if (value == GLU_OUTLINE_PATCH) {317 nurbsValue = N_OUTLINE_PATCH;318 } else {319 r->postError(GLU_INVALID_VALUE);320 return;321 }322 r->setnurbsproperty(N_DISPLAY, nurbsValue);323 324 break;311 312 if (value == GLU_FILL) { 313 nurbsValue = N_FILL; 314 } else if (value == GLU_OUTLINE_POLYGON) { 315 nurbsValue = N_OUTLINE_POLY; 316 } else if (value == GLU_OUTLINE_PATCH) { 317 nurbsValue = N_OUTLINE_PATCH; 318 } else { 319 r->postError(GLU_INVALID_VALUE); 320 return; 321 } 322 r->setnurbsproperty(N_DISPLAY, nurbsValue); 323 324 break; 325 325 326 326 case GLU_U_STEP: 327 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_S_STEPS, value);328 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_S_STEPS, value);329 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, value);330 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_S_STEPS, value);331 332 //added for optimizing untrimmed case327 r->setnurbsproperty(GL_MAP1_VERTEX_3, N_S_STEPS, value); 328 r->setnurbsproperty(GL_MAP1_VERTEX_4, N_S_STEPS, value); 329 r->setnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, value); 330 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_S_STEPS, value); 331 332 //added for optimizing untrimmed case 333 333 r->set_domain_distance_u_rate(value); 334 break;334 break; 335 335 336 336 case GLU_V_STEP: … … 340 340 r->setnurbsproperty(GL_MAP2_VERTEX_4, N_T_STEPS, value); 341 341 342 //added for optimizing untrimmed case342 //added for optimizing untrimmed case 343 343 r->set_domain_distance_v_rate(value); 344 break;345 344 break; 345 346 346 case GLU_NURBS_MODE: 347 if(value == GLU_NURBS_RENDERER)348 r->put_callbackFlag(0);349 else if(value == GLU_NURBS_TESSELLATOR)350 r->put_callbackFlag(1);351 else352 r->postError(GLU_INVALID_ENUM);353 break;347 if(value == GLU_NURBS_RENDERER) 348 r->put_callbackFlag(0); 349 else if(value == GLU_NURBS_TESSELLATOR) 350 r->put_callbackFlag(1); 351 else 352 r->postError(GLU_INVALID_ENUM); 353 break; 354 354 355 355 default: 356 r->postError(GLU_INVALID_ENUM);357 return; 356 r->postError(GLU_INVALID_ENUM); 357 return; 358 358 } 359 359 } … … 366 366 switch(property) { 367 367 case GLU_AUTO_LOAD_MATRIX: 368 if (r->getautoloadmode()) {369 *value = GL_TRUE;370 } else {371 *value = GL_FALSE;372 }373 break;368 if (r->getautoloadmode()) { 369 *value = GL_TRUE; 370 } else { 371 *value = GL_FALSE; 372 } 373 break; 374 374 case GLU_CULLING: 375 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_CULLING, &nurbsValue);376 if (nurbsValue == N_CULLINGON) {377 *value = GL_TRUE;378 } else {379 *value = GL_FALSE;380 }381 break;375 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_CULLING, &nurbsValue); 376 if (nurbsValue == N_CULLINGON) { 377 *value = GL_TRUE; 378 } else { 379 *value = GL_FALSE; 380 } 381 break; 382 382 case GLU_SAMPLING_METHOD: 383 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, value);384 if(*value == N_PATHLENGTH)385 *value = GLU_PATH_LENGTH;386 else if(*value == N_PARAMETRICDISTANCE)387 *value = GLU_PARAMETRIC_ERROR;388 else if(*value == N_DOMAINDISTANCE)389 *value = GLU_DOMAIN_DISTANCE;390 else if(*value == N_OBJECTSPACE_PATH)391 *value = GLU_OBJECT_PATH_LENGTH;392 else if(*value == N_OBJECTSPACE_PARA)393 *value = GLU_OBJECT_PARAMETRIC_ERROR; 394 break;383 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, value); 384 if(*value == N_PATHLENGTH) 385 *value = GLU_PATH_LENGTH; 386 else if(*value == N_PARAMETRICDISTANCE) 387 *value = GLU_PARAMETRIC_ERROR; 388 else if(*value == N_DOMAINDISTANCE) 389 *value = GLU_DOMAIN_DISTANCE; 390 else if(*value == N_OBJECTSPACE_PATH) 391 *value = GLU_OBJECT_PATH_LENGTH; 392 else if(*value == N_OBJECTSPACE_PARA) 393 *value = GLU_OBJECT_PARAMETRIC_ERROR; 394 break; 395 395 case GLU_SAMPLING_TOLERANCE: 396 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, value);397 break;396 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, value); 397 break; 398 398 case GLU_PARAMETRIC_TOLERANCE: 399 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, value);399 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, value); 400 400 break; 401 401 402 402 case GLU_U_STEP: 403 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, value);404 break;403 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, value); 404 break; 405 405 case GLU_V_STEP: 406 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_T_STEPS, value);407 break;406 r->getnurbsproperty(GL_MAP2_VERTEX_3, N_T_STEPS, value); 407 break; 408 408 case GLU_DISPLAY_MODE: 409 r->getnurbsproperty(N_DISPLAY, &nurbsValue);410 if (nurbsValue == N_FILL) {411 *value = GLU_FILL;412 } else if (nurbsValue == N_OUTLINE_POLY) {413 *value = GLU_OUTLINE_POLYGON;414 } else {415 *value = GLU_OUTLINE_PATCH;416 }417 break;409 r->getnurbsproperty(N_DISPLAY, &nurbsValue); 410 if (nurbsValue == N_FILL) { 411 *value = GLU_FILL; 412 } else if (nurbsValue == N_OUTLINE_POLY) { 413 *value = GLU_OUTLINE_POLYGON; 414 } else { 415 *value = GLU_OUTLINE_PATCH; 416 } 417 break; 418 418 419 419 case GLU_NURBS_MODE: 420 if(r->is_callback())421 *value = GLU_NURBS_TESSELLATOR;422 else423 *value = GLU_NURBS_RENDERER;424 break;425 420 if(r->is_callback()) 421 *value = GLU_NURBS_TESSELLATOR; 422 else 423 *value = GLU_NURBS_RENDERER; 424 break; 425 426 426 default: 427 r->postError(GLU_INVALID_ENUM);428 return;427 r->postError(GLU_INVALID_ENUM); 428 return; 429 429 } 430 430 } … … 446 446 case GLU_NURBS_TEXTURE_COORD_DATA: 447 447 case GLU_NURBS_COLOR_DATA: 448 nobj->putSurfCallBack(which, (GLvoid (* )(...))fn);448 nobj->putSurfCallBack(which, (GLvoid (* GLCALLBACK)(...))fn); 449 449 break; 450 450 451 451 case GLU_NURBS_ERROR: 452 nobj->errorCallback = (void (* )( GLenum )) fn;452 nobj->errorCallback = (void (* GLCALLBACK)( GLenum )) fn; 453 453 break; 454 454 default: -
trunk/src/opengl/glu/nurbs/interface/glrenderer.h
r2689 r3079 1 /* $Id: glrenderer.h,v 1. 1 2000-02-09 08:49:01jeroen Exp $ */1 /* $Id: glrenderer.h,v 1.2 2000-03-11 09:05:02 jeroen Exp $ */ 2 2 /* 3 3 ** License Applicability. Except to the extent portions of this file are … … 37 37 * glrenderer.h 38 38 * 39 * $Date: 2000-0 2-09 08:49:01 $ $Revision: 1.1$40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/glrenderer.h,v 1. 1 2000-02-09 08:49:01jeroen Exp $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/glrenderer.h,v 1.2 2000-03-11 09:05:02 jeroen Exp $ 41 41 */ 42 42 … … 56 56 void loadGLMatrices( void ); 57 57 void useGLMatrices( const GLfloat modelMatrix[16], 58 const GLfloat projMatrix[16],59 const GLint viewport[4] );60 void setSamplingMatrixIdentity( void );58 const GLfloat projMatrix[16], 59 const GLint viewport[4] ); 60 void setSamplingMatrixIdentity( void ); 61 61 62 void errorHandler( int ); 63 void bgnrender( void ); 64 void endrender( void ); 65 void setautoloadmode( INREAL value ) 66 { 67 68 if (value) autoloadmode = GL_TRUE; 69 else autoloadmode = GL_FALSE; 70 71 } 72 GLboolean getautoloadmode( void ) { return autoloadmode; } 62 void errorHandler( int ); 63 void bgnrender( void ); 64 void endrender( void ); 65 void setautoloadmode( INREAL value ) 66 { 73 67 74 void (GLAPI *errorCallback)( GLenum ); 75 void postError( int which ) 76 { if (errorCallback) (*errorCallback)( (GLenum)which ); } 68 if (value) autoloadmode = GL_TRUE; 69 else autoloadmode = GL_FALSE; 77 70 78 void putSurfCallBack(GLenum which, GLvoid (GLAPI *fn)(...)) 71 } 72 GLboolean getautoloadmode( void ) { return autoloadmode; } 73 74 void (GLCALLBACK *errorCallback)( GLenum ); 75 void postError( int which ) 76 { if (errorCallback) (*errorCallback)( (GLenum)which ); } 77 78 void putSurfCallBack(GLenum which, GLvoid (GLCALLBACK *fn)(...)) 79 79 { 80 curveEvaluator.putCallBack(which, fn);81 surfaceEvaluator.putCallBack(which, fn);80 curveEvaluator.putCallBack(which, fn); 81 surfaceEvaluator.putCallBack(which, fn); 82 82 } 83 83 84 84 int get_vertices_call_back() 85 85 { 86 return surfaceEvaluator.get_vertices_call_back();86 return surfaceEvaluator.get_vertices_call_back(); 87 87 } 88 88 89 89 void put_vertices_call_back(int flag) 90 90 { 91 surfaceEvaluator.put_vertices_call_back(flag);91 surfaceEvaluator.put_vertices_call_back(flag); 92 92 } 93 93 … … 112 112 void LOD_eval_list(int level) 113 113 { 114 surfaceEvaluator.LOD_eval_list(level);114 surfaceEvaluator.LOD_eval_list(level); 115 115 } 116 116 … … 118 118 int is_callback() 119 119 { 120 return callbackFlag;120 return callbackFlag; 121 121 } 122 122 void put_callbackFlag(int flag) 123 123 { 124 callbackFlag = flag;125 surfaceEvaluator.put_vertices_call_back(flag);126 curveEvaluator.put_vertices_call_back(flag);124 callbackFlag = flag; 125 surfaceEvaluator.put_vertices_call_back(flag); 126 curveEvaluator.put_vertices_call_back(flag); 127 127 } 128 128 129 129 private: 130 GLboolean autoloadmode;131 OpenGLSurfaceEvaluator surfaceEvaluator;132 OpenGLCurveEvaluator curveEvaluator;130 GLboolean autoloadmode; 131 OpenGLSurfaceEvaluator surfaceEvaluator; 132 OpenGLCurveEvaluator curveEvaluator; 133 133 134 void loadSamplingMatrix( const GLfloat vmat[4][4],135 const GLint viewport[4] );136 void loadCullingMatrix( GLfloat vmat[4][4] );137 static void grabGLMatrix( GLfloat vmat[4][4] );138 static void transform4d( GLfloat A[4], GLfloat B[4],139 GLfloat mat[4][4] );140 static void multmatrix4d( GLfloat n[4][4], GLfloat left[4][4],141 GLfloat right[4][4] );134 void loadSamplingMatrix( const GLfloat vmat[4][4], 135 const GLint viewport[4] ); 136 void loadCullingMatrix( GLfloat vmat[4][4] ); 137 static void grabGLMatrix( GLfloat vmat[4][4] ); 138 static void transform4d( GLfloat A[4], GLfloat B[4], 139 GLfloat mat[4][4] ); 140 static void multmatrix4d( GLfloat n[4][4], GLfloat left[4][4], 141 GLfloat right[4][4] ); 142 142 143 143 int callbackFlag; -
trunk/src/opengl/glu/nurbs/interface/glsurfeval.cpp
r2996 r3079 1 /* $Id: glsurfeval.cpp,v 1. 2 2000-03-04 19:10:13jeroen Exp $ */1 /* $Id: glsurfeval.cpp,v 1.3 2000-03-11 09:05:02 jeroen Exp $ */ 2 2 /* 3 3 ** License Applicability. Except to the extent portions of this file are … … 37 37 * glsurfeval.c++ 38 38 * 39 * $Date: 2000-03- 04 19:10:13 $ $Revision: 1.2$40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/glsurfeval.cpp,v 1. 2 2000-03-04 19:10:13jeroen Exp $39 * $Date: 2000-03-11 09:05:02 $ $Revision: 1.3 $ 40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/glsurfeval.cpp,v 1.3 2000-03-11 09:05:02 jeroen Exp $ 41 41 */ 42 42 … … 52 52 #include "bezierPatchMesh.h" 53 53 54 55 54 //extern int surfcount; 56 55 //int surfcount=0; 57 56 58 /*#define USE_INTERNAL_EVAL*/ //use internal evaluator 57 #define USE_INTERNAL_EVAL /* use internal evaluator*/ 59 58 60 59 /*whether do evaluation or not*/ … … 1126 1125 glEvalCoord2f((GLfloat) u, (GLfloat) v); 1127 1126 1128 1129 1127 #endif 1130 1128 … … 1192 1190 1193 1191 void 1194 OpenGLSurfaceEvaluator::putCallBack(GLenum which, GLvoid (GL API*fn)(...))1192 OpenGLSurfaceEvaluator::putCallBack(GLenum which, GLvoid (GLCALLBACK *fn)(...)) 1195 1193 { 1196 1194 switch(which) 1197 1195 { 1198 1196 case GLU_NURBS_BEGIN: 1199 beginCallBackN = (void (GL API*) (GLenum)) fn;1197 beginCallBackN = (void (GLCALLBACK *) (GLenum)) fn; 1200 1198 break; 1201 1199 case GLU_NURBS_END: 1202 endCallBackN = (void (GL API*) (void)) fn;1200 endCallBackN = (void (GLCALLBACK *) (void)) fn; 1203 1201 break; 1204 1202 case GLU_NURBS_VERTEX: 1205 vertexCallBackN = (void (GL API*) (const GLfloat*)) fn;1203 vertexCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn; 1206 1204 break; 1207 1205 case GLU_NURBS_NORMAL: 1208 normalCallBackN = (void (GL API*) (const GLfloat*)) fn;1206 normalCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn; 1209 1207 break; 1210 1208 case GLU_NURBS_COLOR: 1211 colorCallBackN = (void (GL API*) (const GLfloat*)) fn;1209 colorCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn; 1212 1210 break; 1213 1211 case GLU_NURBS_TEXTURE_COORD: 1214 texcoordCallBackN = (void (GL API*) (const GLfloat*)) fn;1212 texcoordCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn; 1215 1213 break; 1216 1214 case GLU_NURBS_BEGIN_DATA: 1217 beginCallBackData = (void (GL API*) (GLenum, void*)) fn;1215 beginCallBackData = (void (GLCALLBACK *) (GLenum, void*)) fn; 1218 1216 break; 1219 1217 case GLU_NURBS_END_DATA: 1220 endCallBackData = (void (GL API*) (void*)) fn;1218 endCallBackData = (void (GLCALLBACK *) (void*)) fn; 1221 1219 break; 1222 1220 case GLU_NURBS_VERTEX_DATA: 1223 vertexCallBackData = (void (GL API*) (const GLfloat*, void*)) fn;1221 vertexCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn; 1224 1222 break; 1225 1223 case GLU_NURBS_NORMAL_DATA: 1226 normalCallBackData = (void (GL API*) (const GLfloat*, void*)) fn;1224 normalCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn; 1227 1225 break; 1228 1226 case GLU_NURBS_COLOR_DATA: 1229 colorCallBackData = (void (GL API*) (const GLfloat*, void*)) fn;1227 colorCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn; 1230 1228 break; 1231 1229 case GLU_NURBS_TEXTURE_COORD_DATA: 1232 texcoordCallBackData = (void (GL API*) (const GLfloat*, void*)) fn;1230 texcoordCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn; 1233 1231 break; 1234 1232 -
trunk/src/opengl/glu/nurbs/interface/glsurfeval.h
r2689 r3079 1 /* $Id: glsurfeval.h,v 1. 1 2000-02-09 08:49:02jeroen Exp $ */1 /* $Id: glsurfeval.h,v 1.2 2000-03-11 09:05:03 jeroen Exp $ */ 2 2 /* 3 3 ** License Applicability. Except to the extent portions of this file are … … 37 37 * glsurfeval.h 38 38 * 39 * $Date: 2000-0 2-09 08:49:02 $ $Revision: 1.1$40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/glsurfeval.h,v 1. 1 2000-02-09 08:49:02jeroen Exp $39 * $Date: 2000-03-11 09:05:03 $ $Revision: 1.2 $ 40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/glsurfeval.h,v 1.2 2000-03-11 09:05:03 jeroen Exp $ 41 41 */ 42 42 … … 62 62 #define IN_MAX_BEZIER_ORDER 40 /*XXX should be bigger than machine order*/ 63 63 #endif 64 64 65 65 #ifndef IN_MAX_DIMENSION 66 66 #define IN_MAX_DIMENSION 4 … … 90 90 class StoredVertex { 91 91 public: 92 StoredVertex() { type = 0; }93 ~StoredVertex(void) {}94 void saveEvalCoord(REAL x, REAL y)95 {coord[0] = x; coord[1] = y; type = TYPECOORD; }96 void saveEvalPoint(long x, long y)97 {point[0] = x; point[1] = y; type = TYPEPOINT; }98 void invoke(OpenGLSurfaceEvaluator *eval);92 StoredVertex() { type = 0; } 93 ~StoredVertex(void) {} 94 void saveEvalCoord(REAL x, REAL y) 95 {coord[0] = x; coord[1] = y; type = TYPECOORD; } 96 void saveEvalPoint(long x, long y) 97 {point[0] = x; point[1] = y; type = TYPEPOINT; } 98 void invoke(OpenGLSurfaceEvaluator *eval); 99 99 100 100 private: 101 int type;102 REAL coord[2];103 long point[2];101 int type; 102 REAL coord[2]; 103 long point[2]; 104 104 }; 105 105 106 106 class OpenGLSurfaceEvaluator : public BasicSurfaceEvaluator { 107 107 public: 108 OpenGLSurfaceEvaluator();109 ~OpenGLSurfaceEvaluator( void );110 void polymode( long style );111 void range2f( long, REAL *, REAL * );112 void domain2f( REAL, REAL, REAL, REAL );113 void addMap( SurfaceMap * ) { }114 115 void enable( long );116 void disable( long );117 void bgnmap2f( long );118 void map2f( long, REAL, REAL, long, long,119 REAL, REAL, long, long, REAL * );120 void mapgrid2f( long, REAL, REAL, long, REAL, REAL );121 void mapmesh2f( long, long, long, long, long );122 void evalcoord2f( long, REAL, REAL );123 void evalpoint2i( long, long );124 void endmap2f( void );125 126 void bgnline( void );127 void endline( void );128 void bgnclosedline( void );129 void endclosedline( void );130 void bgntmesh( void );131 void swaptmesh( void );132 void endtmesh( void );133 void bgnqstrip( void );134 void endqstrip( void );108 OpenGLSurfaceEvaluator(); 109 ~OpenGLSurfaceEvaluator( void ); 110 void polymode( long style ); 111 void range2f( long, REAL *, REAL * ); 112 void domain2f( REAL, REAL, REAL, REAL ); 113 void addMap( SurfaceMap * ) { } 114 115 void enable( long ); 116 void disable( long ); 117 void bgnmap2f( long ); 118 void map2f( long, REAL, REAL, long, long, 119 REAL, REAL, long, long, REAL * ); 120 void mapgrid2f( long, REAL, REAL, long, REAL, REAL ); 121 void mapmesh2f( long, long, long, long, long ); 122 void evalcoord2f( long, REAL, REAL ); 123 void evalpoint2i( long, long ); 124 void endmap2f( void ); 125 126 void bgnline( void ); 127 void endline( void ); 128 void bgnclosedline( void ); 129 void endclosedline( void ); 130 void bgntmesh( void ); 131 void swaptmesh( void ); 132 void endtmesh( void ); 133 void bgnqstrip( void ); 134 void endqstrip( void ); 135 135 136 136 void bgntfan( void ); … … 141 141 int n_right, REAL u_right, REAL* right_val); 142 142 143 void coord2f( REAL, REAL );144 void point2i( long, long );145 146 void newtmeshvert( REAL, REAL );147 void newtmeshvert( long, long );148 149 void putCallBack(GLenum which, GLvoid (GLAPI*fn)(...));143 void coord2f( REAL, REAL ); 144 void point2i( long, long ); 145 146 void newtmeshvert( REAL, REAL ); 147 void newtmeshvert( long, long ); 148 149 void putCallBack(GLenum which, GLvoid (GLCALLBACK *fn)(...)); 150 150 int get_vertices_call_back() 151 151 { 152 return output_triangles;152 return output_triangles; 153 153 } 154 154 void put_vertices_call_back(int flag) 155 155 { 156 output_triangles = flag;156 output_triangles = flag; 157 157 } 158 158 … … 179 179 180 180 private: 181 StoredVertex *vertexCache[VERTEX_CACHE_SIZE];182 int tmeshing;183 int which;184 int vcount;181 StoredVertex *vertexCache[VERTEX_CACHE_SIZE]; 182 int tmeshing; 183 int which; 184 int vcount; 185 185 186 186 GLint gl_polygon_mode[2];/*to save and restore so that 187 *no side effect188 */187 *no side effect 188 */ 189 189 bezierPatchMesh *global_bpm; //for output triangles 190 190 int output_triangles; //true 1 or false 0 … … 192 192 193 193 194 void (GL API*beginCallBackN) (GLenum type);195 void (GL API*endCallBackN) (void);196 void (GL API*vertexCallBackN) (const GLfloat *vert);197 void (GL API*normalCallBackN) (const GLfloat *normal);198 void (GL API*colorCallBackN) (const GLfloat *color);199 void (GL API*texcoordCallBackN) (const GLfloat *texcoord);200 201 void (GL API*beginCallBackData) (GLenum type, void* data);202 void (GL API*endCallBackData) (void* data);203 void (GL API*vertexCallBackData) (const GLfloat *vert, void* data);204 void (GL API*normalCallBackData) (const GLfloat *normal, void* data);205 void (GL API*colorCallBackData) (const GLfloat *color, void* data);206 void (GL API*texcoordCallBackData) (const GLfloat *texcoord, void* data);207 208 void beginCallBack (GLenum type, void* data);209 void endCallBack (void* data);210 void vertexCallBack (const GLfloat *vert, void* data);211 void normalCallBack (const GLfloat *normal, void* data);212 void colorCallBack (const GLfloat *color, void* data);213 void texcoordCallBack (const GLfloat *texcoord, void* data);214 215 216 void* userData; //the opaque pointer for Data callback functions.194 void (GLCALLBACK *beginCallBackN) (GLenum type); 195 void (GLCALLBACK *endCallBackN) (void); 196 void (GLCALLBACK *vertexCallBackN) (const GLfloat *vert); 197 void (GLCALLBACK *normalCallBackN) (const GLfloat *normal); 198 void (GLCALLBACK *colorCallBackN) (const GLfloat *color); 199 void (GLCALLBACK *texcoordCallBackN) (const GLfloat *texcoord); 200 201 void (GLCALLBACK *beginCallBackData) (GLenum type, void* data); 202 void (GLCALLBACK *endCallBackData) (void* data); 203 void (GLCALLBACK *vertexCallBackData) (const GLfloat *vert, void* data); 204 void (GLCALLBACK *normalCallBackData) (const GLfloat *normal, void* data); 205 void (GLCALLBACK *colorCallBackData) (const GLfloat *color, void* data); 206 void (GLCALLBACK *texcoordCallBackData) (const GLfloat *texcoord, void* data); 207 208 void beginCallBack (GLenum type, void* data); 209 void endCallBack (void* data); 210 void vertexCallBack (const GLfloat *vert, void* data); 211 void normalCallBack (const GLfloat *normal, void* data); 212 void colorCallBack (const GLfloat *color, void* data); 213 void texcoordCallBack (const GLfloat *texcoord, void* data); 214 215 216 void* userData; /* the opaque pointer for Data callback functions.*/ 217 217 218 218 /*LOD evaluation*/ 219 219 void LOD_triangle(REAL A[2], REAL B[2], REAL C[2], 220 int level);220 int level); 221 221 void LOD_eval(int num_vert, REAL* verts, int type, int level); 222 223 int LOD_eval_level; //set by LOD_eval_list()222 223 int LOD_eval_level; /* set by LOD_eval_list() */ 224 224 225 225 /*************begin for internal evaluators*****************/ 226 226 227 227 /*the following global variables are only defined in this file. 228 228 *They are used to cache the precomputed Bezier polynomial values. … … 272 272 /*functions*/ 273 273 void inDoDomain2WithDerivs(int k, REAL u, REAL v, 274 REAL u1, REAL u2, int uorder,275 REAL v1, REAL v2, int vorder,276 REAL *baseData,277 REAL *retPoint, REAL *retdu, REAL *retdv);274 REAL u1, REAL u2, int uorder, 275 REAL v1, REAL v2, int vorder, 276 REAL *baseData, 277 REAL *retPoint, REAL *retdu, REAL *retdv); 278 278 void inPreEvaluate(int order, REAL vprime, REAL *coeff); 279 279 void inPreEvaluateWithDeriv(int order, REAL vprime, REAL *coeff, REAL *coeffDeriv); … … 281 281 void inComputeNormal2(REAL *pu, REAL *pv, REAL *n); 282 282 void inDoEvalCoord2(REAL u, REAL v, 283 REAL *retPoint, REAL *retNormal);283 REAL *retPoint, REAL *retNormal); 284 284 void inDoEvalCoord2NOGE(REAL u, REAL v, 285 REAL *retPoint, REAL *retNormal);285 REAL *retPoint, REAL *retNormal); 286 286 void inMap2f(int k, 287 REAL ulower,288 REAL uupper,289 int ustride,290 int uorder,291 REAL vlower,292 REAL vupper,293 int vstride,294 int vorder,295 REAL *ctlPoints);287 REAL ulower, 288 REAL uupper, 289 int ustride, 290 int uorder, 291 REAL vlower, 292 REAL vupper, 293 int vstride, 294 int vorder, 295 REAL *ctlPoints); 296 296 297 297 void inMapGrid2f(int nu, REAL u0, REAL u1, 298 int nv, REAL v0, REAL v1);298 int nv, REAL v0, REAL v1); 299 299 300 300 void inEvalMesh2(int lowU, int lowV, int highU, int highV); … … 303 303 304 304 void inEvalULine(int n_points, REAL v, REAL* u_vals, 305 int stride, REAL ret_points[][3], REAL ret_normals[][3]);305 int stride, REAL ret_points[][3], REAL ret_normals[][3]); 306 306 307 307 void inEvalVLine(int n_points, REAL u, REAL* v_vals, 308 int stride, REAL ret_points[][3], REAL ret_normals[][3]);308 int stride, REAL ret_points[][3], REAL ret_normals[][3]); 309 309 310 310 void inEvalUStrip(int n_upper, REAL v_upper, REAL* upper_val, … … 326 326 327 327 void inDoDomain2WithDerivsBV(int k, REAL u, REAL v, 328 REAL u1, REAL u2, int uorder,329 REAL v1, REAL v2, int vorder,330 REAL *baseData,331 REAL *retPoint, REAL* retdu, REAL *retdv);328 REAL u1, REAL u2, int uorder, 329 REAL v1, REAL v2, int vorder, 330 REAL *baseData, 331 REAL *retPoint, REAL* retdu, REAL *retdv); 332 332 333 333 void inDoDomain2WithDerivsBU(int k, REAL u, REAL v, 334 REAL u1, REAL u2, int uorder,335 REAL v1, REAL v2, int vorder,336 REAL *baseData,337 REAL *retPoint, REAL* retdu, REAL *retdv);334 REAL u1, REAL u2, int uorder, 335 REAL v1, REAL v2, int vorder, 336 REAL *baseData, 337 REAL *retPoint, REAL* retdu, REAL *retdv); 338 338 339 339 340 340 void inDoEvalCoord2NOGE_BV(REAL u, REAL v, 341 REAL *retPoint, REAL *retNormal);341 REAL *retPoint, REAL *retNormal); 342 342 343 343 void inDoEvalCoord2NOGE_BU(REAL u, REAL v, 344 REAL *retPoint, REAL *retNormal);344 REAL *retPoint, REAL *retNormal); 345 345 346 346 void inBPMEval(bezierPatchMesh* bpm); … … 362 362 363 363 void inMap2fEM(int which, //0:vert,1:norm,2:color,3:tex 364 int dimension,365 REAL ulower,366 REAL uupper,367 int ustride,368 int uorder,369 REAL vlower,370 REAL vupper,371 int vstride,372 int vorder,373 REAL *ctlPoints);364 int dimension, 365 REAL ulower, 366 REAL uupper, 367 int ustride, 368 int uorder, 369 REAL vlower, 370 REAL vupper, 371 int vstride, 372 int vorder, 373 REAL *ctlPoints); 374 374 375 375 void inDoDomain2WithDerivsEM(surfEvalMachine *em, REAL u, REAL v, 376 REAL *retPoint, REAL *retdu, REAL *retdv);376 REAL *retPoint, REAL *retdu, REAL *retdv); 377 377 void inDoDomain2EM(surfEvalMachine *em, REAL u, REAL v, 378 REAL *retPoint);378 REAL *retPoint); 379 379 void inDoEvalCoord2EM(REAL u, REAL v); 380 380 … … 386 386 387 387 /*************end for internal evaluators*****************/ 388 388 389 389 }; 390 390 … … 393 393 switch(type) { 394 394 case TYPECOORD: 395 eval->coord2f(coord[0], coord[1]);396 break;395 eval->coord2f(coord[0], coord[1]); 396 break; 397 397 case TYPEPOINT: 398 eval->point2i(point[0], point[1]);399 break;398 eval->point2i(point[0], point[1]); 399 break; 400 400 default: 401 break;401 break; 402 402 } 403 403 } -
trunk/src/opengl/glu/nurbs/interface/insurfeval.cpp
r2689 r3079 1 /* $Id: insurfeval.cpp,v 1. 1 2000-02-09 08:49:02jeroen Exp $ */1 /* $Id: insurfeval.cpp,v 1.2 2000-03-11 09:05:03 jeroen Exp $ */ 2 2 /* 3 3 ** License Applicability. Except to the extent portions of this file are … … 33 33 ** compliant with the OpenGL(R) version 1.2.1 Specification. 34 34 ** 35 ** $Date: 2000-0 2-09 08:49:02 $ $Revision: 1.1$35 ** $Date: 2000-03-11 09:05:03 $ $Revision: 1.2 $ 36 36 */ 37 37 /* 38 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/insurfeval.cpp,v 1. 1 2000-02-09 08:49:02jeroen Exp $38 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/interface/insurfeval.cpp,v 1.2 2000-03-11 09:05:03 jeroen Exp $ 39 39 */ 40 40 … … 66 66 67 67 static void LOD_interpolate(REAL A[2], REAL B[2], REAL C[2], int j, int k, int pow2_level, 68 REAL& u, REAL& v)68 REAL& u, REAL& v) 69 69 { 70 70 REAL a,a1,b,b1; … … 94 94 95 95 void OpenGLSurfaceEvaluator::LOD_triangle(REAL A[2], REAL B[2], REAL C[2], 96 int level)96 int level) 97 97 { 98 98 int k,j; … … 118 118 119 119 for(k=0; k<=j; k++) 120 {121 LOD_interpolate(A,B,C,j,j-k,pow2_level, u,v);120 { 121 LOD_interpolate(A,B,C,j,j-k,pow2_level, u,v); 122 122 #ifdef USE_LOD 123 123 LOD_EVAL_COORD(u,v); 124 // glEvalCoord2f(u,v);124 // glEvalCoord2f(u,v); 125 125 #else 126 inDoEvalCoord2EM(u,v);126 inDoEvalCoord2EM(u,v); 127 127 #endif 128 128 129 LOD_interpolate(A,B,C,j+1,j-k,pow2_level, u,v);129 LOD_interpolate(A,B,C,j+1,j-k,pow2_level, u,v); 130 130 131 131 #ifdef USE_LOD 132 LOD_EVAL_COORD(u,v);133 // glEvalCoord2f(u,v);132 LOD_EVAL_COORD(u,v); 133 // glEvalCoord2f(u,v); 134 134 #else 135 inDoEvalCoord2EM(u,v);135 inDoEvalCoord2EM(u,v); 136 136 #endif 137 }138 // endCallBack(); 137 } 138 // endCallBack(); 139 139 glEnd(); 140 140 } … … 142 142 143 143 void OpenGLSurfaceEvaluator::LOD_eval(int num_vert, REAL* verts, int type, 144 int level145 )144 int level 145 ) 146 146 { 147 147 int i,k; … … 151 151 for(i=2, k=4; i<=num_vert-2; i+=2, k+=4) 152 152 { 153 LOD_triangle(verts+k-4, verts+k-2, verts+k,154 level155 );156 LOD_triangle(verts+k-2, verts+k+2, verts+k,157 level158 );153 LOD_triangle(verts+k-4, verts+k-2, verts+k, 154 level 155 ); 156 LOD_triangle(verts+k-2, verts+k+2, verts+k, 157 level 158 ); 159 159 } 160 160 if(num_vert % 2 ==1) 161 161 { 162 LOD_triangle(verts+2*(num_vert-3), verts+2*(num_vert-2), verts+2*(num_vert-1),163 level164 );162 LOD_triangle(verts+2*(num_vert-3), verts+2*(num_vert-2), verts+2*(num_vert-1), 163 level 164 ); 165 165 } 166 166 break; … … 168 168 for(i=1, k=2; i<=num_vert-2; i++, k+=2) 169 169 { 170 LOD_triangle(verts,verts+k, verts+k+2,171 level172 );170 LOD_triangle(verts,verts+k, verts+k+2, 171 level 172 ); 173 173 } 174 174 break; … … 178 178 } 179 179 } 180 180 181 181 182 182 #endif //USE_LOD … … 256 256 int vstride = bpm->bpatch->dimension; 257 257 inMap2f( 258 (bpm->bpatch->dimension == 3)? GL_MAP2_VERTEX_3 : GL_MAP2_VERTEX_4,259 bpm->bpatch->umin,260 bpm->bpatch->umax,261 ustride,262 bpm->bpatch->uorder,263 bpm->bpatch->vmin,264 bpm->bpatch->vmax,265 vstride,266 bpm->bpatch->vorder,267 bpm->bpatch->ctlpoints);258 (bpm->bpatch->dimension == 3)? GL_MAP2_VERTEX_3 : GL_MAP2_VERTEX_4, 259 bpm->bpatch->umin, 260 bpm->bpatch->umax, 261 ustride, 262 bpm->bpatch->uorder, 263 bpm->bpatch->vmin, 264 bpm->bpatch->vmax, 265 vstride, 266 bpm->bpatch->vorder, 267 bpm->bpatch->ctlpoints); 268 268 269 269 bpm->vertex_array = (float*) malloc(sizeof(float)* (bpm->index_UVarray/2) * 3+1); /*in case the origional dimenion is 4, then we need 4 space to pass to evaluator.*/ … … 1339 1339 leftMostV[1] = v_lower; 1340 1340 1341 leftMostNormal = lowerNormal[j-1];1342 leftMostXYZ = lowerXYZ[j-1];1341 leftMostNormal = lowerNormal[j-1]; 1342 leftMostXYZ = lowerXYZ[j-1]; 1343 1343 } 1344 1344 } … … 1423 1423 { 1424 1424 bgntfan(); 1425 glNormal3fv(botMostNormal);1425 glNormal3fv(botMostNormal); 1426 1426 glVertex3fv(botMostXYZ); 1427 1427 1428 1428 while(j<n_right){ 1429 glNormal3fv(rightNormal[j]);1430 glVertex3fv(rightXYZ[j]);1431 j++;1429 glNormal3fv(rightNormal[j]); 1430 glVertex3fv(rightXYZ[j]); 1431 j++; 1432 1432 1433 1433 } … … 1441 1441 { 1442 1442 bgntfan(); 1443 glNormal3fv(botMostNormal);1444 glVertex3fv(botMostXYZ);1445 1443 glNormal3fv(botMostNormal); 1444 glVertex3fv(botMostXYZ); 1445 1446 1446 for(k=n_left-1; k>=i; k--) /*reverse order for two-side lighting*/ 1447 {1448 glNormal3fv(leftNormal[k]);1449 glVertex3fv(leftXYZ[k]);1450 }1447 { 1448 glNormal3fv(leftNormal[k]); 1449 glVertex3fv(leftXYZ[k]); 1450 } 1451 1451 1452 1452 endtfan(); … … 1458 1458 if(left_val[i] <= right_val[j]) 1459 1459 { 1460 bgntfan();1461 1462 glNormal3fv(rightNormal[j]);1463 glVertex3fv(rightXYZ[j]);1460 bgntfan(); 1461 1462 glNormal3fv(rightNormal[j]); 1463 glVertex3fv(rightXYZ[j]); 1464 1464 1465 1465 /*find the last k>=i such that … … 1480 1480 for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ 1481 1481 { 1482 glNormal3fv(leftNormal[l]);1483 glVertex3fv(leftXYZ[l]);1482 glNormal3fv(leftNormal[l]); 1483 glVertex3fv(leftXYZ[l]); 1484 1484 1485 1485 } 1486 glNormal3fv(botMostNormal);1487 glVertex3fv(botMostXYZ);1486 glNormal3fv(botMostNormal); 1487 glVertex3fv(botMostXYZ); 1488 1488 1489 1489 endtfan(); … … 1493 1493 i = k+1; 1494 1494 1495 botMostV[0] = u_left;1496 botMostV[1] = left_val[k];1497 botMostNormal = leftNormal[k];1498 botMostXYZ = leftXYZ[k];1495 botMostV[0] = u_left; 1496 botMostV[1] = left_val[k]; 1497 botMostNormal = leftNormal[k]; 1498 botMostXYZ = leftXYZ[k]; 1499 1499 } 1500 1500 else /*left_val[i] > right_val[j])*/ 1501 1501 { 1502 bgntfan();1503 glNormal3fv(leftNormal[i]);1504 glVertex3fv(leftXYZ[i]);1505 1502 bgntfan(); 1503 glNormal3fv(leftNormal[i]); 1504 glVertex3fv(leftXYZ[i]); 1505 1506 1506 glNormal3fv(botMostNormal); 1507 glVertex3fv(botMostXYZ);1508 1507 glVertex3fv(botMostXYZ); 1508 1509 1509 1510 1510 /*find the last k>=j such that … … 1516 1516 if(right_val[k] >= left_val[i]) 1517 1517 break; 1518 glNormal3fv(rightNormal[k]);1519 glVertex3fv(rightXYZ[k]);1518 glNormal3fv(rightNormal[k]); 1519 glVertex3fv(rightXYZ[k]); 1520 1520 1521 1521 k++; … … 1526 1526 */ 1527 1527 j=k; 1528 botMostV[0] = u_right;1529 botMostV[1] = right_val[j-1];1530 1531 botMostNormal = rightNormal[j-1];1532 botMostXYZ = rightXYZ[j-1];1528 botMostV[0] = u_right; 1529 botMostV[1] = right_val[j-1]; 1530 1531 botMostNormal = rightNormal[j-1]; 1532 botMostXYZ = rightXYZ[j-1]; 1533 1533 } 1534 1534 } … … 1536 1536 //clean up 1537 1537 free(leftXYZ); 1538 free( leftXYZ);1539 free( rightNormal);1538 free(rightXYZ); 1539 free(leftNormal); 1540 1540 free(rightNormal); 1541 1541 } … … 1543 1543 /*-----------------------begin evalMachine-------------------*/ 1544 1544 void OpenGLSurfaceEvaluator::inMap2fEM(int which, int k, 1545 REAL ulower,1546 REAL uupper,1547 int ustride,1548 int uorder,1549 REAL vlower,1550 REAL vupper,1551 int vstride,1552 int vorder,1553 REAL *ctlPoints)1545 REAL ulower, 1546 REAL uupper, 1547 int ustride, 1548 int uorder, 1549 REAL vlower, 1550 REAL vupper, 1551 int vstride, 1552 int vorder, 1553 REAL *ctlPoints) 1554 1554 { 1555 1555 int i,j,x; … … 2046 2046 #endif //GENERIC_TEST 2047 2047 2048 inDoEvalCoord2EM(u,v);2048 inDoEvalCoord2EM(u,v); 2049 2049 2050 2050 #endif //USE_LOD 2051 2051 2052 k += 2;2053 }2052 k += 2; 2053 } 2054 2054 endCallBack(userData); 2055 2055 -
trunk/src/opengl/glu/nurbs/internals/slicer.cpp
r2689 r3079 1 /* $Id: slicer.cpp,v 1. 1 2000-02-09 08:50:28jeroen Exp $ */1 /* $Id: slicer.cpp,v 1.2 2000-03-11 09:05:03 jeroen Exp $ */ 2 2 /* 3 3 ** License Applicability. Except to the extent portions of this file are … … 37 37 * slicer.c++ 38 38 * 39 * $Date: 2000-0 2-09 08:50:28 $ $Revision: 1.1$40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/internals/slicer.cpp,v 1. 1 2000-02-09 08:50:28jeroen Exp $39 * $Date: 2000-03-11 09:05:03 $ $Revision: 1.2 $ 40 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/nurbs/internals/slicer.cpp,v 1.2 2000-03-11 09:05:03 jeroen Exp $ 41 41 */ 42 42 … … 55 55 #include "varray.h" 56 56 57 #include "polyUtil.h" //for area()57 #include "polyUtil.h" /* for area() */ 58 58 59 59 //static int count=0; … … 111 111 112 112 n_changes = (compV2InX(loop->prev->head(), loop->prev->tail()) 113 != cur_sign);113 != cur_sign); 114 114 115 115 for(temp=loop->next; temp != loop; temp = temp->next) … … 120 120 { 121 121 #ifdef DEBUG 122 printf("***change signe\n");122 printf("***change signe\n"); 123 123 #endif 124 n_changes++;124 n_changes++; 125 125 } 126 126 } … … 154 154 //first find bot 155 155 for(temp = loop->next; temp != loop; temp = temp->next) 156 {157 if(compInY(temp->tail(), temp->prev->tail()) > 0)158 break;159 }156 { 157 if(compInY(temp->tail(), temp->prev->tail()) > 0) 158 break; 159 } 160 160 bot = temp->prev; 161 161 //then find top 162 162 for(temp=loop->prev; temp != loop; temp = temp->prev) 163 {164 if(compInY(temp->tail(), temp->prev->tail()) > 0)165 break;166 }163 { 164 if(compInY(temp->tail(), temp->prev->tail()) > 0) 165 break; 166 } 167 167 top = temp; 168 168 } … … 170 170 { 171 171 for(temp=loop->next; temp != loop; temp = temp->next) 172 {173 if(compInY(temp->tail(), temp->prev->tail()) < 0)174 break;175 }172 { 173 if(compInY(temp->tail(), temp->prev->tail()) < 0) 174 break; 175 } 176 176 top = temp->prev; 177 177 for(temp=loop->prev; temp != loop; temp = temp->prev) 178 {179 if(compInY(temp->tail(), temp->prev->tail()) < 0)180 break;181 }178 { 179 if(compInY(temp->tail(), temp->prev->tail()) < 0) 180 break; 181 } 182 182 bot = temp; 183 183 } … … 192 192 { 193 193 for(i=0; i<=jarc->pwlArc->npts-2; i++) 194 {195 inc_chain.appendVertex(jarc->pwlArc->pts[i].param);196 }194 { 195 inc_chain.appendVertex(jarc->pwlArc->pts[i].param); 196 } 197 197 198 198 } … … 201 201 { 202 202 for(i=jarc->pwlArc->npts-2; i>=0; i--) 203 {204 dec_chain.appendVertex(jarc->pwlArc->pts[i].param);205 }203 { 204 dec_chain.appendVertex(jarc->pwlArc->pts[i].param); 205 } 206 206 } 207 207 for(i=bot->pwlArc->npts-2; i>=1; i--) 208 208 { 209 209 dec_chain.appendVertex(jarc->pwlArc->pts[i].param); 210 } 210 } 211 211 212 212 monoTriangulationRec(top->tail(), bot->tail(), &inc_chain, 0, 213 &dec_chain, 0, &backend);213 &dec_chain, 0, &backend); 214 214 215 215 } … … 225 225 nlines++; 226 226 if(nlines == 5) 227 break;227 break; 228 228 } 229 229 if(nlines != 4) … … 238 238 printf("loop->next->head=(%f,%f)\n", loop->next->head()[0], loop->next->head()[1]); 239 239 if(fabs(loop->tail()[0] - loop->head()[0])<0.000001) 240 printf("equal 1\n");240 printf("equal 1\n"); 241 241 if(loop->next->tail()[1] == loop->next->head()[1]) 242 printf("equal 2\n");242 printf("equal 2\n"); 243 243 */ 244 244 … … 290 290 int i; 291 291 for(i=0; i<n; i++) 292 backend.tmeshvertNOGE(&verts[i]);292 backend.tmeshvertNOGE(&verts[i]); 293 293 } 294 294 } … … 319 319 { 320 320 if(loop->tail()[1] > loop->prev->prev->tail()[1]) 321 {322 323 top = loop;324 }321 { 322 323 top = loop; 324 } 325 325 else{ 326 326 327 top = loop->prev->prev;328 }327 top = loop->prev->prev; 328 } 329 329 } 330 330 else 331 331 { 332 332 if(loop->tail()[0] > loop->prev->prev->tail()[0]) 333 {334 //loop is the right arc335 336 top = loop->next;337 }333 { 334 //loop is the right arc 335 336 top = loop->next; 337 } 338 338 else 339 {340 341 top = loop->prev;342 }339 { 340 341 top = loop->prev; 342 } 343 343 } 344 344 left = top->next; … … 353 353 int nu = top->pwlArc->npts; 354 354 if(nu < bot->pwlArc->npts) 355 nu = bot->pwlArc->npts;355 nu = bot->pwlArc->npts; 356 356 int nv = left->pwlArc->npts; 357 357 if(nv < right->pwlArc->npts) 358 nv = right->pwlArc->npts;358 nv = right->pwlArc->npts; 359 359 /* 360 360 if(nu > 2 && nv > 2) 361 {362 triangulateRectGen(top, nu-2, nv-2, backend);363 return;364 }361 { 362 triangulateRectGen(top, nu-2, nv-2, backend); 363 return; 364 } 365 365 */ 366 366 } … … 376 376 377 377 if(maxPointsTB < maxPointsLR) 378 triangulateRectAux(left->pwlArc, right->pwlArc, bot->pwlArc, top->pwlArc, backend);378 triangulateRectAux(left->pwlArc, right->pwlArc, bot->pwlArc, top->pwlArc, backend); 379 379 else 380 triangulateRectAux(top->pwlArc, bot->pwlArc, left->pwlArc, right->pwlArc, backend);380 triangulateRectAux(top->pwlArc, bot->pwlArc, left->pwlArc, right->pwlArc, backend); 381 381 } 382 382 } … … 397 397 398 398 if(top->npts == 2) { 399 backend.bgntfan();400 OPT_OUTVERT(top->pts[0], backend);//the root401 for(i=0; i<left->npts; i++){402 OPT_OUTVERT(left->pts[i], backend);403 }404 for(i=1; i<= bot->npts-2; i++){405 OPT_OUTVERT(bot->pts[i], backend);406 }407 backend.endtfan();408 409 backend.bgntfan();410 OPT_OUTVERT(bot->pts[bot->npts-2], backend);411 for(i=0; i<right->npts; i++){412 OPT_OUTVERT(right->pts[i], backend);413 }414 backend.endtfan();399 backend.bgntfan(); 400 OPT_OUTVERT(top->pts[0], backend);//the root 401 for(i=0; i<left->npts; i++){ 402 OPT_OUTVERT(left->pts[i], backend); 403 } 404 for(i=1; i<= bot->npts-2; i++){ 405 OPT_OUTVERT(bot->pts[i], backend); 406 } 407 backend.endtfan(); 408 409 backend.bgntfan(); 410 OPT_OUTVERT(bot->pts[bot->npts-2], backend); 411 for(i=0; i<right->npts; i++){ 412 OPT_OUTVERT(right->pts[i], backend); 413 } 414 backend.endtfan(); 415 415 } 416 416 else if(bot->npts == 2) { 417 backend.bgntfan();418 OPT_OUTVERT(bot->pts[0], backend);//the root419 for(i=0; i<right->npts; i++){420 OPT_OUTVERT(right->pts[i], backend);421 }422 for(i=1; i<= top->npts-2; i++){423 OPT_OUTVERT(top->pts[i], backend);424 }425 backend.endtfan();426 427 backend.bgntfan();428 OPT_OUTVERT(top->pts[top->npts-2], backend);429 for(i=0; i<left->npts; i++){430 OPT_OUTVERT(left->pts[i], backend);431 }432 backend.endtfan();417 backend.bgntfan(); 418 OPT_OUTVERT(bot->pts[0], backend);//the root 419 for(i=0; i<right->npts; i++){ 420 OPT_OUTVERT(right->pts[i], backend); 421 } 422 for(i=1; i<= top->npts-2; i++){ 423 OPT_OUTVERT(top->pts[i], backend); 424 } 425 backend.endtfan(); 426 427 backend.bgntfan(); 428 OPT_OUTVERT(top->pts[top->npts-2], backend); 429 for(i=0; i<left->npts; i++){ 430 OPT_OUTVERT(left->pts[i], backend); 431 } 432 backend.endtfan(); 433 433 } 434 434 else { //both top and bot have >=3 points 435 436 backend.bgntfan();437 438 OPT_OUTVERT(top->pts[top->npts-2], backend);439 440 for(i=0; i<=d; i++)441 {442 OPT_OUTVERT(left->pts[i], backend); 443 }444 backend.endtfan();445 446 backend.bgntfan();447 448 OPT_OUTVERT(bot->pts[1], backend);449 450 OPT_OUTVERT(top->pts[top->npts-2], backend);451 452 for(i=d; i< left->npts; i++)453 {454 OPT_OUTVERT(left->pts[i], backend);455 }456 backend.endtfan();457 458 d = right->npts/2;459 //output only when d<right->npts-1 and460 //461 if(d<right->npts-1)462 { 463 backend.bgntfan();464 // backend.tmeshvert(& top->pts[1]);465 OPT_OUTVERT(top->pts[1], backend);466 for(i=d; i< right->npts; i++)467 {468 //backend.tmeshvert(& right->pts[i]);469 470 OPT_OUTVERT(right->pts[i], backend);471 472 }473 backend.endtfan();474 }475 476 backend.bgntfan();477 // backend.tmeshvert(& bot->pts[bot->npts-2]);478 OPT_OUTVERT( bot->pts[bot->npts-2], backend);479 for(i=0; i<=d; i++)480 {481 //backend.tmeshvert(& right->pts[i]);482 OPT_OUTVERT(right->pts[i], backend);483 484 }485 486 // backend.tmeshvert(& top->pts[1]);487 OPT_OUTVERT(top->pts[1], backend);488 489 backend.endtfan();490 491 492 topd_left = top->npts-2;493 topd_right = 1; //topd_left>= topd_right494 495 botd_left = 1;496 botd_right = bot->npts-2; //botd_left<= bot_dright497 498 499 if(top->npts < bot->npts)500 {501 int delta=bot->npts - top->npts;502 int u = delta/2;503 botd_left = 1+ u;504 botd_right = bot->npts-2-( delta-u); 505 506 if(botd_left >1)507 {508 backend.bgntfan();509 //backend.tmeshvert(& top->pts[top->npts-2]);510 OPT_OUTVERT(top->pts[top->npts-2], backend);511 for(i=1; i<= botd_left; i++)512 {513 //backend.tmeshvert(& bot->pts[i]);514 OPT_OUTVERT(bot->pts[i] , backend);515 }516 backend.endtfan();517 }518 if(botd_right < bot->npts-2)519 {520 backend.bgntfan();521 OPT_OUTVERT(top->pts[1], backend);522 for(i=botd_right; i<= bot->npts-2; i++)523 OPT_OUTVERT(bot->pts[i], backend);524 backend.endtfan();525 }526 }527 else if(top->npts> bot->npts)528 {529 int delta=top->npts-bot->npts;530 int u = delta/2;531 topd_left = top->npts-2 - u;532 topd_right = 1+delta-u;533 534 if(topd_left < top->npts-2)535 {536 backend.bgntfan();537 //backend.tmeshvert(& bot->pts[1]);538 OPT_OUTVERT(bot->pts[1], backend);539 for(i=topd_left; i<= top->npts-2; i++)540 {541 //backend.tmeshvert(& top->pts[i]);542 OPT_OUTVERT(top->pts[i], backend);543 }544 backend.endtfan();545 }546 if(topd_right > 1)547 {548 backend.bgntfan();549 OPT_OUTVERT(bot->pts[bot->npts-2], backend);550 for(i=1; i<= topd_right; i++)551 OPT_OUTVERT(top->pts[i], backend);552 backend.endtfan();553 }554 }555 556 if(topd_left <= topd_right)557 return;558 559 backend.bgnqstrip();560 for(j=botd_left, i=topd_left; i>=topd_right; i--,j++)561 {562 //backend.tmeshvert(& top->pts[i]);563 //backend.tmeshvert(& bot->pts[j]);564 OPT_OUTVERT(top->pts[i], backend);565 OPT_OUTVERT(bot->pts[j], backend);566 }567 backend.endqstrip();568 435 436 backend.bgntfan(); 437 438 OPT_OUTVERT(top->pts[top->npts-2], backend); 439 440 for(i=0; i<=d; i++) 441 { 442 OPT_OUTVERT(left->pts[i], backend); 443 } 444 backend.endtfan(); 445 446 backend.bgntfan(); 447 448 OPT_OUTVERT(bot->pts[1], backend); 449 450 OPT_OUTVERT(top->pts[top->npts-2], backend); 451 452 for(i=d; i< left->npts; i++) 453 { 454 OPT_OUTVERT(left->pts[i], backend); 455 } 456 backend.endtfan(); 457 458 d = right->npts/2; 459 //output only when d<right->npts-1 and 460 // 461 if(d<right->npts-1) 462 { 463 backend.bgntfan(); 464 // backend.tmeshvert(& top->pts[1]); 465 OPT_OUTVERT(top->pts[1], backend); 466 for(i=d; i< right->npts; i++) 467 { 468 // backend.tmeshvert(& right->pts[i]); 469 470 OPT_OUTVERT(right->pts[i], backend); 471 472 } 473 backend.endtfan(); 474 } 475 476 backend.bgntfan(); 477 // backend.tmeshvert(& bot->pts[bot->npts-2]); 478 OPT_OUTVERT( bot->pts[bot->npts-2], backend); 479 for(i=0; i<=d; i++) 480 { 481 // backend.tmeshvert(& right->pts[i]); 482 OPT_OUTVERT(right->pts[i], backend); 483 484 } 485 486 // backend.tmeshvert(& top->pts[1]); 487 OPT_OUTVERT(top->pts[1], backend); 488 489 backend.endtfan(); 490 491 492 topd_left = top->npts-2; 493 topd_right = 1; //topd_left>= topd_right 494 495 botd_left = 1; 496 botd_right = bot->npts-2; //botd_left<= bot_dright 497 498 499 if(top->npts < bot->npts) 500 { 501 int delta=bot->npts - top->npts; 502 int u = delta/2; 503 botd_left = 1+ u; 504 botd_right = bot->npts-2-( delta-u); 505 506 if(botd_left >1) 507 { 508 backend.bgntfan(); 509 // backend.tmeshvert(& top->pts[top->npts-2]); 510 OPT_OUTVERT(top->pts[top->npts-2], backend); 511 for(i=1; i<= botd_left; i++) 512 { 513 // backend.tmeshvert(& bot->pts[i]); 514 OPT_OUTVERT(bot->pts[i] , backend); 515 } 516 backend.endtfan(); 517 } 518 if(botd_right < bot->npts-2) 519 { 520 backend.bgntfan(); 521 OPT_OUTVERT(top->pts[1], backend); 522 for(i=botd_right; i<= bot->npts-2; i++) 523 OPT_OUTVERT(bot->pts[i], backend); 524 backend.endtfan(); 525 } 526 } 527 else if(top->npts> bot->npts) 528 { 529 int delta=top->npts-bot->npts; 530 int u = delta/2; 531 topd_left = top->npts-2 - u; 532 topd_right = 1+delta-u; 533 534 if(topd_left < top->npts-2) 535 { 536 backend.bgntfan(); 537 // backend.tmeshvert(& bot->pts[1]); 538 OPT_OUTVERT(bot->pts[1], backend); 539 for(i=topd_left; i<= top->npts-2; i++) 540 { 541 // backend.tmeshvert(& top->pts[i]); 542 OPT_OUTVERT(top->pts[i], backend); 543 } 544 backend.endtfan(); 545 } 546 if(topd_right > 1) 547 { 548 backend.bgntfan(); 549 OPT_OUTVERT(bot->pts[bot->npts-2], backend); 550 for(i=1; i<= topd_right; i++) 551 OPT_OUTVERT(top->pts[i], backend); 552 backend.endtfan(); 553 } 554 } 555 556 if(topd_left <= topd_right) 557 return; 558 559 backend.bgnqstrip(); 560 for(j=botd_left, i=topd_left; i>=topd_right; i--,j++) 561 { 562 // backend.tmeshvert(& top->pts[i]); 563 // backend.tmeshvert(& bot->pts[j]); 564 OPT_OUTVERT(top->pts[i], backend); 565 OPT_OUTVERT(bot->pts[j], backend); 566 } 567 backend.endqstrip(); 568 569 569 } 570 570 } … … 573 573 574 574 static void triangulateRectCenter(int n_ulines, REAL* u_val, 575 int n_vlines, REAL* v_val,576 Backend& backend)575 int n_vlines, REAL* v_val, 576 Backend& backend) 577 577 { 578 578 TrimVertex trimVert; … … 580 580 581 581 backend.surfgrid(u_val[0], u_val[n_ulines-1], n_ulines-1, 582 v_val[n_vlines-1], v_val[0], n_vlines-1);582 v_val[n_vlines-1], v_val[0], n_vlines-1); 583 583 584 584 if(n_ulines>1 && n_vlines>1) … … 593 593 backend.bgnqstrip(); 594 594 for(j=0; j<n_ulines; j++) 595 {596 trimVert.param[0] = u_val[j];597 trimVert.param[1] = v_val[i+1];598 backend.tmeshvert(& trimVert); 599 600 trimVert.param[1] = v_val[i];601 backend.tmeshvert(& trimVert); 602 }595 { 596 trimVert.param[0] = u_val[j]; 597 trimVert.param[1] = v_val[i+1]; 598 backend.tmeshvert(& trimVert); 599 600 trimVert.param[1] = v_val[i]; 601 backend.tmeshvert(& trimVert); 602 } 603 603 backend.endqstrip(); 604 604 … … 617 617 assert(upper_val); 618 618 if(dir) 619 {620 for(k=0,i=arc->pwlArc->npts-1; i>=0; i--,k++)621 {622 upper_val[k] = arc->pwlArc->pts[i].param[0];623 } 624 backend.evalUStrip(arc->pwlArc->npts, arc->pwlArc->pts[0].param[1],625 upper_val,626 n_ulines, v, u_val);627 }619 { 620 for(k=0,i=arc->pwlArc->npts-1; i>=0; i--,k++) 621 { 622 upper_val[k] = arc->pwlArc->pts[i].param[0]; 623 } 624 backend.evalUStrip(arc->pwlArc->npts, arc->pwlArc->pts[0].param[1], 625 upper_val, 626 n_ulines, v, u_val); 627 } 628 628 else 629 {630 for(k=0,i=0; i<arc->pwlArc->npts; i++,k++)631 {632 upper_val[k] = arc->pwlArc->pts[i].param[0];633 634 } 635 636 backend.evalUStrip(637 n_ulines, v, u_val,638 arc->pwlArc->npts, arc->pwlArc->pts[0].param[1], upper_val639 ); 640 }629 { 630 for(k=0,i=0; i<arc->pwlArc->npts; i++,k++) 631 { 632 upper_val[k] = arc->pwlArc->pts[i].param[0]; 633 634 } 635 636 backend.evalUStrip( 637 n_ulines, v, u_val, 638 arc->pwlArc->npts, arc->pwlArc->pts[0].param[1], upper_val 639 ); 640 } 641 641 642 642 free(upper_val); … … 649 649 assert(left_val); 650 650 if(dir) 651 {652 for(k=0,i=arc->pwlArc->npts-1; i>=0; i--,k++)653 {654 left_val[k] = arc->pwlArc->pts[i].param[1];655 }656 backend.evalVStrip(arc->pwlArc->npts, arc->pwlArc->pts[0].param[0],657 left_val,658 n_ulines, v, u_val);659 }651 { 652 for(k=0,i=arc->pwlArc->npts-1; i>=0; i--,k++) 653 { 654 left_val[k] = arc->pwlArc->pts[i].param[1]; 655 } 656 backend.evalVStrip(arc->pwlArc->npts, arc->pwlArc->pts[0].param[0], 657 left_val, 658 n_ulines, v, u_val); 659 } 660 660 else 661 {662 for(k=0,i=0; i<arc->pwlArc->npts; i++,k++)663 {664 left_val[k] = arc->pwlArc->pts[i].param[1];665 }666 backend.evalVStrip(667 n_ulines, v, u_val,668 arc->pwlArc->npts, arc->pwlArc->pts[0].param[0], left_val669 ); 670 }661 { 662 for(k=0,i=0; i<arc->pwlArc->npts; i++,k++) 663 { 664 left_val[k] = arc->pwlArc->pts[i].param[1]; 665 } 666 backend.evalVStrip( 667 n_ulines, v, u_val, 668 arc->pwlArc->npts, arc->pwlArc->pts[0].param[0], left_val 669 ); 670 } 671 671 free(left_val); 672 672 return; 673 673 } 674 674 675 675 //the following is a different version of the above code. If you comment 676 676 //the above code, the following code will still work. The reason to leave … … 689 689 assert(temp_u_val); 690 690 for(i=0; i<n_ulines; i++) 691 temp_u_val[i] = u_val[n_ulines-1-i];691 temp_u_val[i] = u_val[n_ulines-1-i]; 692 692 } 693 693 u_val = temp_u_val; … … 699 699 backend.bgntfan(); 700 700 if(is_u){ 701 trimVert.param[0] = u_val[0];702 trimVert.param[1] = v;701 trimVert.param[0] = u_val[0]; 702 trimVert.param[1] = v; 703 703 } 704 704 else 705 {706 trimVert.param[1] = u_val[0];707 trimVert.param[0] = v;705 { 706 trimVert.param[1] = u_val[0]; 707 trimVert.param[0] = v; 708 708 } 709 709 710 710 backend.tmeshvert(& trimVert); 711 711 for(i=d1; i< parc->npts; i++) 712 backend.tmeshvert(& parc->pts[i]);712 backend.tmeshvert(& parc->pts[i]); 713 713 backend.endtfan(); 714 714 … … 723 723 backend.tmeshvert(& parc->pts[parc->npts-1]); 724 724 for(i=0; i<= d2; i++) 725 {726 if(is_u){727 trimVert.param[0] = u_val[i];728 trimVert.param[1] = v;729 }730 else731 {732 trimVert.param[1] = u_val[i];733 trimVert.param[0] = v;734 }735 backend.tmeshvert(&trimVert);736 }725 { 726 if(is_u){ 727 trimVert.param[0] = u_val[i]; 728 trimVert.param[1] = v; 729 } 730 else 731 { 732 trimVert.param[1] = u_val[i]; 733 trimVert.param[0] = v; 734 } 735 backend.tmeshvert(&trimVert); 736 } 737 737 backend.endtfan(); 738 738 … … 744 744 for(i=d1, j=d2; i>=0; i--, j++) 745 745 { 746 backend.tmeshvert(& parc->pts[i]);747 748 if(is_u){749 trimVert.param[0] = u_val[j];750 trimVert.param[1] = v;751 }752 else{753 trimVert.param[1] = u_val[j];754 trimVert.param[0] = v;755 }756 backend.tmeshvert(&trimVert);757 758 759 746 backend.tmeshvert(& parc->pts[i]); 747 748 if(is_u){ 749 trimVert.param[0] = u_val[j]; 750 trimVert.param[1] = v; 751 } 752 else{ 753 trimVert.param[1] = u_val[j]; 754 trimVert.param[0] = v; 755 } 756 backend.tmeshvert(&trimVert); 757 758 759 760 760 } 761 761 backend.endqstrip(); … … 781 781 782 782 if(loop->tail()[1] > loop->prev->prev->tail()[1]) 783 {784 785 top = loop;786 }783 { 784 785 top = loop; 786 } 787 787 else{ 788 788 789 top = loop->prev->prev;790 }789 top = loop->prev->prev; 790 } 791 791 } 792 792 else 793 793 { 794 794 if(loop->tail()[0] > loop->prev->prev->tail()[0]) 795 {796 //loop is the right arc797 798 top = loop->next;799 }795 { 796 //loop is the right arc 797 798 top = loop->next; 799 } 800 800 else 801 {802 803 top = loop->prev;804 }801 { 802 803 top = loop->prev; 804 } 805 805 } 806 806 … … 813 813 left->pwlArc->npts + 814 814 bot->pwlArc->npts + 815 right->pwlArc->npts816 + 2*n_ulines + 2*n_vlines817 -8;815 right->pwlArc->npts 816 + 2*n_ulines + 2*n_vlines 817 -8; 818 818 num_quads += (n_ulines-1)*(n_vlines-1); 819 819 #endif 820 820 /* 821 821 backend.surfgrid(left->tail()[0], right->tail()[0], n_ulines+1, 822 top->tail()[1], bot->tail()[1], n_vlines+1);822 top->tail()[1], bot->tail()[1], n_vlines+1); 823 823 // if(n_ulines>1 && n_vlines>1) 824 824 backend.surfmesh(0,0,n_ulines+1,n_vlines+1); … … 911 911 directedLine *dline = arcToDLine(arc); 912 912 if(ret == NULL) 913 ret = dline;913 ret = dline; 914 914 else 915 ret->insert(dline);915 ret->insert(dline); 916 916 return ret; 917 917 } … … 919 919 { 920 920 for(Int i=0; i<arc->pwlArc->npts-1; i++) 921 {922 Real vert[2][2];923 vert[0][0] = arc->pwlArc->pts[i].param[0];924 vert[0][1] = arc->pwlArc->pts[i].param[1];925 vert[1][0] = arc->pwlArc->pts[i+1].param[0];926 vert[1][1] = arc->pwlArc->pts[i+1].param[1];927 928 sampledLine *sline = new sampledLine(2, vert);929 directedLine *dline = new directedLine(INCREASING, sline);930 if(ret == NULL)931 ret = dline;932 else933 ret->insert(dline);934 }921 { 922 Real vert[2][2]; 923 vert[0][0] = arc->pwlArc->pts[i].param[0]; 924 vert[0][1] = arc->pwlArc->pts[i].param[1]; 925 vert[1][0] = arc->pwlArc->pts[i+1].param[0]; 926 vert[1][1] = arc->pwlArc->pts[i+1].param[1]; 927 928 sampledLine *sline = new sampledLine(2, vert); 929 directedLine *dline = new directedLine(INCREASING, sline); 930 if(ret == NULL) 931 ret = dline; 932 else 933 ret->insert(dline); 934 } 935 935 return ret; 936 936 } … … 938 938 939 939 940 940 941 941 directedLine* arcLoopToDLineLoop(Arc_ptr loop) 942 942 { … … 970 970 rectBlock* block = rbArray->get_element(l); 971 971 for(k=0, i=block->get_upGridLineIndex(); i>block->get_lowGridLineIndex(); i--, k++) 972 {973 974 backend.bgnqstrip();975 for(j=block->get_leftIndices()[k+1]; j<= block->get_rightIndices()[k+1]; j++)976 {977 trimVert->param[0] = u_values[j];978 trimVert->param[1] = v_values[i];979 backend.tmeshvert(trimVert);980 981 trimVert->param[1] = v_values[i-1];982 backend.tmeshvert(trimVert);983 984 }985 backend.endqstrip();986 987 }972 { 973 974 backend.bgnqstrip(); 975 for(j=block->get_leftIndices()[k+1]; j<= block->get_rightIndices()[k+1]; j++) 976 { 977 trimVert->param[0] = u_values[j]; 978 trimVert->param[1] = v_values[i]; 979 backend.tmeshvert(trimVert); 980 981 trimVert->param[1] = v_values[i-1]; 982 backend.tmeshvert(trimVert); 983 984 } 985 backend.endqstrip(); 986 987 } 988 988 } 989 989 … … 1001 1001 //we need counter-clockwise. 1002 1002 backend.surfgrid(grid->get_u_min(), grid->get_u_max(), grid->get_n_ulines()-1, 1003 grid->get_v_max(), grid->get_v_min(), n_vlines-1);1003 grid->get_v_max(), grid->get_v_min(), n_vlines-1); 1004 1004 1005 1005 … … 1011 1011 1012 1012 for(k=0, i=high; i>low; i--, k++) 1013 {1014 backend.surfmesh(block->get_leftIndices()[k+1], n_vlines-1-i, block->get_rightIndices()[k+1]-block->get_leftIndices()[k+1], 1);1015 }1013 { 1014 backend.surfmesh(block->get_leftIndices()[k+1], n_vlines-1-i, block->get_rightIndices()[k+1]-block->get_leftIndices()[k+1], 1); 1015 } 1016 1016 } 1017 1017 } … … 1033 1033 case PRIMITIVE_STREAM_FAN: 1034 1034 1035 backend.bgntfan();1036 1037 for(j=0; j<pStream->get_length(i); j++)1038 { 1039 trimVert->param[0] = vertices[k];1040 trimVert->param[1] = vertices[k+1];1041 backend.tmeshvert(trimVert); 1042 1043 // backend.tmeshvert(vertices[k], vertices[k+1]);1044 k += 2;1045 }1046 backend.endtfan();1047 break;1048 1035 backend.bgntfan(); 1036 1037 for(j=0; j<pStream->get_length(i); j++) 1038 { 1039 trimVert->param[0] = vertices[k]; 1040 trimVert->param[1] = vertices[k+1]; 1041 backend.tmeshvert(trimVert); 1042 1043 // backend.tmeshvert(vertices[k], vertices[k+1]); 1044 k += 2; 1045 } 1046 backend.endtfan(); 1047 break; 1048 1049 1049 default: 1050 fprintf(stderr, "evalStream: not implemented yet\n");1051 exit(1);1050 fprintf(stderr, "evalStream: not implemented yet\n"); 1051 exit(1); 1052 1052 1053 1053 } … … 1055 1055 free(trimVert); 1056 1056 } 1057 1058 1059 1057 1058 1059 1060 1060 1061 1061 void Slicer::slice_new(Arc_ptr loop) … … 1107 1107 { 1108 1108 if(vlinear) 1109 triangulateRect(loop, backend, 1, ulinear, vlinear);1109 triangulateRect(loop, backend, 1, ulinear, vlinear); 1110 1110 else if(ulinear) 1111 triangulateRect(loop, backend, -1, ulinear, vlinear); 1111 triangulateRect(loop, backend, -1, ulinear, vlinear); 1112 1112 else 1113 triangulateRect(loop, backend, 0, ulinear, vlinear); 1113 triangulateRect(loop, backend, 0, ulinear, vlinear); 1114 1114 } 1115 1115 … … 1151 1151 printf("num_quads = %i\n", num_quads); 1152 1152 #endif 1153 1153 1154 } 1154 1155 … … 1170 1171 1171 1172 Slicer::Slicer( Backend &b ) 1172 : CoveAndTiler( b ), Mesher( b ), backend( b )1173 : CoveAndTiler( b ), Mesher( b ), backend( b ) 1173 1174 { 1174 1175 ulinear = 0; … … 1219 1220 1220 1221 for( long quad=0; quad<varray.numquads; quad++ ) { 1221 backend.surfgrid( uarray.uarray[0],1222 uarray.uarray[ulines-1],1223 ulines-1,1224 varray.vval[quad],1225 varray.vval[quad+1],1226 varray.voffset[quad+1] - varray.voffset[quad] );1227 1228 for( long i=varray.voffset[quad]+1; i <= varray.voffset[quad+1]; i++ ) {1229 topv = botv++;1230 advance( topv - varray.voffset[quad],1231 botv - varray.voffset[quad],1232 varray.varray[botv] );1233 if( i == vlines )1234 getPts( extrema[2] );1235 else1236 getPts( backend );1237 getGridExtent();1222 backend.surfgrid( uarray.uarray[0], 1223 uarray.uarray[ulines-1], 1224 ulines-1, 1225 varray.vval[quad], 1226 varray.vval[quad+1], 1227 varray.voffset[quad+1] - varray.voffset[quad] ); 1228 1229 for( long i=varray.voffset[quad]+1; i <= varray.voffset[quad+1]; i++ ) { 1230 topv = botv++; 1231 advance( topv - varray.voffset[quad], 1232 botv - varray.voffset[quad], 1233 varray.varray[botv] ); 1234 if( i == vlines ) 1235 getPts( extrema[2] ); 1236 else 1237 getPts( backend ); 1238 getGridExtent(); 1238 1239 if( isolines ) { 1239 outline();1240 } else {1241 if( canTile() )1242 coveAndTile();1243 else1244 mesh();1245 }1240 outline(); 1241 } else { 1242 if( canTile() ) 1243 coveAndTile(); 1244 else 1245 mesh(); 1246 } 1246 1247 } 1247 1248 } … … 1257 1258 backend.bgnoutline(); 1258 1259 while( (nextupper( &upper )) ) { 1259 if( upper.isGridVert() )1260 backend.linevert( upper.g );1261 else1262 backend.linevert( upper.t );1260 if( upper.isGridVert() ) 1261 backend.linevert( upper.g ); 1262 else 1263 backend.linevert( upper.t ); 1263 1264 } 1264 1265 backend.endoutline(); … … 1266 1267 backend.bgnoutline(); 1267 1268 while( (nextlower( &lower )) ) { 1268 if( lower.isGridVert() )1269 backend.linevert( lower.g );1270 else1271 backend.linevert( lower.t );1269 if( lower.isGridVert() ) 1270 backend.linevert( lower.g ); 1271 else 1272 backend.linevert( lower.t ); 1272 1273 } 1273 1274 backend.endoutline(); … … 1281 1282 1282 1283 if( jarc->pwlArc->npts >= 2 ) { 1283 backend.bgnoutline();1284 for( int j = jarc->pwlArc->npts-1; j >= 0; j-- )1285 backend.linevert( &(jarc->pwlArc->pts[j]) );1286 backend.endoutline();1287 } 1288 } 1289 1290 1284 backend.bgnoutline(); 1285 for( int j = jarc->pwlArc->npts-1; j >= 0; j-- ) 1286 backend.linevert( &(jarc->pwlArc->pts[j]) ); 1287 backend.endoutline(); 1288 } 1289 } 1290 1291 -
trunk/src/opengl/glu/tess/tess.c
r2689 r3079 1 /* $Id: tess.c,v 1. 1 2000-02-09 08:47:38jeroen Exp $ */1 /* $Id: tess.c,v 1.2 2000-03-11 09:05:04 jeroen Exp $ */ 2 2 /* 3 3 ** License Applicability. Except to the extent portions of this file are … … 37 37 ** Author: Eric Veach, July 1994. 38 38 ** 39 ** $Date: 2000-0 2-09 08:47:38 $ $Revision: 1.1$40 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/tess/tess.c,v 1. 1 2000-02-09 08:47:38jeroen Exp $39 ** $Date: 2000-03-11 09:05:04 $ $Revision: 1.2 $ 40 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/tess/tess.c,v 1.2 2000-03-11 09:05:04 jeroen Exp $ 41 41 */ 42 42 … … 59 59 #define FALSE 0 60 60 61 /*ARGSUSED*/ static void GL APInoBegin( GLenum type ) {}62 /*ARGSUSED*/ static void GL APInoEdgeFlag( GLboolean boundaryEdge ) {}63 /*ARGSUSED*/ static void GL APInoVertex( void *data ) {}64 /*ARGSUSED*/ static void GL APInoEnd( void ) {}65 /*ARGSUSED*/ static void GL APInoError( GLenum errnum ) {}66 /*ARGSUSED*/ static void GL APInoCombine( GLdouble coords[3], void *data[4],61 /*ARGSUSED*/ static void GLCALLBACK noBegin( GLenum type ) {} 62 /*ARGSUSED*/ static void GLCALLBACK noEdgeFlag( GLboolean boundaryEdge ) {} 63 /*ARGSUSED*/ static void GLCALLBACK noVertex( void *data ) {} 64 /*ARGSUSED*/ static void GLCALLBACK noEnd( void ) {} 65 /*ARGSUSED*/ static void GLCALLBACK noError( GLenum errnum ) {} 66 /*ARGSUSED*/ static void GLCALLBACK noCombine( GLdouble coords[3], void *data[4], 67 67 GLfloat weight[4], void **dataOut ) {} 68 /*ARGSUSED*/ static void GL APInoMesh( GLUmesh *mesh ) {}69 70 71 /*ARGSUSED*/ void GLAPI__gl_noBeginData( GLenum type,68 /*ARGSUSED*/ static void GLCALLBACK noMesh( GLUmesh *mesh ) {} 69 70 71 /*ARGSUSED*/ void __gl_noBeginData( GLenum type, 72 72 void *polygonData ) {} 73 /*ARGSUSED*/ void GLAPI__gl_noEdgeFlagData( GLboolean boundaryEdge,73 /*ARGSUSED*/ void __gl_noEdgeFlagData( GLboolean boundaryEdge, 74 74 void *polygonData ) {} 75 /*ARGSUSED*/ void GLAPI__gl_noVertexData( void *data,75 /*ARGSUSED*/ void __gl_noVertexData( void *data, 76 76 void *polygonData ) {} 77 /*ARGSUSED*/ void GLAPI__gl_noEndData( void *polygonData ) {}78 /*ARGSUSED*/ void GLAPI__gl_noErrorData( GLenum errnum,77 /*ARGSUSED*/ void __gl_noEndData( void *polygonData ) {} 78 /*ARGSUSED*/ void __gl_noErrorData( GLenum errnum, 79 79 void *polygonData ) {} 80 /*ARGSUSED*/ void GLAPI__gl_noCombineData( GLdouble coords[3],80 /*ARGSUSED*/ void __gl_noCombineData( GLdouble coords[3], 81 81 void *data[4], 82 82 GLfloat weight[4], … … 105 105 106 106 if (memInit( MAX_FAST_ALLOC ) == 0) { 107 return 0; /* out of memory */107 return 0; /* out of memory */ 108 108 } 109 109 tess = (GLUtesselator *)memAlloc( sizeof( GLUtesselator )); 110 110 if (tess == NULL) { 111 return 0; /* out of memory */111 return 0; /* out of memory */ 112 112 } 113 113 … … 167 167 switch( tess->state ) { 168 168 case T_DORMANT: 169 CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_BEGIN_POLYGON );170 gluTessBeginPolygon( tess, NULL );171 break;169 CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_BEGIN_POLYGON ); 170 gluTessBeginPolygon( tess, NULL ); 171 break; 172 172 case T_IN_POLYGON: 173 CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_BEGIN_CONTOUR );174 gluTessBeginContour( tess );175 break;173 CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_BEGIN_CONTOUR ); 174 gluTessBeginContour( tess ); 175 break; 176 176 } 177 177 } else { 178 178 switch( tess->state ) { 179 179 case T_IN_CONTOUR: 180 CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_END_CONTOUR );181 gluTessEndContour( tess );182 break;180 CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_END_CONTOUR ); 181 gluTessEndContour( tess ); 182 break; 183 183 case T_IN_POLYGON: 184 CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_END_POLYGON );185 /* gluTessEndPolygon( tess ) is too much work! */186 MakeDormant( tess );187 break;184 CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_END_POLYGON ); 185 /* gluTessEndPolygon( tess ) is too much work! */ 186 MakeDormant( tess ); 187 break; 188 188 } 189 189 } … … 192 192 193 193 194 void GLAPI 194 GLUAPI void GLAPIENTRY 195 195 gluDeleteTess( GLUtesselator *tess ) 196 196 { … … 200 200 201 201 202 void GLAPI 202 GLUAPI void GLAPIENTRY 203 203 gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value ) 204 204 { … … 213 213 case GLU_TESS_WINDING_RULE: 214 214 windingRule = (GLenum) value; 215 if( windingRule != value ) break; /* not an integer */215 if( windingRule != value ) break; /* not an integer */ 216 216 217 217 switch( windingRule ) { … … 239 239 240 240 /* Returns tessellator property */ 241 void GLAPI 241 GLUAPI void GLAPIENTRY 242 242 gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value ) 243 243 { … … 250 250 case GLU_TESS_WINDING_RULE: 251 251 assert(tess->windingRule == GLU_TESS_WINDING_ODD || 252 tess->windingRule == GLU_TESS_WINDING_NONZERO ||253 tess->windingRule == GLU_TESS_WINDING_POSITIVE ||254 tess->windingRule == GLU_TESS_WINDING_NEGATIVE ||255 tess->windingRule == GLU_TESS_WINDING_ABS_GEQ_TWO);252 tess->windingRule == GLU_TESS_WINDING_NONZERO || 253 tess->windingRule == GLU_TESS_WINDING_POSITIVE || 254 tess->windingRule == GLU_TESS_WINDING_NEGATIVE || 255 tess->windingRule == GLU_TESS_WINDING_ABS_GEQ_TWO); 256 256 *value= tess->windingRule; 257 257 break; … … 267 267 } /* gluGetTessProperty() */ 268 268 269 void GLAPI 269 GLUAPI void GLAPIENTRY 270 270 gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z ) 271 271 { … … 275 275 } 276 276 277 void GLAPI 278 gluTessCallback( GLUtesselator *tess, GLenum which, void (GL API*fn)())277 GLUAPI void GLAPIENTRY 278 gluTessCallback( GLUtesselator *tess, GLenum which, void (GLCALLBACK *fn)()) 279 279 { 280 280 switch( which ) { 281 281 case GLU_TESS_BEGIN: 282 tess->callBegin = (fn == NULL) ? &noBegin : (void (GL API*)(GLenum)) fn;282 tess->callBegin = (fn == NULL) ? &noBegin : (void (GLCALLBACK *)(GLenum)) fn; 283 283 return; 284 284 case GLU_TESS_BEGIN_DATA: 285 285 tess->callBeginData = (fn == NULL) ? 286 &__gl_noBeginData : (void (GLAPI*)(GLenum, void *)) fn;286 &__gl_noBeginData : (void (GLCALLBACK *)(GLenum, void *)) fn; 287 287 return; 288 288 case GLU_TESS_EDGE_FLAG: 289 289 tess->callEdgeFlag = (fn == NULL) ? &noEdgeFlag : 290 (void (GLAPI*)(GLboolean)) fn;290 (void (GLCALLBACK *)(GLboolean)) fn; 291 291 /* If the client wants boundary edges to be flagged, 292 292 * we render everything as separate triangles (no strips or fans). … … 296 296 case GLU_TESS_EDGE_FLAG_DATA: 297 297 tess->callEdgeFlagData= (fn == NULL) ? 298 &__gl_noEdgeFlagData : (void (GLAPI*)(GLboolean, void *)) fn;298 &__gl_noEdgeFlagData : (void (GLCALLBACK *)(GLboolean, void *)) fn; 299 299 /* If the client wants boundary edges to be flagged, 300 300 * we render everything as separate triangles (no strips or fans). … … 304 304 case GLU_TESS_VERTEX: 305 305 tess->callVertex = (fn == NULL) ? &noVertex : 306 (void (GLAPI*)(void *)) fn;306 (void (GLCALLBACK *)(void *)) fn; 307 307 return; 308 308 case GLU_TESS_VERTEX_DATA: 309 309 tess->callVertexData = (fn == NULL) ? 310 &__gl_noVertexData : (void (GLAPI*)(void *, void *)) fn;310 &__gl_noVertexData : (void (GLCALLBACK *)(void *, void *)) fn; 311 311 return; 312 312 case GLU_TESS_END: 313 tess->callEnd = (fn == NULL) ? &noEnd : (void (GL API*)(void)) fn;313 tess->callEnd = (fn == NULL) ? &noEnd : (void (GLCALLBACK *)(void)) fn; 314 314 return; 315 315 case GLU_TESS_END_DATA: 316 316 tess->callEndData = (fn == NULL) ? &__gl_noEndData : 317 (void (GL API*)(void *)) fn;317 (void (GLCALLBACK *)(void *)) fn; 318 318 return; 319 319 case GLU_TESS_ERROR: 320 tess->callError = (fn == NULL) ? &noError : (void (GL API*)(GLenum)) fn;320 tess->callError = (fn == NULL) ? &noError : (void (GLCALLBACK *)(GLenum)) fn; 321 321 return; 322 322 case GLU_TESS_ERROR_DATA: 323 323 tess->callErrorData = (fn == NULL) ? 324 &__gl_noErrorData : (void (GLAPI*)(GLenum, void *)) fn;324 &__gl_noErrorData : (void (GLCALLBACK *)(GLenum, void *)) fn; 325 325 return; 326 326 case GLU_TESS_COMBINE: 327 327 tess->callCombine = (fn == NULL) ? &noCombine : 328 (void (GLAPI*)(GLdouble [3],void *[4], GLfloat [4], void ** )) fn;328 (void (GLCALLBACK *)(GLdouble [3],void *[4], GLfloat [4], void ** )) fn; 329 329 return; 330 330 case GLU_TESS_COMBINE_DATA: 331 331 tess->callCombineData = (fn == NULL) ? &__gl_noCombineData : 332 (void (GL API*)(GLdouble [3],333 void *[4],334 GLfloat [4],335 void **,336 void *)) fn;332 (void (GLCALLBACK *)(GLdouble [3], 333 void *[4], 334 GLfloat [4], 335 void **, 336 void *)) fn; 337 337 return; 338 338 case GLU_TESS_MESH: 339 tess->callMesh = (fn == NULL) ? &noMesh : (void (GL API*)(GLUmesh *)) fn;339 tess->callMesh = (fn == NULL) ? &noMesh : (void (GLCALLBACK *)(GLUmesh *)) fn; 340 340 return; 341 341 default: … … 414 414 415 415 416 void GLAPI 416 GLUAPI void GLAPIENTRY 417 417 gluTessVertex( GLUtesselator *tess, GLdouble coords[3], void *data ) 418 418 { … … 461 461 462 462 463 void GLAPI 463 GLUAPI void GLAPIENTRY 464 464 gluTessBeginPolygon( GLUtesselator *tess, void *data ) 465 465 { … … 475 475 476 476 477 void GLAPI 477 GLUAPI void GLAPIENTRY 478 478 gluTessBeginContour( GLUtesselator *tess ) 479 479 { … … 492 492 493 493 494 void GLAPI 494 GLUAPI void GLAPIENTRY 495 495 gluTessEndContour( GLUtesselator *tess ) 496 496 { … … 499 499 } 500 500 501 void GLAPI 501 GLUAPI void GLAPIENTRY 502 502 gluTessEndPolygon( GLUtesselator *tess ) 503 503 { 504 504 GLUmesh *mesh; 505 505 506 if (setjmp(tess->env) != 0) { 506 if (setjmp(tess->env) != 0) { 507 507 /* come back here if out of memory */ 508 508 CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); … … 522 522 */ 523 523 if( __gl_renderCache( tess )) { 524 tess->polygonData= NULL;525 return;524 tess->polygonData= NULL; 525 return; 526 526 } 527 527 } … … 541 541 */ 542 542 if ( !__gl_computeInterior( tess ) ) { 543 longjmp(tess->env,1); /* could've used a label */543 longjmp(tess->env,1); /* could've used a label */ 544 544 } 545 545 … … 557 557 rc = __gl_meshTessellateInterior( mesh ); 558 558 } 559 if (rc == 0) longjmp(tess->env,1); /* could've used a label */559 if (rc == 0) longjmp(tess->env,1); /* could've used a label */ 560 560 561 561 __gl_meshCheckMesh( mesh ); … … 569 569 { 570 570 if( tess->boundaryOnly ) { 571 __gl_renderBoundary( tess, mesh ); /* output boundary contours */571 __gl_renderBoundary( tess, mesh ); /* output boundary contours */ 572 572 } else { 573 __gl_renderMesh( tess, mesh );/* output strips and fans */573 __gl_renderMesh( tess, mesh ); /* output strips and fans */ 574 574 } 575 575 } … … 583 583 */ 584 584 __gl_meshDiscardExterior( mesh ); 585 (*tess->callMesh)( mesh ); /* user wants the mesh itself */585 (*tess->callMesh)( mesh ); /* user wants the mesh itself */ 586 586 tess->mesh = NULL; 587 587 tess->polygonData= NULL; … … 595 595 596 596 597 void GLAPI 597 GLUAPI void GLAPIENTRY 598 598 gluDeleteMesh( GLUmesh *mesh ) 599 599 { … … 607 607 /* Obsolete calls -- for backward compatibility */ 608 608 609 void GLAPI 609 GLUAPI void GLAPIENTRY 610 610 gluBeginPolygon( GLUtesselator *tess ) 611 611 { … … 616 616 617 617 /*ARGSUSED*/ 618 void GLAPI 618 GLUAPI void GLAPIENTRY 619 619 gluNextContour( GLUtesselator *tess, GLenum type ) 620 620 { … … 624 624 625 625 626 void GLAPI 626 GLUAPI void GLAPIENTRY 627 627 gluEndPolygon( GLUtesselator *tess ) 628 628 { -
trunk/src/opengl/glu/tess/tess.h
r2689 r3079 1 /* $Id: tess.h,v 1. 1 2000-02-09 08:47:38jeroen Exp $ */1 /* $Id: tess.h,v 1.2 2000-03-11 09:05:04 jeroen Exp $ */ 2 2 /* 3 3 ** License Applicability. Except to the extent portions of this file are … … 37 37 ** Author: Eric Veach, July 1994. 38 38 ** 39 ** $Date: 2000-0 2-09 08:47:38 $ $Revision: 1.1$40 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/tess/tess.h,v 1. 1 2000-02-09 08:47:38jeroen Exp $39 ** $Date: 2000-03-11 09:05:04 $ $Revision: 1.2 $ 40 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/tess/tess.h,v 1.2 2000-03-11 09:05:04 jeroen Exp $ 41 41 */ 42 42 … … 58 58 * try a quick-and-dirty decomposition first. 59 59 */ 60 #define TESS_MAX_CACHE 10060 #define TESS_MAX_CACHE 100 61 61 62 62 typedef struct CachedVertex { 63 GLdouble coords[3];64 void *data;63 GLdouble coords[3]; 64 void *data; 65 65 } CachedVertex; 66 66 … … 69 69 /*** state needed for collecting the input data ***/ 70 70 71 enum TessState state; /* what begin/end calls have we seen? */71 enum TessState state; /* what begin/end calls have we seen? */ 72 72 73 GLUhalfEdge *lastEdge;/* lastEdge->Org is the most recent vertex */74 GLUmesh *mesh;/* stores the input contours, and eventually73 GLUhalfEdge *lastEdge; /* lastEdge->Org is the most recent vertex */ 74 GLUmesh *mesh; /* stores the input contours, and eventually 75 75 the tessellation itself */ 76 76 77 void (GLAPI*callError)( GLenum errnum );77 void (GLCALLBACK *callError)( GLenum errnum ); 78 78 79 79 /*** state needed for projecting onto the sweep plane ***/ 80 80 81 GLdouble normal[3];/* user-specified normal (if provided) */82 GLdouble sUnit[3];/* unit vector in s-direction (debugging) */83 GLdouble tUnit[3];/* unit vector in t-direction (debugging) */81 GLdouble normal[3]; /* user-specified normal (if provided) */ 82 GLdouble sUnit[3]; /* unit vector in s-direction (debugging) */ 83 GLdouble tUnit[3]; /* unit vector in t-direction (debugging) */ 84 84 85 85 /*** state needed for the line sweep ***/ 86 86 87 GLdouble relTolerance;/* tolerance for merging features */88 GLenum windingRule;/* rule for determining polygon interior */89 GLboolean fatalError;/* fatal error: needed combine callback */87 GLdouble relTolerance; /* tolerance for merging features */ 88 GLenum windingRule; /* rule for determining polygon interior */ 89 GLboolean fatalError; /* fatal error: needed combine callback */ 90 90 91 Dict *dict;/* edge dictionary for sweep line */92 PriorityQ *pq;/* priority queue of vertex events */93 GLUvertex *event;/* current sweep event being processed */91 Dict *dict; /* edge dictionary for sweep line */ 92 PriorityQ *pq; /* priority queue of vertex events */ 93 GLUvertex *event; /* current sweep event being processed */ 94 94 95 void (GLAPI*callCombine)( GLdouble coords[3], void *data[4],96 GLfloat weight[4], void **outData );95 void (GLCALLBACK *callCombine)( GLdouble coords[3], void *data[4], 96 GLfloat weight[4], void **outData ); 97 97 98 98 /*** state needed for rendering callbacks (see render.c) ***/ 99 99 100 GLboolean flagBoundary; /* mark boundary edges (use EdgeFlag)*/101 GLboolean boundaryOnly; /* Extract contours, not triangles*/102 GLUface *lonelyTriList;100 GLboolean flagBoundary; /* mark boundary edges (use EdgeFlag)*/ 101 GLboolean boundaryOnly; /* Extract contours, not triangles */ 102 GLUface *lonelyTriList; 103 103 /* list of triangles which could not be rendered as strips or fans */ 104 104 105 void (GLAPI*callBegin)( GLenum type );106 void (GLAPI*callEdgeFlag)( GLboolean boundaryEdge );107 void (GLAPI*callVertex)( void *data );108 void (GLAPI*callEnd)( void );109 void (GLAPI*callMesh)( GLUmesh *mesh );105 void (GLCALLBACK *callBegin)( GLenum type ); 106 void (GLCALLBACK *callEdgeFlag)( GLboolean boundaryEdge ); 107 void (GLCALLBACK *callVertex)( void *data ); 108 void (GLCALLBACK *callEnd)( void ); 109 void (GLCALLBACK *callMesh)( GLUmesh *mesh ); 110 110 111 111 112 112 /*** state needed to cache single-contour polygons for renderCache() */ 113 113 114 GLboolean emptyCache; /* empty cache on next vertex() call*/115 int cacheCount; /* number of cached vertices*/116 CachedVertex cache[TESS_MAX_CACHE]; /* the vertex data*/114 GLboolean emptyCache; /* empty cache on next vertex() call*/ 115 int cacheCount; /* number of cached vertices */ 116 CachedVertex cache[TESS_MAX_CACHE]; /* the vertex data */ 117 117 118 118 /*** rendering callbacks that also pass polygon data ***/ 119 void (GLAPI*callBeginData)( GLenum type, void *polygonData );120 void (GLAPI*callEdgeFlagData)( GLboolean boundaryEdge,121 void *polygonData );122 void (GLAPI*callVertexData)( void *data, void *polygonData );123 void (GLAPI*callEndData)( void *polygonData );124 void (GLAPI*callErrorData)( GLenum errnum, void *polygonData );125 void (GLAPI*callCombineData)( GLdouble coords[3], void *data[4],126 GLfloat weight[4], void **outData,127 void *polygonData );119 void (GLCALLBACK *callBeginData)( GLenum type, void *polygonData ); 120 void (GLCALLBACK *callEdgeFlagData)( GLboolean boundaryEdge, 121 void *polygonData ); 122 void (GLCALLBACK *callVertexData)( void *data, void *polygonData ); 123 void (GLCALLBACK *callEndData)( void *polygonData ); 124 void (GLCALLBACK *callErrorData)( GLenum errnum, void *polygonData ); 125 void (GLCALLBACK *callCombineData)( GLdouble coords[3], void *data[4], 126 GLfloat weight[4], void **outData, 127 void *polygonData ); 128 128 129 jmp_buf env; /* place to jump to when memAllocs fail*/129 jmp_buf env; /* place to jump to when memAllocs fail*/ 130 130 131 void *polygonData; /* client data for current polygon*/131 void *polygonData; /* client data for current polygon*/ 132 132 }; 133 133 134 void GL API__gl_noBeginData( GLenum type, void *polygonData );135 void GL API__gl_noEdgeFlagData( GLboolean boundaryEdge, void *polygonData );136 void GL API__gl_noVertexData( void *data, void *polygonData );137 void GL API__gl_noEndData( void *polygonData );138 void GL API__gl_noErrorData( GLenum errnum, void *polygonData );139 void GL API__gl_noCombineData( GLdouble coords[3], void *data[4],140 GLfloat weight[4], void **outData,141 void *polygonData );134 void GLCALLBACK __gl_noBeginData( GLenum type, void *polygonData ); 135 void GLCALLBACK __gl_noEdgeFlagData( GLboolean boundaryEdge, void *polygonData ); 136 void GLCALLBACK __gl_noVertexData( void *data, void *polygonData ); 137 void GLCALLBACK __gl_noEndData( void *polygonData ); 138 void GLCALLBACK __gl_noErrorData( GLenum errnum, void *polygonData ); 139 void GLCALLBACK __gl_noCombineData( GLdouble coords[3], void *data[4], 140 GLfloat weight[4], void **outData, 141 void *polygonData ); 142 142 143 143 #define CALL_BEGIN_OR_BEGIN_DATA(a) \ -
trunk/src/opengl/glu/util/quad.c
r2689 r3079 1 /* $Id: quad.c,v 1. 1 2000-02-09 08:47:14 jeroen Exp $ */1 /* $Id: quad.c,v 1.2 2000-03-11 09:05:04 jeroen Exp $ */ 2 2 /* 3 3 ** License Applicability. Except to the extent portions of this file are … … 33 33 ** compliant with the OpenGL(R) version 1.2.1 Specification. 34 34 ** 35 ** $Date: 2000-0 2-09 08:47:14 $ $Revision: 1.1$36 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/util/quad.c,v 1. 1 2000-02-09 08:47:14 jeroen Exp $35 ** $Date: 2000-03-11 09:05:04 $ $Revision: 1.2 $ 36 ** $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/opengl/glu/util/quad.c,v 1.2 2000-03-11 09:05:04 jeroen Exp $ 37 37 */ 38 38 … … 55 55 GLint orientation; 56 56 GLint drawStyle; 57 void (GL API*errorCallback)( GLint );57 void (GLCALLBACK *errorCallback)( GLint ); 58 58 }; 59 59 … … 65 65 newstate = (GLUquadric *) malloc(sizeof(GLUquadric)); 66 66 if (newstate == NULL) { 67 /* Can't report an error at this point... */68 return NULL;67 /* Can't report an error at this point... */ 68 return NULL; 69 69 } 70 70 newstate->normals = GLU_SMOOTH; … … 86 86 { 87 87 if (qobj->errorCallback) { 88 qobj->errorCallback(which);88 qobj->errorCallback(which); 89 89 } 90 90 } 91 91 92 92 void GLAPI 93 gluQuadricCallback(GLUquadric *qobj, GLenum which, void (GL API*fn)())93 gluQuadricCallback(GLUquadric *qobj, GLenum which, void (GLCALLBACK *fn)()) 94 94 { 95 95 switch (which) { 96 96 case GLU_ERROR: 97 qobj->errorCallback = (void (GLAPI*)(GLint)) fn;98 break;97 qobj->errorCallback = (void (GLCALLBACK *)(GLint)) fn; 98 break; 99 99 default: 100 gluQuadricError(qobj, GLU_INVALID_ENUM);101 return;100 gluQuadricError(qobj, GLU_INVALID_ENUM); 101 return; 102 102 } 103 103 } … … 110 110 case GLU_FLAT: 111 111 case GLU_NONE: 112 break;112 break; 113 113 default: 114 gluQuadricError(qobj, GLU_INVALID_ENUM);115 return;114 gluQuadricError(qobj, GLU_INVALID_ENUM); 115 return; 116 116 } 117 117 qobj->normals = normals; … … 130 130 case GLU_OUTSIDE: 131 131 case GLU_INSIDE: 132 break;132 break; 133 133 default: 134 gluQuadricError(qobj, GLU_INVALID_ENUM);135 return;134 gluQuadricError(qobj, GLU_INVALID_ENUM); 135 return; 136 136 } 137 137 qobj->orientation = orientation; … … 146 146 case GLU_FILL: 147 147 case GLU_SILHOUETTE: 148 break;148 break; 149 149 default: 150 gluQuadricError(qobj, GLU_INVALID_ENUM);151 return;150 gluQuadricError(qobj, GLU_INVALID_ENUM); 151 return; 152 152 } 153 153 qobj->drawStyle = drawStyle; … … 156 156 void GLAPI 157 157 gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, 158 GLdouble height, GLint slices, GLint stacks)158 GLdouble height, GLint slices, GLint stacks) 159 159 { 160 160 GLint i,j,max; … … 178 178 179 179 if (slices < 2 || stacks < 1 || baseRadius < 0.0 || topRadius < 0.0 || 180 height < 0.0) {181 gluQuadricError(qobj, GLU_INVALID_VALUE);182 return;180 height < 0.0) { 181 gluQuadricError(qobj, GLU_INVALID_VALUE); 182 return; 183 183 } 184 184 … … 187 187 length = SQRT(deltaRadius*deltaRadius + height*height); 188 188 if (length == 0.0) { 189 gluQuadricError(qobj, GLU_INVALID_VALUE);190 return;189 gluQuadricError(qobj, GLU_INVALID_VALUE); 190 return; 191 191 } 192 192 … … 196 196 needCache2 = needCache3 = 0; 197 197 if (qobj->normals == GLU_SMOOTH) { 198 needCache2 = 1;198 needCache2 = 1; 199 199 } 200 200 201 201 if (qobj->normals == GLU_FLAT) { 202 if (qobj->drawStyle != GLU_POINT) {203 needCache3 = 1;204 }205 if (qobj->drawStyle == GLU_LINE) {206 needCache2 = 1;207 }202 if (qobj->drawStyle != GLU_POINT) { 203 needCache3 = 1; 204 } 205 if (qobj->drawStyle == GLU_LINE) { 206 needCache2 = 1; 207 } 208 208 } 209 209 … … 212 212 213 213 for (i = 0; i < slices; i++) { 214 angle = 2 * PI * i / slices;215 if (needCache2) {216 if (qobj->orientation == GLU_OUTSIDE) {217 sinCache2[i] = xyNormalRatio * SIN(angle);218 cosCache2[i] = xyNormalRatio * COS(angle);219 } else {220 sinCache2[i] = -xyNormalRatio * SIN(angle);221 cosCache2[i] = -xyNormalRatio * COS(angle);222 }223 }224 sinCache[i] = SIN(angle);225 cosCache[i] = COS(angle);214 angle = 2 * PI * i / slices; 215 if (needCache2) { 216 if (qobj->orientation == GLU_OUTSIDE) { 217 sinCache2[i] = xyNormalRatio * SIN(angle); 218 cosCache2[i] = xyNormalRatio * COS(angle); 219 } else { 220 sinCache2[i] = -xyNormalRatio * SIN(angle); 221 cosCache2[i] = -xyNormalRatio * COS(angle); 222 } 223 } 224 sinCache[i] = SIN(angle); 225 cosCache[i] = COS(angle); 226 226 } 227 227 228 228 if (needCache3) { 229 for (i = 0; i < slices; i++) {230 angle = 2 * PI * (i-0.5) / slices;231 if (qobj->orientation == GLU_OUTSIDE) {232 sinCache3[i] = xyNormalRatio * SIN(angle);233 cosCache3[i] = xyNormalRatio * COS(angle);234 } else {235 sinCache3[i] = -xyNormalRatio * SIN(angle);236 cosCache3[i] = -xyNormalRatio * COS(angle);237 }238 }229 for (i = 0; i < slices; i++) { 230 angle = 2 * PI * (i-0.5) / slices; 231 if (qobj->orientation == GLU_OUTSIDE) { 232 sinCache3[i] = xyNormalRatio * SIN(angle); 233 cosCache3[i] = xyNormalRatio * COS(angle); 234 } else { 235 sinCache3[i] = -xyNormalRatio * SIN(angle); 236 cosCache3[i] = -xyNormalRatio * COS(angle); 237 } 238 } 239 239 } 240 240 … … 242 242 cosCache[slices] = cosCache[0]; 243 243 if (needCache2) { 244 sinCache2[slices] = sinCache2[0];245 cosCache2[slices] = cosCache2[0];244 sinCache2[slices] = sinCache2[0]; 245 cosCache2[slices] = cosCache2[0]; 246 246 } 247 247 if (needCache3) { 248 sinCache3[slices] = sinCache3[0];249 cosCache3[slices] = cosCache3[0];248 sinCache3[slices] = sinCache3[0]; 249 cosCache3[slices] = cosCache3[0]; 250 250 } 251 251 252 252 switch (qobj->drawStyle) { 253 253 case GLU_FILL: 254 /* Note:255 ** An argument could be made for using a TRIANGLE_FAN for the end256 ** of the cylinder of either radii is 0.0 (a cone). However, a257 ** TRIANGLE_FAN would not work in smooth shading mode (the common258 ** case) because the normal for the apex is different for every259 ** triangle (and TRIANGLE_FAN doesn't let me respecify that normal).260 ** Now, my choice is GL_TRIANGLES, or leave the GL_QUAD_STRIP and261 ** just let the GL trivially reject one of the two triangles of the262 ** QUAD. GL_QUAD_STRIP is probably faster, so I will leave this code263 ** alone.264 */265 for (j = 0; j < stacks; j++) {266 zLow = j * height / stacks;267 zHigh = (j + 1) * height / stacks;268 radiusLow = baseRadius - deltaRadius * ((float) j / stacks);269 radiusHigh = baseRadius - deltaRadius * ((float) (j + 1) / stacks);270 271 glBegin(GL_QUAD_STRIP);272 for (i = 0; i <= slices; i++) {273 switch(qobj->normals) {274 case GLU_FLAT:275 glNormal3f(sinCache3[i], cosCache3[i], zNormal);276 break;277 case GLU_SMOOTH:278 glNormal3f(sinCache2[i], cosCache2[i], zNormal);279 break;280 case GLU_NONE:281 default:282 break;283 }284 if (qobj->orientation == GLU_OUTSIDE) {285 if (qobj->textureCoords) {286 glTexCoord2f(1 - (float) i / slices,287 (float) j / stacks);288 }289 glVertex3f(radiusLow * sinCache[i],290 radiusLow * cosCache[i], zLow);291 if (qobj->textureCoords) {292 glTexCoord2f(1 - (float) i / slices,293 (float) (j+1) / stacks);294 }295 glVertex3f(radiusHigh * sinCache[i],296 radiusHigh * cosCache[i], zHigh);297 } else {298 if (qobj->textureCoords) {299 glTexCoord2f(1 - (float) i / slices,300 (float) (j+1) / stacks);301 }302 glVertex3f(radiusHigh * sinCache[i],303 radiusHigh * cosCache[i], zHigh);304 if (qobj->textureCoords) {305 glTexCoord2f(1 - (float) i / slices,306 (float) j / stacks);307 }308 glVertex3f(radiusLow * sinCache[i],309 radiusLow * cosCache[i], zLow);310 }311 }312 glEnd();313 }314 break;254 /* Note: 255 ** An argument could be made for using a TRIANGLE_FAN for the end 256 ** of the cylinder of either radii is 0.0 (a cone). However, a 257 ** TRIANGLE_FAN would not work in smooth shading mode (the common 258 ** case) because the normal for the apex is different for every 259 ** triangle (and TRIANGLE_FAN doesn't let me respecify that normal). 260 ** Now, my choice is GL_TRIANGLES, or leave the GL_QUAD_STRIP and 261 ** just let the GL trivially reject one of the two triangles of the 262 ** QUAD. GL_QUAD_STRIP is probably faster, so I will leave this code 263 ** alone. 264 */ 265 for (j = 0; j < stacks; j++) { 266 zLow = j * height / stacks; 267 zHigh = (j + 1) * height / stacks; 268 radiusLow = baseRadius - deltaRadius * ((float) j / stacks); 269 radiusHigh = baseRadius - deltaRadius * ((float) (j + 1) / stacks); 270 271 glBegin(GL_QUAD_STRIP); 272 for (i = 0; i <= slices; i++) { 273 switch(qobj->normals) { 274 case GLU_FLAT: 275 glNormal3f(sinCache3[i], cosCache3[i], zNormal); 276 break; 277 case GLU_SMOOTH: 278 glNormal3f(sinCache2[i], cosCache2[i], zNormal); 279 break; 280 case GLU_NONE: 281 default: 282 break; 283 } 284 if (qobj->orientation == GLU_OUTSIDE) { 285 if (qobj->textureCoords) { 286 glTexCoord2f(1 - (float) i / slices, 287 (float) j / stacks); 288 } 289 glVertex3f(radiusLow * sinCache[i], 290 radiusLow * cosCache[i], zLow); 291 if (qobj->textureCoords) { 292 glTexCoord2f(1 - (float) i / slices, 293 (float) (j+1) / stacks); 294 } 295 glVertex3f(radiusHigh * sinCache[i], 296 radiusHigh * cosCache[i], zHigh); 297 } else { 298 if (qobj->textureCoords) { 299 glTexCoord2f(1 - (float) i / slices, 300 (float) (j+1) / stacks); 301 } 302 glVertex3f(radiusHigh * sinCache[i], 303 radiusHigh * cosCache[i], zHigh); 304 if (qobj->textureCoords) { 305 glTexCoord2f(1 - (float) i / slices, 306 (float) j / stacks); 307 } 308 glVertex3f(radiusLow * sinCache[i], 309 radiusLow * cosCache[i], zLow); 310 } 311 } 312 glEnd(); 313 } 314 break; 315 315 case GLU_POINT: 316 glBegin(GL_POINTS);317 for (i = 0; i < slices; i++) {318 switch(qobj->normals) {319 case GLU_FLAT:320 case GLU_SMOOTH:321 glNormal3f(sinCache2[i], cosCache2[i], zNormal);322 break;323 case GLU_NONE:324 default:325 break;326 }327 sintemp = sinCache[i];328 costemp = cosCache[i];329 for (j = 0; j <= stacks; j++) {330 zLow = j * height / stacks;331 radiusLow = baseRadius - deltaRadius * ((float) j / stacks);332 333 if (qobj->textureCoords) {334 glTexCoord2f(1 - (float) i / slices,335 (float) j / stacks);336 }337 glVertex3f(radiusLow * sintemp,338 radiusLow * costemp, zLow);339 }340 }341 glEnd();342 break;316 glBegin(GL_POINTS); 317 for (i = 0; i < slices; i++) { 318 switch(qobj->normals) { 319 case GLU_FLAT: 320 case GLU_SMOOTH: 321 glNormal3f(sinCache2[i], cosCache2[i], zNormal); 322 break; 323 case GLU_NONE: 324 default: 325 break; 326 } 327 sintemp = sinCache[i]; 328 costemp = cosCache[i]; 329 for (j = 0; j <= stacks; j++) { 330 zLow = j * height / stacks; 331 radiusLow = baseRadius - deltaRadius * ((float) j / stacks); 332 333 if (qobj->textureCoords) { 334 glTexCoord2f(1 - (float) i / slices, 335 (float) j / stacks); 336 } 337 glVertex3f(radiusLow * sintemp, 338 radiusLow * costemp, zLow); 339 } 340 } 341 glEnd(); 342 break; 343 343 case GLU_LINE: 344 for (j = 1; j < stacks; j++) {345 zLow = j * height / stacks;346 radiusLow = baseRadius - deltaRadius * ((float) j / stacks);347 348 glBegin(GL_LINE_STRIP);349 for (i = 0; i <= slices; i++) {350 switch(qobj->normals) {351 case GLU_FLAT:352 glNormal3f(sinCache3[i], cosCache3[i], zNormal);353 break;354 case GLU_SMOOTH:355 glNormal3f(sinCache2[i], cosCache2[i], zNormal);356 break;357 case GLU_NONE:358 default:359 break;360 }361 if (qobj->textureCoords) {362 glTexCoord2f(1 - (float) i / slices,363 (float) j / stacks);364 }365 glVertex3f(radiusLow * sinCache[i],366 radiusLow * cosCache[i], zLow);367 }368 glEnd();369 }370 /* Intentionally fall through here... */344 for (j = 1; j < stacks; j++) { 345 zLow = j * height / stacks; 346 radiusLow = baseRadius - deltaRadius * ((float) j / stacks); 347 348 glBegin(GL_LINE_STRIP); 349 for (i = 0; i <= slices; i++) { 350 switch(qobj->normals) { 351 case GLU_FLAT: 352 glNormal3f(sinCache3[i], cosCache3[i], zNormal); 353 break; 354 case GLU_SMOOTH: 355 glNormal3f(sinCache2[i], cosCache2[i], zNormal); 356 break; 357 case GLU_NONE: 358 default: 359 break; 360 } 361 if (qobj->textureCoords) { 362 glTexCoord2f(1 - (float) i / slices, 363 (float) j / stacks); 364 } 365 glVertex3f(radiusLow * sinCache[i], 366 radiusLow * cosCache[i], zLow); 367 } 368 glEnd(); 369 } 370 /* Intentionally fall through here... */ 371 371 case GLU_SILHOUETTE: 372 for (j = 0; j <= stacks; j += stacks) {373 zLow = j * height / stacks;374 radiusLow = baseRadius - deltaRadius * ((float) j / stacks);375 376 glBegin(GL_LINE_STRIP);377 for (i = 0; i <= slices; i++) {378 switch(qobj->normals) {379 case GLU_FLAT:380 glNormal3f(sinCache3[i], cosCache3[i], zNormal);381 break;382 case GLU_SMOOTH:383 glNormal3f(sinCache2[i], cosCache2[i], zNormal);384 break;385 case GLU_NONE:386 default:387 break;388 }389 if (qobj->textureCoords) {390 glTexCoord2f(1 - (float) i / slices,391 (float) j / stacks);392 }393 glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i],394 zLow);395 }396 glEnd();397 }398 for (i = 0; i < slices; i++) {399 switch(qobj->normals) {400 case GLU_FLAT:401 case GLU_SMOOTH:402 glNormal3f(sinCache2[i], cosCache2[i], 0.0);403 break;404 case GLU_NONE:405 default:406 break;407 }408 sintemp = sinCache[i];409 costemp = cosCache[i];410 glBegin(GL_LINE_STRIP);411 for (j = 0; j <= stacks; j++) {412 zLow = j * height / stacks;413 radiusLow = baseRadius - deltaRadius * ((float) j / stacks);414 415 if (qobj->textureCoords) {416 glTexCoord2f(1 - (float) i / slices,417 (float) j / stacks);418 }419 glVertex3f(radiusLow * sintemp,420 radiusLow * costemp, zLow);421 }422 glEnd();423 }424 break;372 for (j = 0; j <= stacks; j += stacks) { 373 zLow = j * height / stacks; 374 radiusLow = baseRadius - deltaRadius * ((float) j / stacks); 375 376 glBegin(GL_LINE_STRIP); 377 for (i = 0; i <= slices; i++) { 378 switch(qobj->normals) { 379 case GLU_FLAT: 380 glNormal3f(sinCache3[i], cosCache3[i], zNormal); 381 break; 382 case GLU_SMOOTH: 383 glNormal3f(sinCache2[i], cosCache2[i], zNormal); 384 break; 385 case GLU_NONE: 386 default: 387 break; 388 } 389 if (qobj->textureCoords) { 390 glTexCoord2f(1 - (float) i / slices, 391 (float) j / stacks); 392 } 393 glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], 394 zLow); 395 } 396 glEnd(); 397 } 398 for (i = 0; i < slices; i++) { 399 switch(qobj->normals) { 400 case GLU_FLAT: 401 case GLU_SMOOTH: 402 glNormal3f(sinCache2[i], cosCache2[i], 0.0); 403 break; 404 case GLU_NONE: 405 default: 406 break; 407 } 408 sintemp = sinCache[i]; 409 costemp = cosCache[i]; 410 glBegin(GL_LINE_STRIP); 411 for (j = 0; j <= stacks; j++) { 412 zLow = j * height / stacks; 413 radiusLow = baseRadius - deltaRadius * ((float) j / stacks); 414 415 if (qobj->textureCoords) { 416 glTexCoord2f(1 - (float) i / slices, 417 (float) j / stacks); 418 } 419 glVertex3f(radiusLow * sintemp, 420 radiusLow * costemp, zLow); 421 } 422 glEnd(); 423 } 424 break; 425 425 default: 426 break;426 break; 427 427 } 428 428 } … … 430 430 void GLAPI 431 431 gluDisk(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius, 432 GLint slices, GLint loops)432 GLint slices, GLint loops) 433 433 { 434 434 gluPartialDisk(qobj, innerRadius, outerRadius, slices, loops, 0.0, 360.0); … … 437 437 void GLAPI 438 438 gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, 439 GLdouble outerRadius, GLint slices, GLint loops,440 GLdouble startAngle, GLdouble sweepAngle)439 GLdouble outerRadius, GLint slices, GLint loops, 440 GLdouble startAngle, GLdouble sweepAngle) 441 441 { 442 442 GLint i,j,max; … … 455 455 if (slices >= CACHE_SIZE) slices = CACHE_SIZE-1; 456 456 if (slices < 2 || loops < 1 || outerRadius <= 0.0 || innerRadius < 0.0 || 457 innerRadius > outerRadius) {458 gluQuadricError(qobj, GLU_INVALID_VALUE);459 return;457 innerRadius > outerRadius) { 458 gluQuadricError(qobj, GLU_INVALID_VALUE); 459 return; 460 460 } 461 461 … … 463 463 if (sweepAngle > 360.0) sweepAngle = 360.0; 464 464 if (sweepAngle < 0) { 465 startAngle += sweepAngle;466 sweepAngle = -sweepAngle;465 startAngle += sweepAngle; 466 sweepAngle = -sweepAngle; 467 467 } 468 468 469 469 if (sweepAngle == 360.0) { 470 slices2 = slices;470 slices2 = slices; 471 471 } else { 472 slices2 = slices + 1;472 slices2 = slices + 1; 473 473 } 474 474 … … 480 480 angleOffset = startAngle / 180.0 * PI; 481 481 for (i = 0; i <= slices; i++) { 482 angle = angleOffset + ((PI * sweepAngle) / 180.0) * i / slices;483 sinCache[i] = SIN(angle);484 cosCache[i] = COS(angle);482 angle = angleOffset + ((PI * sweepAngle) / 180.0) * i / slices; 483 sinCache[i] = SIN(angle); 484 cosCache[i] = COS(angle); 485 485 } 486 486 487 487 if (sweepAngle == 360.0) { 488 sinCache[slices] = sinCache[0];489 cosCache[slices] = cosCache[0];488 sinCache[slices] = sinCache[0]; 489 cosCache[slices] = cosCache[0]; 490 490 } 491 491 … … 493 493 case GLU_FLAT: 494 494 case GLU_SMOOTH: 495 if (qobj->orientation == GLU_OUTSIDE) {496 glNormal3f(0.0, 0.0, 1.0);497 } else {498 glNormal3f(0.0, 0.0, -1.0);499 }500 break;495 if (qobj->orientation == GLU_OUTSIDE) { 496 glNormal3f(0.0, 0.0, 1.0); 497 } else { 498 glNormal3f(0.0, 0.0, -1.0); 499 } 500 break; 501 501 default: 502 502 case GLU_NONE: 503 break;503 break; 504 504 } 505 505 506 506 switch (qobj->drawStyle) { 507 507 case GLU_FILL: 508 if (innerRadius == 0.0) {509 finish = loops - 1;510 /* Triangle strip for inner polygons */511 glBegin(GL_TRIANGLE_FAN);512 if (qobj->textureCoords) {513 glTexCoord2f(0.5, 0.5);514 }515 glVertex3f(0.0, 0.0, 0.0);516 radiusLow = outerRadius -517 deltaRadius * ((float) (loops-1) / loops);518 if (qobj->textureCoords) {519 texLow = radiusLow / outerRadius / 2;520 }521 522 if (qobj->orientation == GLU_OUTSIDE) {523 for (i = slices; i >= 0; i--) {524 if (qobj->textureCoords) {525 glTexCoord2f(texLow * sinCache[i] + 0.5,526 texLow * cosCache[i] + 0.5);527 }528 glVertex3f(radiusLow * sinCache[i],529 radiusLow * cosCache[i], 0.0);530 }531 } else {532 for (i = 0; i <= slices; i++) {533 if (qobj->textureCoords) {534 glTexCoord2f(texLow * sinCache[i] + 0.5,535 texLow * cosCache[i] + 0.5);536 }537 glVertex3f(radiusLow * sinCache[i],538 radiusLow * cosCache[i], 0.0);539 }540 }541 glEnd();542 } else {543 finish = loops;544 }545 for (j = 0; j < finish; j++) {546 radiusLow = outerRadius - deltaRadius * ((float) j / loops);547 radiusHigh = outerRadius - deltaRadius * ((float) (j + 1) / loops);548 if (qobj->textureCoords) {549 texLow = radiusLow / outerRadius / 2;550 texHigh = radiusHigh / outerRadius / 2;551 }552 553 glBegin(GL_QUAD_STRIP);554 for (i = 0; i <= slices; i++) {555 if (qobj->orientation == GLU_OUTSIDE) {556 if (qobj->textureCoords) {557 glTexCoord2f(texLow * sinCache[i] + 0.5,558 texLow * cosCache[i] + 0.5);559 }560 glVertex3f(radiusLow * sinCache[i],561 radiusLow * cosCache[i], 0.0);562 563 if (qobj->textureCoords) {564 glTexCoord2f(texHigh * sinCache[i] + 0.5,565 texHigh * cosCache[i] + 0.5);566 }567 glVertex3f(radiusHigh * sinCache[i],568 radiusHigh * cosCache[i], 0.0);569 } else {570 if (qobj->textureCoords) {571 glTexCoord2f(texHigh * sinCache[i] + 0.5,572 texHigh * cosCache[i] + 0.5);573 }574 glVertex3f(radiusHigh * sinCache[i],575 radiusHigh * cosCache[i], 0.0);576 577 if (qobj->textureCoords) {578 glTexCoord2f(texLow * sinCache[i] + 0.5,579 texLow * cosCache[i] + 0.5);580 }581 glVertex3f(radiusLow * sinCache[i],582 radiusLow * cosCache[i], 0.0);583 }584 }585 glEnd();586 }587 break;508 if (innerRadius == 0.0) { 509 finish = loops - 1; 510 /* Triangle strip for inner polygons */ 511 glBegin(GL_TRIANGLE_FAN); 512 if (qobj->textureCoords) { 513 glTexCoord2f(0.5, 0.5); 514 } 515 glVertex3f(0.0, 0.0, 0.0); 516 radiusLow = outerRadius - 517 deltaRadius * ((float) (loops-1) / loops); 518 if (qobj->textureCoords) { 519 texLow = radiusLow / outerRadius / 2; 520 } 521 522 if (qobj->orientation == GLU_OUTSIDE) { 523 for (i = slices; i >= 0; i--) { 524 if (qobj->textureCoords) { 525 glTexCoord2f(texLow * sinCache[i] + 0.5, 526 texLow * cosCache[i] + 0.5); 527 } 528 glVertex3f(radiusLow * sinCache[i], 529 radiusLow * cosCache[i], 0.0); 530 } 531 } else { 532 for (i = 0; i <= slices; i++) { 533 if (qobj->textureCoords) { 534 glTexCoord2f(texLow * sinCache[i] + 0.5, 535 texLow * cosCache[i] + 0.5); 536 } 537 glVertex3f(radiusLow * sinCache[i], 538 radiusLow * cosCache[i], 0.0); 539 } 540 } 541 glEnd(); 542 } else { 543 finish = loops; 544 } 545 for (j = 0; j < finish; j++) { 546 radiusLow = outerRadius - deltaRadius * ((float) j / loops); 547 radiusHigh = outerRadius - deltaRadius * ((float) (j + 1) / loops); 548 if (qobj->textureCoords) { 549 texLow = radiusLow / outerRadius / 2; 550 texHigh = radiusHigh / outerRadius / 2; 551 } 552 553 glBegin(GL_QUAD_STRIP); 554 for (i = 0; i <= slices; i++) { 555 if (qobj->orientation == GLU_OUTSIDE) { 556 if (qobj->textureCoords) { 557 glTexCoord2f(texLow * sinCache[i] + 0.5, 558 texLow * cosCache[i] + 0.5); 559 } 560 glVertex3f(radiusLow * sinCache[i], 561 radiusLow * cosCache[i], 0.0); 562 563 if (qobj->textureCoords) { 564 glTexCoord2f(texHigh * sinCache[i] + 0.5, 565 texHigh * cosCache[i] + 0.5); 566 } 567 glVertex3f(radiusHigh * sinCache[i], 568 radiusHigh * cosCache[i], 0.0); 569 } else { 570 if (qobj->textureCoords) { 571 glTexCoord2f(texHigh * sinCache[i] + 0.5, 572 texHigh * cosCache[i] + 0.5); 573 } 574 glVertex3f(radiusHigh * sinCache[i], 575 radiusHigh * cosCache[i], 0.0); 576 577 if (qobj->textureCoords) { 578 glTexCoord2f(texLow * sinCache[i] + 0.5, 579 texLow * cosCache[i] + 0.5); 580 } 581 glVertex3f(radiusLow * sinCache[i], 582 radiusLow * cosCache[i], 0.0); 583 } 584 } 585 glEnd(); 586 } 587 break; 588 588 case GLU_POINT: 589 glBegin(GL_POINTS);590 for (i = 0; i < slices2; i++) {591 sintemp = sinCache[i];592 costemp = cosCache[i];593 for (j = 0; j <= loops; j++) {594 radiusLow = outerRadius - deltaRadius * ((float) j / loops);595 596 if (qobj->textureCoords) {597 texLow = radiusLow / outerRadius / 2;598 599 glTexCoord2f(texLow * sinCache[i] + 0.5,600 texLow * cosCache[i] + 0.5);601 }602 glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0);603 }604 }605 glEnd();606 break;589 glBegin(GL_POINTS); 590 for (i = 0; i < slices2; i++) { 591 sintemp = sinCache[i]; 592 costemp = cosCache[i]; 593 for (j = 0; j <= loops; j++) { 594 radiusLow = outerRadius - deltaRadius * ((float) j / loops); 595 596 if (qobj->textureCoords) { 597 texLow = radiusLow / outerRadius / 2; 598 599 glTexCoord2f(texLow * sinCache[i] + 0.5, 600 texLow * cosCache[i] + 0.5); 601 } 602 glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0); 603 } 604 } 605 glEnd(); 606 break; 607 607 case GLU_LINE: 608 if (innerRadius == outerRadius) {609 glBegin(GL_LINE_STRIP);610 611 for (i = 0; i <= slices; i++) {612 if (qobj->textureCoords) {613 glTexCoord2f(sinCache[i] / 2 + 0.5,614 cosCache[i] / 2 + 0.5);615 }616 glVertex3f(innerRadius * sinCache[i],617 innerRadius * cosCache[i], 0.0);618 }619 glEnd();620 break;621 }622 for (j = 0; j <= loops; j++) {623 radiusLow = outerRadius - deltaRadius * ((float) j / loops);624 if (qobj->textureCoords) {625 texLow = radiusLow / outerRadius / 2;626 }627 628 glBegin(GL_LINE_STRIP);629 for (i = 0; i <= slices; i++) {630 if (qobj->textureCoords) {631 glTexCoord2f(texLow * sinCache[i] + 0.5,632 texLow * cosCache[i] + 0.5);633 }634 glVertex3f(radiusLow * sinCache[i],635 radiusLow * cosCache[i], 0.0);636 }637 glEnd();638 }639 for (i=0; i < slices2; i++) {640 sintemp = sinCache[i];641 costemp = cosCache[i];642 glBegin(GL_LINE_STRIP);643 for (j = 0; j <= loops; j++) {644 radiusLow = outerRadius - deltaRadius * ((float) j / loops);645 if (qobj->textureCoords) {646 texLow = radiusLow / outerRadius / 2;647 }648 649 if (qobj->textureCoords) {650 glTexCoord2f(texLow * sinCache[i] + 0.5,651 texLow * cosCache[i] + 0.5);652 }653 glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0);654 }655 glEnd();656 }657 break;608 if (innerRadius == outerRadius) { 609 glBegin(GL_LINE_STRIP); 610 611 for (i = 0; i <= slices; i++) { 612 if (qobj->textureCoords) { 613 glTexCoord2f(sinCache[i] / 2 + 0.5, 614 cosCache[i] / 2 + 0.5); 615 } 616 glVertex3f(innerRadius * sinCache[i], 617 innerRadius * cosCache[i], 0.0); 618 } 619 glEnd(); 620 break; 621 } 622 for (j = 0; j <= loops; j++) { 623 radiusLow = outerRadius - deltaRadius * ((float) j / loops); 624 if (qobj->textureCoords) { 625 texLow = radiusLow / outerRadius / 2; 626 } 627 628 glBegin(GL_LINE_STRIP); 629 for (i = 0; i <= slices; i++) { 630 if (qobj->textureCoords) { 631 glTexCoord2f(texLow * sinCache[i] + 0.5, 632 texLow * cosCache[i] + 0.5); 633 } 634 glVertex3f(radiusLow * sinCache[i], 635 radiusLow * cosCache[i], 0.0); 636 } 637 glEnd(); 638 } 639 for (i=0; i < slices2; i++) { 640 sintemp = sinCache[i]; 641 costemp = cosCache[i]; 642 glBegin(GL_LINE_STRIP); 643 for (j = 0; j <= loops; j++) { 644 radiusLow = outerRadius - deltaRadius * ((float) j / loops); 645 if (qobj->textureCoords) { 646 texLow = radiusLow / outerRadius / 2; 647 } 648 649 if (qobj->textureCoords) { 650 glTexCoord2f(texLow * sinCache[i] + 0.5, 651 texLow * cosCache[i] + 0.5); 652 } 653 glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0); 654 } 655 glEnd(); 656 } 657 break; 658 658 case GLU_SILHOUETTE: 659 if (sweepAngle < 360.0) {660 for (i = 0; i <= slices; i+= slices) {661 sintemp = sinCache[i];662 costemp = cosCache[i];663 glBegin(GL_LINE_STRIP);664 for (j = 0; j <= loops; j++) {665 radiusLow = outerRadius - deltaRadius * ((float) j / loops);666 667 if (qobj->textureCoords) {668 texLow = radiusLow / outerRadius / 2;669 glTexCoord2f(texLow * sinCache[i] + 0.5,670 texLow * cosCache[i] + 0.5);671 }672 glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0);673 }674 glEnd();675 }676 }677 for (j = 0; j <= loops; j += loops) {678 radiusLow = outerRadius - deltaRadius * ((float) j / loops);679 if (qobj->textureCoords) {680 texLow = radiusLow / outerRadius / 2;681 }682 683 glBegin(GL_LINE_STRIP);684 for (i = 0; i <= slices; i++) {685 if (qobj->textureCoords) {686 glTexCoord2f(texLow * sinCache[i] + 0.5,687 texLow * cosCache[i] + 0.5);688 }689 glVertex3f(radiusLow * sinCache[i],690 radiusLow * cosCache[i], 0.0);691 }692 glEnd();693 if (innerRadius == outerRadius) break;694 }695 break;659 if (sweepAngle < 360.0) { 660 for (i = 0; i <= slices; i+= slices) { 661 sintemp = sinCache[i]; 662 costemp = cosCache[i]; 663 glBegin(GL_LINE_STRIP); 664 for (j = 0; j <= loops; j++) { 665 radiusLow = outerRadius - deltaRadius * ((float) j / loops); 666 667 if (qobj->textureCoords) { 668 texLow = radiusLow / outerRadius / 2; 669 glTexCoord2f(texLow * sinCache[i] + 0.5, 670 texLow * cosCache[i] + 0.5); 671 } 672 glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0); 673 } 674 glEnd(); 675 } 676 } 677 for (j = 0; j <= loops; j += loops) { 678 radiusLow = outerRadius - deltaRadius * ((float) j / loops); 679 if (qobj->textureCoords) { 680 texLow = radiusLow / outerRadius / 2; 681 } 682 683 glBegin(GL_LINE_STRIP); 684 for (i = 0; i <= slices; i++) { 685 if (qobj->textureCoords) { 686 glTexCoord2f(texLow * sinCache[i] + 0.5, 687 texLow * cosCache[i] + 0.5); 688 } 689 glVertex3f(radiusLow * sinCache[i], 690 radiusLow * cosCache[i], 0.0); 691 } 692 glEnd(); 693 if (innerRadius == outerRadius) break; 694 } 695 break; 696 696 default: 697 break;697 break; 698 698 } 699 699 } … … 727 727 if (stacks >= CACHE_SIZE) stacks = CACHE_SIZE-1; 728 728 if (slices < 2 || stacks < 1 || radius < 0.0) { 729 gluQuadricError(qobj, GLU_INVALID_VALUE);730 return;729 gluQuadricError(qobj, GLU_INVALID_VALUE); 730 return; 731 731 } 732 732 … … 737 737 738 738 if (qobj->normals == GLU_SMOOTH) { 739 needCache2 = GL_TRUE;739 needCache2 = GL_TRUE; 740 740 } 741 741 742 742 if (qobj->normals == GLU_FLAT) { 743 if (qobj->drawStyle != GLU_POINT) {744 needCache3 = GL_TRUE;745 }746 if (qobj->drawStyle == GLU_LINE) {747 needCache2 = GL_TRUE;748 }743 if (qobj->drawStyle != GLU_POINT) { 744 needCache3 = GL_TRUE; 745 } 746 if (qobj->drawStyle == GLU_LINE) { 747 needCache2 = GL_TRUE; 748 } 749 749 } 750 750 751 751 for (i = 0; i < slices; i++) { 752 angle = 2 * PI * i / slices;753 sinCache1a[i] = SIN(angle);754 cosCache1a[i] = COS(angle);755 if (needCache2) {756 sinCache2a[i] = sinCache1a[i];757 cosCache2a[i] = cosCache1a[i];758 }752 angle = 2 * PI * i / slices; 753 sinCache1a[i] = SIN(angle); 754 cosCache1a[i] = COS(angle); 755 if (needCache2) { 756 sinCache2a[i] = sinCache1a[i]; 757 cosCache2a[i] = cosCache1a[i]; 758 } 759 759 } 760 760 761 761 for (j = 0; j <= stacks; j++) { 762 angle = PI * j / stacks;763 if (needCache2) {764 if (qobj->orientation == GLU_OUTSIDE) {765 sinCache2b[j] = SIN(angle);766 cosCache2b[j] = COS(angle);767 } else {768 sinCache2b[j] = -SIN(angle);769 cosCache2b[j] = -COS(angle);770 }771 }772 sinCache1b[j] = radius * SIN(angle);773 cosCache1b[j] = radius * COS(angle);762 angle = PI * j / stacks; 763 if (needCache2) { 764 if (qobj->orientation == GLU_OUTSIDE) { 765 sinCache2b[j] = SIN(angle); 766 cosCache2b[j] = COS(angle); 767 } else { 768 sinCache2b[j] = -SIN(angle); 769 cosCache2b[j] = -COS(angle); 770 } 771 } 772 sinCache1b[j] = radius * SIN(angle); 773 cosCache1b[j] = radius * COS(angle); 774 774 } 775 775 /* Make sure it comes to a point */ … … 778 778 779 779 if (needCache3) { 780 for (i = 0; i < slices; i++) {781 angle = 2 * PI * (i-0.5) / slices;782 sinCache3a[i] = SIN(angle);783 cosCache3a[i] = COS(angle);784 }785 for (j = 0; j <= stacks; j++) {786 angle = PI * (j - 0.5) / stacks;787 if (qobj->orientation == GLU_OUTSIDE) {788 sinCache3b[j] = SIN(angle);789 cosCache3b[j] = COS(angle);790 } else {791 sinCache3b[j] = -SIN(angle);792 cosCache3b[j] = -COS(angle);793 }794 }780 for (i = 0; i < slices; i++) { 781 angle = 2 * PI * (i-0.5) / slices; 782 sinCache3a[i] = SIN(angle); 783 cosCache3a[i] = COS(angle); 784 } 785 for (j = 0; j <= stacks; j++) { 786 angle = PI * (j - 0.5) / stacks; 787 if (qobj->orientation == GLU_OUTSIDE) { 788 sinCache3b[j] = SIN(angle); 789 cosCache3b[j] = COS(angle); 790 } else { 791 sinCache3b[j] = -SIN(angle); 792 cosCache3b[j] = -COS(angle); 793 } 794 } 795 795 } 796 796 … … 798 798 cosCache1a[slices] = cosCache1a[0]; 799 799 if (needCache2) { 800 sinCache2a[slices] = sinCache2a[0];801 cosCache2a[slices] = cosCache2a[0];800 sinCache2a[slices] = sinCache2a[0]; 801 cosCache2a[slices] = cosCache2a[0]; 802 802 } 803 803 if (needCache3) { 804 sinCache3a[slices] = sinCache3a[0];805 cosCache3a[slices] = cosCache3a[0];804 sinCache3a[slices] = sinCache3a[0]; 805 cosCache3a[slices] = cosCache3a[0]; 806 806 } 807 807 808 808 switch (qobj->drawStyle) { 809 809 case GLU_FILL: 810 /* Do ends of sphere as TRIANGLE_FAN's (if not texturing)811 ** We don't do it when texturing because we need to respecify the812 ** texture coordinates of the apex for every adjacent vertex (because813 ** it isn't a constant for that point)814 */815 if (!(qobj->textureCoords)) {816 start = 1;817 finish = stacks - 1;818 819 /* Low end first (j == 0 iteration) */820 sintemp2 = sinCache1b[1];821 zHigh = cosCache1b[1];822 switch(qobj->normals) {823 case GLU_FLAT:824 sintemp3 = sinCache3b[1];825 costemp3 = cosCache3b[1];826 break;827 case GLU_SMOOTH:828 sintemp3 = sinCache2b[1];829 costemp3 = cosCache2b[1];830 glNormal3f(sinCache2a[0] * sinCache2b[0],831 cosCache2a[0] * sinCache2b[0],832 cosCache2b[0]);833 break;834 default:835 break;836 }837 glBegin(GL_TRIANGLE_FAN);838 glVertex3f(0.0, 0.0, radius);839 if (qobj->orientation == GLU_OUTSIDE) {840 for (i = slices; i >= 0; i--) {841 switch(qobj->normals) {842 case GLU_SMOOTH:843 glNormal3f(sinCache2a[i] * sintemp3,844 cosCache2a[i] * sintemp3,845 costemp3);846 break;847 case GLU_FLAT:848 if (i != slices) {849 glNormal3f(sinCache3a[i+1] * sintemp3,850 cosCache3a[i+1] * sintemp3,851 costemp3);852 }853 break;854 case GLU_NONE:855 default:856 break;857 }858 glVertex3f(sintemp2 * sinCache1a[i],859 sintemp2 * cosCache1a[i], zHigh);860 }861 } else {862 for (i = 0; i <= slices; i++) {863 switch(qobj->normals) {864 case GLU_SMOOTH:865 glNormal3f(sinCache2a[i] * sintemp3,866 cosCache2a[i] * sintemp3,867 costemp3);868 break;869 case GLU_FLAT:870 glNormal3f(sinCache3a[i] * sintemp3,871 cosCache3a[i] * sintemp3,872 costemp3);873 break;874 case GLU_NONE:875 default:876 break;877 }878 glVertex3f(sintemp2 * sinCache1a[i],879 sintemp2 * cosCache1a[i], zHigh);880 }881 }882 glEnd();883 884 /* High end next (j == stacks-1 iteration) */885 sintemp2 = sinCache1b[stacks-1];886 zHigh = cosCache1b[stacks-1];887 switch(qobj->normals) {888 case GLU_FLAT:889 sintemp3 = sinCache3b[stacks];890 costemp3 = cosCache3b[stacks];891 break;892 case GLU_SMOOTH:893 sintemp3 = sinCache2b[stacks-1];894 costemp3 = cosCache2b[stacks-1];895 glNormal3f(sinCache2a[stacks] * sinCache2b[stacks],896 cosCache2a[stacks] * sinCache2b[stacks],897 cosCache2b[stacks]);898 break;899 default:900 break;901 }902 glBegin(GL_TRIANGLE_FAN);903 glVertex3f(0.0, 0.0, -radius);904 if (qobj->orientation == GLU_OUTSIDE) {905 for (i = 0; i <= slices; i++) {906 switch(qobj->normals) {907 case GLU_SMOOTH:908 glNormal3f(sinCache2a[i] * sintemp3,909 cosCache2a[i] * sintemp3,910 costemp3);911 break;912 case GLU_FLAT:913 glNormal3f(sinCache3a[i] * sintemp3,914 cosCache3a[i] * sintemp3,915 costemp3);916 break;917 case GLU_NONE:918 default:919 break;920 }921 glVertex3f(sintemp2 * sinCache1a[i],922 sintemp2 * cosCache1a[i], zHigh);923 }924 } else {925 for (i = slices; i >= 0; i--) {926 switch(qobj->normals) {927 case GLU_SMOOTH:928 glNormal3f(sinCache2a[i] * sintemp3,929 cosCache2a[i] * sintemp3,930 costemp3);931 break;932 case GLU_FLAT:933 if (i != slices) {934 glNormal3f(sinCache3a[i+1] * sintemp3,935 cosCache3a[i+1] * sintemp3,936 costemp3);937 }938 break;939 case GLU_NONE:940 default:941 break;942 }943 glVertex3f(sintemp2 * sinCache1a[i],944 sintemp2 * cosCache1a[i], zHigh);945 }946 }947 glEnd();948 } else {949 start = 0;950 finish = stacks;951 }952 for (j = start; j < finish; j++) {953 zLow = cosCache1b[j];954 zHigh = cosCache1b[j+1];955 sintemp1 = sinCache1b[j];956 sintemp2 = sinCache1b[j+1];957 switch(qobj->normals) {958 case GLU_FLAT:959 sintemp4 = sinCache3b[j+1];960 costemp4 = cosCache3b[j+1];961 break;962 case GLU_SMOOTH:963 if (qobj->orientation == GLU_OUTSIDE) {964 sintemp3 = sinCache2b[j+1];965 costemp3 = cosCache2b[j+1];966 sintemp4 = sinCache2b[j];967 costemp4 = cosCache2b[j];968 } else {969 sintemp3 = sinCache2b[j];970 costemp3 = cosCache2b[j];971 sintemp4 = sinCache2b[j+1];972 costemp4 = cosCache2b[j+1];973 }974 break;975 default:976 break;977 }978 979 glBegin(GL_QUAD_STRIP);980 for (i = 0; i <= slices; i++) {981 switch(qobj->normals) {982 case GLU_SMOOTH:983 glNormal3f(sinCache2a[i] * sintemp3,984 cosCache2a[i] * sintemp3,985 costemp3);986 break;987 case GLU_FLAT:988 case GLU_NONE:989 default:990 break;991 }992 if (qobj->orientation == GLU_OUTSIDE) {993 if (qobj->textureCoords) {994 glTexCoord2f(1 - (float) i / slices,995 1 - (float) (j+1) / stacks);996 }997 glVertex3f(sintemp2 * sinCache1a[i],998 sintemp2 * cosCache1a[i], zHigh);999 } else {1000 if (qobj->textureCoords) {1001 glTexCoord2f(1 - (float) i / slices,1002 1 - (float) j / stacks);1003 }1004 glVertex3f(sintemp1 * sinCache1a[i],1005 sintemp1 * cosCache1a[i], zLow);1006 }1007 switch(qobj->normals) {1008 case GLU_SMOOTH:1009 glNormal3f(sinCache2a[i] * sintemp4,1010 cosCache2a[i] * sintemp4,1011 costemp4);1012 break;1013 case GLU_FLAT:1014 glNormal3f(sinCache3a[i] * sintemp4,1015 cosCache3a[i] * sintemp4,1016 costemp4);1017 break;1018 case GLU_NONE:1019 default:1020 break;1021 }1022 if (qobj->orientation == GLU_OUTSIDE) {1023 if (qobj->textureCoords) {1024 glTexCoord2f(1 - (float) i / slices,1025 1 - (float) j / stacks);1026 }1027 glVertex3f(sintemp1 * sinCache1a[i],1028 sintemp1 * cosCache1a[i], zLow);1029 } else {1030 if (qobj->textureCoords) {1031 glTexCoord2f(1 - (float) i / slices,1032 1 - (float) (j+1) / stacks);1033 }1034 glVertex3f(sintemp2 * sinCache1a[i],1035 sintemp2 * cosCache1a[i], zHigh);1036 }1037 }1038 glEnd();1039 }1040 break;810 /* Do ends of sphere as TRIANGLE_FAN's (if not texturing) 811 ** We don't do it when texturing because we need to respecify the 812 ** texture coordinates of the apex for every adjacent vertex (because 813 ** it isn't a constant for that point) 814 */ 815 if (!(qobj->textureCoords)) { 816 start = 1; 817 finish = stacks - 1; 818 819 /* Low end first (j == 0 iteration) */ 820 sintemp2 = sinCache1b[1]; 821 zHigh = cosCache1b[1]; 822 switch(qobj->normals) { 823 case GLU_FLAT: 824 sintemp3 = sinCache3b[1]; 825 costemp3 = cosCache3b[1]; 826 break; 827 case GLU_SMOOTH: 828 sintemp3 = sinCache2b[1]; 829 costemp3 = cosCache2b[1]; 830 glNormal3f(sinCache2a[0] * sinCache2b[0], 831 cosCache2a[0] * sinCache2b[0], 832 cosCache2b[0]); 833 break; 834 default: 835 break; 836 } 837 glBegin(GL_TRIANGLE_FAN); 838 glVertex3f(0.0, 0.0, radius); 839 if (qobj->orientation == GLU_OUTSIDE) { 840 for (i = slices; i >= 0; i--) { 841 switch(qobj->normals) { 842 case GLU_SMOOTH: 843 glNormal3f(sinCache2a[i] * sintemp3, 844 cosCache2a[i] * sintemp3, 845 costemp3); 846 break; 847 case GLU_FLAT: 848 if (i != slices) { 849 glNormal3f(sinCache3a[i+1] * sintemp3, 850 cosCache3a[i+1] * sintemp3, 851 costemp3); 852 } 853 break; 854 case GLU_NONE: 855 default: 856 break; 857 } 858 glVertex3f(sintemp2 * sinCache1a[i], 859 sintemp2 * cosCache1a[i], zHigh); 860 } 861 } else { 862 for (i = 0; i <= slices; i++) { 863 switch(qobj->normals) { 864 case GLU_SMOOTH: 865 glNormal3f(sinCache2a[i] * sintemp3, 866 cosCache2a[i] * sintemp3, 867 costemp3); 868 break; 869 case GLU_FLAT: 870 glNormal3f(sinCache3a[i] * sintemp3, 871 cosCache3a[i] * sintemp3, 872 costemp3); 873 break; 874 case GLU_NONE: 875 default: 876 break; 877 } 878 glVertex3f(sintemp2 * sinCache1a[i], 879 sintemp2 * cosCache1a[i], zHigh); 880 } 881 } 882 glEnd(); 883 884 /* High end next (j == stacks-1 iteration) */ 885 sintemp2 = sinCache1b[stacks-1]; 886 zHigh = cosCache1b[stacks-1]; 887 switch(qobj->normals) { 888 case GLU_FLAT: 889 sintemp3 = sinCache3b[stacks]; 890 costemp3 = cosCache3b[stacks]; 891 break; 892 case GLU_SMOOTH: 893 sintemp3 = sinCache2b[stacks-1]; 894 costemp3 = cosCache2b[stacks-1]; 895 glNormal3f(sinCache2a[stacks] * sinCache2b[stacks], 896 cosCache2a[stacks] * sinCache2b[stacks], 897 cosCache2b[stacks]); 898 break; 899 default: 900 break; 901 } 902 glBegin(GL_TRIANGLE_FAN); 903 glVertex3f(0.0, 0.0, -radius); 904 if (qobj->orientation == GLU_OUTSIDE) { 905 for (i = 0; i <= slices; i++) { 906 switch(qobj->normals) { 907 case GLU_SMOOTH: 908 glNormal3f(sinCache2a[i] * sintemp3, 909 cosCache2a[i] * sintemp3, 910 costemp3); 911 break; 912 case GLU_FLAT: 913 glNormal3f(sinCache3a[i] * sintemp3, 914 cosCache3a[i] * sintemp3, 915 costemp3); 916 break; 917 case GLU_NONE: 918 default: 919 break; 920 } 921 glVertex3f(sintemp2 * sinCache1a[i], 922 sintemp2 * cosCache1a[i], zHigh); 923 } 924 } else { 925 for (i = slices; i >= 0; i--) { 926 switch(qobj->normals) { 927 case GLU_SMOOTH: 928 glNormal3f(sinCache2a[i] * sintemp3, 929 cosCache2a[i] * sintemp3, 930 costemp3); 931 break; 932 case GLU_FLAT: 933 if (i != slices) { 934 glNormal3f(sinCache3a[i+1] * sintemp3, 935 cosCache3a[i+1] * sintemp3, 936 costemp3); 937 } 938 break; 939 case GLU_NONE: 940 default: 941 break; 942 } 943 glVertex3f(sintemp2 * sinCache1a[i], 944 sintemp2 * cosCache1a[i], zHigh); 945 } 946 } 947 glEnd(); 948 } else { 949 start = 0; 950 finish = stacks; 951 } 952 for (j = start; j < finish; j++) { 953 zLow = cosCache1b[j]; 954 zHigh = cosCache1b[j+1]; 955 sintemp1 = sinCache1b[j]; 956 sintemp2 = sinCache1b[j+1]; 957 switch(qobj->normals) { 958 case GLU_FLAT: 959 sintemp4 = sinCache3b[j+1]; 960 costemp4 = cosCache3b[j+1]; 961 break; 962 case GLU_SMOOTH: 963 if (qobj->orientation == GLU_OUTSIDE) { 964 sintemp3 = sinCache2b[j+1]; 965 costemp3 = cosCache2b[j+1]; 966 sintemp4 = sinCache2b[j]; 967 costemp4 = cosCache2b[j]; 968 } else { 969 sintemp3 = sinCache2b[j]; 970 costemp3 = cosCache2b[j]; 971 sintemp4 = sinCache2b[j+1]; 972 costemp4 = cosCache2b[j+1]; 973 } 974 break; 975 default: 976 break; 977 } 978 979 glBegin(GL_QUAD_STRIP); 980 for (i = 0; i <= slices; i++) { 981 switch(qobj->normals) { 982 case GLU_SMOOTH: 983 glNormal3f(sinCache2a[i] * sintemp3, 984 cosCache2a[i] * sintemp3, 985 costemp3); 986 break; 987 case GLU_FLAT: 988 case GLU_NONE: 989 default: 990 break; 991 } 992 if (qobj->orientation == GLU_OUTSIDE) { 993 if (qobj->textureCoords) { 994 glTexCoord2f(1 - (float) i / slices, 995 1 - (float) (j+1) / stacks); 996 } 997 glVertex3f(sintemp2 * sinCache1a[i], 998 sintemp2 * cosCache1a[i], zHigh); 999 } else { 1000 if (qobj->textureCoords) { 1001 glTexCoord2f(1 - (float) i / slices, 1002 1 - (float) j / stacks); 1003 } 1004 glVertex3f(sintemp1 * sinCache1a[i], 1005 sintemp1 * cosCache1a[i], zLow); 1006 } 1007 switch(qobj->normals) { 1008 case GLU_SMOOTH: 1009 glNormal3f(sinCache2a[i] * sintemp4, 1010 cosCache2a[i] * sintemp4, 1011 costemp4); 1012 break; 1013 case GLU_FLAT: 1014 glNormal3f(sinCache3a[i] * sintemp4, 1015 cosCache3a[i] * sintemp4, 1016 costemp4); 1017 break; 1018 case GLU_NONE: 1019 default: 1020 break; 1021 } 1022 if (qobj->orientation == GLU_OUTSIDE) { 1023 if (qobj->textureCoords) { 1024 glTexCoord2f(1 - (float) i / slices, 1025 1 - (float) j / stacks); 1026 } 1027 glVertex3f(sintemp1 * sinCache1a[i], 1028 sintemp1 * cosCache1a[i], zLow); 1029 } else { 1030 if (qobj->textureCoords) { 1031 glTexCoord2f(1 - (float) i / slices, 1032 1 - (float) (j+1) / stacks); 1033 } 1034 glVertex3f(sintemp2 * sinCache1a[i], 1035 sintemp2 * cosCache1a[i], zHigh); 1036 } 1037 } 1038 glEnd(); 1039 } 1040 break; 1041 1041 case GLU_POINT: 1042 glBegin(GL_POINTS);1043 for (j = 0; j <= stacks; j++) {1044 sintemp1 = sinCache1b[j];1045 costemp1 = cosCache1b[j];1046 switch(qobj->normals) {1047 case GLU_FLAT:1048 case GLU_SMOOTH:1049 sintemp2 = sinCache2b[j];1050 costemp2 = cosCache2b[j];1051 break;1052 default:1053 break;1054 }1055 for (i = 0; i < slices; i++) {1056 switch(qobj->normals) {1057 case GLU_FLAT:1058 case GLU_SMOOTH:1059 glNormal3f(sinCache2a[i] * sintemp2,1060 cosCache2a[i] * sintemp2,1061 costemp2);1062 break;1063 case GLU_NONE:1064 default:1065 break;1066 }1067 1068 zLow = j * radius / stacks;1069 1070 if (qobj->textureCoords) {1071 glTexCoord2f(1 - (float) i / slices,1072 1 - (float) j / stacks);1073 }1074 glVertex3f(sintemp1 * sinCache1a[i],1075 sintemp1 * cosCache1a[i], costemp1);1076 }1077 }1078 glEnd();1079 break;1042 glBegin(GL_POINTS); 1043 for (j = 0; j <= stacks; j++) { 1044 sintemp1 = sinCache1b[j]; 1045 costemp1 = cosCache1b[j]; 1046 switch(qobj->normals) { 1047 case GLU_FLAT: 1048 case GLU_SMOOTH: 1049 sintemp2 = sinCache2b[j]; 1050 costemp2 = cosCache2b[j]; 1051 break; 1052 default: 1053 break; 1054 } 1055 for (i = 0; i < slices; i++) { 1056 switch(qobj->normals) { 1057 case GLU_FLAT: 1058 case GLU_SMOOTH: 1059 glNormal3f(sinCache2a[i] * sintemp2, 1060 cosCache2a[i] * sintemp2, 1061 costemp2); 1062 break; 1063 case GLU_NONE: 1064 default: 1065 break; 1066 } 1067 1068 zLow = j * radius / stacks; 1069 1070 if (qobj->textureCoords) { 1071 glTexCoord2f(1 - (float) i / slices, 1072 1 - (float) j / stacks); 1073 } 1074 glVertex3f(sintemp1 * sinCache1a[i], 1075 sintemp1 * cosCache1a[i], costemp1); 1076 } 1077 } 1078 glEnd(); 1079 break; 1080 1080 case GLU_LINE: 1081 1081 case GLU_SILHOUETTE: 1082 for (j = 1; j < stacks; j++) {1083 sintemp1 = sinCache1b[j];1084 costemp1 = cosCache1b[j];1085 switch(qobj->normals) {1086 case GLU_FLAT:1087 case GLU_SMOOTH:1088 sintemp2 = sinCache2b[j];1089 costemp2 = cosCache2b[j];1090 break;1091 default:1092 break;1093 }1094 1095 glBegin(GL_LINE_STRIP);1096 for (i = 0; i <= slices; i++) {1097 switch(qobj->normals) {1098 case GLU_FLAT:1099 glNormal3f(sinCache3a[i] * sintemp2,1100 cosCache3a[i] * sintemp2,1101 costemp2);1102 break;1103 case GLU_SMOOTH:1104 glNormal3f(sinCache2a[i] * sintemp2,1105 cosCache2a[i] * sintemp2,1106 costemp2);1107 break;1108 case GLU_NONE:1109 default:1110 break;1111 }1112 if (qobj->textureCoords) {1113 glTexCoord2f(1 - (float) i / slices,1114 1 - (float) j / stacks);1115 }1116 glVertex3f(sintemp1 * sinCache1a[i],1117 sintemp1 * cosCache1a[i], costemp1);1118 }1119 glEnd();1120 }1121 for (i = 0; i < slices; i++) {1122 sintemp1 = sinCache1a[i];1123 costemp1 = cosCache1a[i];1124 switch(qobj->normals) {1125 case GLU_FLAT:1126 case GLU_SMOOTH:1127 sintemp2 = sinCache2a[i];1128 costemp2 = cosCache2a[i];1129 break;1130 default:1131 break;1132 }1133 1134 glBegin(GL_LINE_STRIP);1135 for (j = 0; j <= stacks; j++) {1136 switch(qobj->normals) {1137 case GLU_FLAT:1138 glNormal3f(sintemp2 * sinCache3b[j],1139 costemp2 * sinCache3b[j],1140 cosCache3b[j]);1141 break;1142 case GLU_SMOOTH:1143 glNormal3f(sintemp2 * sinCache2b[j],1144 costemp2 * sinCache2b[j],1145 cosCache2b[j]);1146 break;1147 case GLU_NONE:1148 default:1149 break;1150 }1151 1152 if (qobj->textureCoords) {1153 glTexCoord2f(1 - (float) i / slices,1154 1 - (float) j / stacks);1155 }1156 glVertex3f(sintemp1 * sinCache1b[j],1157 costemp1 * sinCache1b[j], cosCache1b[j]);1158 }1159 glEnd();1160 }1161 break;1082 for (j = 1; j < stacks; j++) { 1083 sintemp1 = sinCache1b[j]; 1084 costemp1 = cosCache1b[j]; 1085 switch(qobj->normals) { 1086 case GLU_FLAT: 1087 case GLU_SMOOTH: 1088 sintemp2 = sinCache2b[j]; 1089 costemp2 = cosCache2b[j]; 1090 break; 1091 default: 1092 break; 1093 } 1094 1095 glBegin(GL_LINE_STRIP); 1096 for (i = 0; i <= slices; i++) { 1097 switch(qobj->normals) { 1098 case GLU_FLAT: 1099 glNormal3f(sinCache3a[i] * sintemp2, 1100 cosCache3a[i] * sintemp2, 1101 costemp2); 1102 break; 1103 case GLU_SMOOTH: 1104 glNormal3f(sinCache2a[i] * sintemp2, 1105 cosCache2a[i] * sintemp2, 1106 costemp2); 1107 break; 1108 case GLU_NONE: 1109 default: 1110 break; 1111 } 1112 if (qobj->textureCoords) { 1113 glTexCoord2f(1 - (float) i / slices, 1114 1 - (float) j / stacks); 1115 } 1116 glVertex3f(sintemp1 * sinCache1a[i], 1117 sintemp1 * cosCache1a[i], costemp1); 1118 } 1119 glEnd(); 1120 } 1121 for (i = 0; i < slices; i++) { 1122 sintemp1 = sinCache1a[i]; 1123 costemp1 = cosCache1a[i]; 1124 switch(qobj->normals) { 1125 case GLU_FLAT: 1126 case GLU_SMOOTH: 1127 sintemp2 = sinCache2a[i]; 1128 costemp2 = cosCache2a[i]; 1129 break; 1130 default: 1131 break; 1132 } 1133 1134 glBegin(GL_LINE_STRIP); 1135 for (j = 0; j <= stacks; j++) { 1136 switch(qobj->normals) { 1137 case GLU_FLAT: 1138 glNormal3f(sintemp2 * sinCache3b[j], 1139 costemp2 * sinCache3b[j], 1140 cosCache3b[j]); 1141 break; 1142 case GLU_SMOOTH: 1143 glNormal3f(sintemp2 * sinCache2b[j], 1144 costemp2 * sinCache2b[j], 1145 cosCache2b[j]); 1146 break; 1147 case GLU_NONE: 1148 default: 1149 break; 1150 } 1151 1152 if (qobj->textureCoords) { 1153 glTexCoord2f(1 - (float) i / slices, 1154 1 - (float) j / stacks); 1155 } 1156 glVertex3f(sintemp1 * sinCache1b[j], 1157 costemp1 * sinCache1b[j], cosCache1b[j]); 1158 } 1159 glEnd(); 1160 } 1161 break; 1162 1162 default: 1163 break;1163 break; 1164 1164 } 1165 1165 } -
trunk/src/opengl/glut/glut_event.c
r3022 r3079 1 /* $Id: glut_event.c,v 1. 5 2000-03-05 10:19:38jeroen Exp $ */1 /* $Id: glut_event.c,v 1.6 2000-03-11 09:05:04 jeroen Exp $ */ 2 2 /* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1997, 1998. */ 3 3 … … 321 321 processEventsAndTimeouts(void) 322 322 { 323 WriteLog("processEventsAndTimeouts() entry\n"); 323 324 do { 324 325 #if defined(_WIN32) || defined(__WIN32OS2__) … … 826 827 #endif /* _WIN32 */ 827 828 if (__glutTimerList) { 829 WriteLog("processEventsAndTimeouts -> Calling handleTimeouts\n"); 828 830 handleTimeouts(); 831 WriteLog("processEventsAndTimeouts -> Call handleTimeouts returned\n"); 829 832 } 830 833 } … … 931 934 if (XPending(__glutDisplay)) { 932 935 immediatelyHandleXinput: 936 WriteLog("waitForSmoething: Calling processEventsAndTimeouts\n"); 933 937 processEventsAndTimeouts(); 938 WriteLog("waitForSmoething: Call processEventsAndTimeouts returned\n"); 934 939 } else { 935 940 if (__glutTimerList) … … 942 947 { 943 948 if (XPending(__glutDisplay)) { 949 WriteLog("idleWait: Calling processEventsAndTimeouts\n"); 944 950 processEventsAndTimeouts(); 951 WriteLog("idleWait: Call processEventsAndTimeouts returned\n"); 945 952 } else { 946 953 if (__glutTimerList) { … … 1371 1378 waitForSomething(); 1372 1379 } else { 1380 WriteLog("glutMainLoop: Calling processEventsAndTimeouts\n"); 1373 1381 processEventsAndTimeouts(); 1382 WriteLog("glutMainLoop: Call processEventsAndTimeouts returned\n"); 1374 1383 } 1375 1384 } -
trunk/src/opengl/glut/glut_term.c
r2996 r3079 1 /* $Id: glut_term.c,v 1. 2 2000-03-04 19:10:15 jeroen Exp $ */1 /* $Id: glut_term.c,v 1.3 2000-03-11 09:05:05 jeroen Exp $ */ 2 2 /* 3 3 * GLUT Termination - on exit cleanup any open windows … … 6 6 7 7 #include <odinwrap.h> 8 #include "glut.h" 8 9 #include "glu.h" 9 #include "glut.h"10 10 #include "glutint.h" 11 11 -
trunk/src/opengl/glut/glut_win.c
r3022 r3079 1 /* $Id: glut_win.c,v 1. 5 2000-03-05 10:19:38jeroen Exp $ */1 /* $Id: glut_win.c,v 1.6 2000-03-11 09:05:05 jeroen Exp $ */ 2 2 /* Copyright (c) Mark J. Kilgard, 1994, 1997. */ 3 3 … … 403 403 } 404 404 405 void CDECL405 void GLCALLBACK 406 406 __glutDefaultDisplay(void) 407 407 { … … 413 413 } 414 414 415 void CDECL415 void GLCALLBACK 416 416 __glutDefaultReshape(int width, int height) 417 417 { … … 1003 1003 } 1004 1004 1005 static void GL APIENTRY1005 static void GLCALLBACK 1006 1006 visibilityHelper(int status) 1007 1007 { -
trunk/src/opengl/glut/glutint.h
r3022 r3079 1 /* $Id: glutint.h,v 1. 4 2000-03-05 10:19:38jeroen Exp $ */1 /* $Id: glutint.h,v 1.5 2000-03-11 09:05:05 jeroen Exp $ */ 2 2 #ifndef __glutint_h__ 3 3 #define __glutint_h__ … … 253 253 254 254 /* GLUT function types */ 255 typedef void (* CDECLGLUTdisplayCB) (void);256 typedef void (* CDECLGLUTreshapeCB) (int, int);257 typedef void (* CDECLGLUTkeyboardCB) (unsigned char, int, int);258 typedef void (* CDECLGLUTmouseCB) (int, int, int, int);259 typedef void (* CDECLGLUTmotionCB) (int, int);260 typedef void (* CDECLGLUTpassiveCB) (int, int);261 typedef void (* CDECLGLUTentryCB) (int);262 typedef void (* CDECLGLUTvisibilityCB) (int);263 typedef void (* CDECLGLUTwindowStatusCB) (int);264 typedef void (* CDECLGLUTidleCB) (void);265 typedef void (* CDECLGLUTtimerCB) (int);266 typedef void (* CDECLGLUTmenuStateCB) (int); /* DEPRICATED. */267 typedef void (* CDECLGLUTmenuStatusCB) (int, int, int);268 typedef void (* CDECLGLUTselectCB) (int);269 typedef void (* CDECLGLUTspecialCB) (int, int, int);270 typedef void (* CDECLGLUTspaceMotionCB) (int, int, int);271 typedef void (* CDECLGLUTspaceRotateCB) (int, int, int);272 typedef void (* CDECLGLUTspaceButtonCB) (int, int);273 typedef void (* CDECLGLUTdialsCB) (int, int);274 typedef void (* CDECLGLUTbuttonBoxCB) (int, int);275 typedef void (* CDECLGLUTtabletMotionCB) (int, int);276 typedef void (* CDECLGLUTtabletButtonCB) (int, int, int, int);277 typedef void (* CDECLGLUTjoystickCB) (unsigned int buttonMask, int x, int y, int z);255 typedef void (* GLCALLBACK GLUTdisplayCB) (void); 256 typedef void (* GLCALLBACK GLUTreshapeCB) (int, int); 257 typedef void (* GLCALLBACK GLUTkeyboardCB) (unsigned char, int, int); 258 typedef void (* GLCALLBACK GLUTmouseCB) (int, int, int, int); 259 typedef void (* GLCALLBACK GLUTmotionCB) (int, int); 260 typedef void (* GLCALLBACK GLUTpassiveCB) (int, int); 261 typedef void (* GLCALLBACK GLUTentryCB) (int); 262 typedef void (* GLCALLBACK GLUTvisibilityCB) (int); 263 typedef void (* GLCALLBACK GLUTwindowStatusCB) (int); 264 typedef void (* GLCALLBACK GLUTidleCB) (void); 265 typedef void (* GLCALLBACK GLUTtimerCB) (int); 266 typedef void (* GLCALLBACK GLUTmenuStateCB) (int); /* DEPRICATED. */ 267 typedef void (* GLCALLBACK GLUTmenuStatusCB) (int, int, int); 268 typedef void (* GLCALLBACK GLUTselectCB) (int); 269 typedef void (* GLCALLBACK GLUTspecialCB) (int, int, int); 270 typedef void (* GLCALLBACK GLUTspaceMotionCB) (int, int, int); 271 typedef void (* GLCALLBACK GLUTspaceRotateCB) (int, int, int); 272 typedef void (* GLCALLBACK GLUTspaceButtonCB) (int, int); 273 typedef void (* GLCALLBACK GLUTdialsCB) (int, int); 274 typedef void (* GLCALLBACK GLUTbuttonBoxCB) (int, int); 275 typedef void (* GLCALLBACK GLUTtabletMotionCB) (int, int); 276 typedef void (* GLCALLBACK GLUTtabletButtonCB) (int, int, int, int); 277 typedef void (* GLCALLBACK GLUTjoystickCB) (unsigned int buttonMask, int x, int y, int z); 278 278 #ifdef SUPPORT_FORTRAN 279 279 typedef void (*GLUTdisplayFCB) (void); … … 664 664 extern GLUTmenuItem *__glutItemSelected; 665 665 extern GLUTmenu **__glutMenuList; 666 extern void (* CDECL__glutMenuStatusFunc) (int, int, int);666 extern void (* GLCALLBACK __glutMenuStatusFunc) (int, int, int); 667 667 extern void __glutMenuModificationError(void); 668 668 extern void __glutSetMenuItem(GLUTmenuItem * item, … … 746 746 extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc, 747 747 int callingConvention); 748 extern void CDECL__glutDefaultReshape(int, int);748 extern void GLCALLBACK __glutDefaultReshape(int, int); 749 749 extern GLUTwindow *__glutCreateWindow( 750 750 GLUTwindow * parent, -
trunk/src/opengl/glut/win32_menu.c
r3022 r3079 1 /* $Id: win32_menu.c,v 1. 3 2000-03-05 10:19:39jeroen Exp $ */1 /* $Id: win32_menu.c,v 1.4 2000-03-11 09:05:05 jeroen Exp $ */ 2 2 /* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */ 3 3 /* Copyright (c) Nate Robins, 1997. */ … … 19 19 #include "glutint.h" 20 20 21 void (* CDECL__glutMenuStatusFunc) (int, int, int);21 void (* GLCALLBACK __glutMenuStatusFunc) (int, int, int); 22 22 extern GLUTmenu *__glutMappedMenu; 23 23 extern GLUTwindow *__glutMenuWindow; -
trunk/src/opengl/mesa/GL/glu.h
r2945 r3079 1 /* $Id: glu.h,v 1. 2 2000-02-29 13:56:52 sandervlExp $ */1 /* $Id: glu.h,v 1.3 2000-03-11 09:05:07 jeroen Exp $ */ 2 2 3 3 /* … … 38 38 #include "GL/gl.h" 39 39 40 /* to facilitate clean DLL building ... */40 /* to facilitate clean DLL building ... */ 41 41 #if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__)) 42 # if defined(_MSC_VER) && defined(BUILD_GLU32) /* tag specify we're building mesa as a DLL */43 # define GLUAPI __declspec(dllexport)44 # elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */45 # define GLUAPI __declspec(dllimport)46 # else /* for use with static link lib build of Win32 edition only */47 # define GLUAPI extern48 # endif /* _STATIC_MESA support */42 # if defined(_MSC_VER) && defined(BUILD_GLU32) /* tag specify we're building mesa as a DLL */ 43 # define GLUAPI __declspec(dllexport) 44 # elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ 45 # define GLUAPI __declspec(dllimport) 46 # else /* for use with static link lib build of Win32 edition only */ 47 # define GLUAPI extern 48 # endif /* _STATIC_MESA support */ 49 49 #else 50 # define GLUAPI extern50 # define GLUAPI extern 51 51 #endif /* WIN32 / CYGWIN32 bracket */ 52 52 53 53 #ifdef macintosh 54 #pragma enumsalwaysint on55 #if PRAGMA_IMPORT_SUPPORTED56 #pragma import on57 #endif54 #pragma enumsalwaysint on 55 #if PRAGMA_IMPORT_SUPPORTED 56 #pragma import on 57 #endif 58 58 #endif 59 59 … … 71 71 72 72 73 #define GLU_VERSION_1_1 174 #define GLU_VERSION_1_2 173 #define GLU_VERSION_1_1 1 74 #define GLU_VERSION_1_2 1 75 75 76 76 … … 82 82 83 83 enum { 84 /* Normal vectors */85 GLU_SMOOTH= 100000,86 GLU_FLAT= 100001,87 GLU_NONE= 100002,88 89 /* Quadric draw styles */90 GLU_POINT= 100010,91 GLU_LINE= 100011,92 GLU_FILL= 100012,93 GLU_SILHOUETTE= 100013,94 95 /* Quadric orientation */96 GLU_OUTSIDE= 100020,97 GLU_INSIDE= 100021,98 99 /* Tessellator */100 GLU_TESS_BEGIN= 100100,101 GLU_TESS_VERTEX= 100101,102 GLU_TESS_END= 100102,103 GLU_TESS_ERROR= 100103,104 GLU_TESS_EDGE_FLAG= 100104,105 GLU_TESS_COMBINE= 100105,106 107 GLU_TESS_BEGIN_DATA= 100106,108 GLU_TESS_VERTEX_DATA= 100107,109 GLU_TESS_END_DATA= 100108,110 GLU_TESS_ERROR_DATA= 100109,111 GLU_TESS_EDGE_FLAG_DATA= 100110,112 GLU_TESS_COMBINE_DATA= 100111,113 114 /* Winding rules */115 GLU_TESS_WINDING_ODD= 100130,116 GLU_TESS_WINDING_NONZERO= 100131,117 GLU_TESS_WINDING_POSITIVE= 100132,118 GLU_TESS_WINDING_NEGATIVE= 100133,119 GLU_TESS_WINDING_ABS_GEQ_TWO= 100134,120 121 /* Tessellation properties */122 GLU_TESS_WINDING_RULE= 100140,123 GLU_TESS_BOUNDARY_ONLY= 100141,124 GLU_TESS_TOLERANCE= 100142,125 126 /* Tessellation errors */127 GLU_TESS_ERROR1= 100151, /* Missing gluBeginPolygon */128 GLU_TESS_ERROR2 = 100152, /* Missing gluBeginContour */129 GLU_TESS_ERROR3 = 100153, /* Missing gluEndPolygon */130 GLU_TESS_ERROR4 = 100154, /* Missing gluEndContour */131 GLU_TESS_ERROR5 = 100155, /* */132 GLU_TESS_ERROR6 = 100156, /* */133 GLU_TESS_ERROR7 = 100157, /* */134 GLU_TESS_ERROR8 = 100158, /* */84 /* Normal vectors */ 85 GLU_SMOOTH = 100000, 86 GLU_FLAT = 100001, 87 GLU_NONE = 100002, 88 89 /* Quadric draw styles */ 90 GLU_POINT = 100010, 91 GLU_LINE = 100011, 92 GLU_FILL = 100012, 93 GLU_SILHOUETTE = 100013, 94 95 /* Quadric orientation */ 96 GLU_OUTSIDE = 100020, 97 GLU_INSIDE = 100021, 98 99 /* Tessellator */ 100 GLU_TESS_BEGIN = 100100, 101 GLU_TESS_VERTEX = 100101, 102 GLU_TESS_END = 100102, 103 GLU_TESS_ERROR = 100103, 104 GLU_TESS_EDGE_FLAG = 100104, 105 GLU_TESS_COMBINE = 100105, 106 107 GLU_TESS_BEGIN_DATA = 100106, 108 GLU_TESS_VERTEX_DATA = 100107, 109 GLU_TESS_END_DATA = 100108, 110 GLU_TESS_ERROR_DATA = 100109, 111 GLU_TESS_EDGE_FLAG_DATA = 100110, 112 GLU_TESS_COMBINE_DATA = 100111, 113 114 /* Winding rules */ 115 GLU_TESS_WINDING_ODD = 100130, 116 GLU_TESS_WINDING_NONZERO = 100131, 117 GLU_TESS_WINDING_POSITIVE = 100132, 118 GLU_TESS_WINDING_NEGATIVE = 100133, 119 GLU_TESS_WINDING_ABS_GEQ_TWO = 100134, 120 121 /* Tessellation properties */ 122 GLU_TESS_WINDING_RULE = 100140, 123 GLU_TESS_BOUNDARY_ONLY = 100141, 124 GLU_TESS_TOLERANCE = 100142, 125 126 /* Tessellation errors */ 127 GLU_TESS_ERROR1 = 100151, /* Missing gluBeginPolygon */ 128 GLU_TESS_ERROR2 = 100152, /* Missing gluBeginContour */ 129 GLU_TESS_ERROR3 = 100153, /* Missing gluEndPolygon */ 130 GLU_TESS_ERROR4 = 100154, /* Missing gluEndContour */ 131 GLU_TESS_ERROR5 = 100155, /* */ 132 GLU_TESS_ERROR6 = 100156, /* */ 133 GLU_TESS_ERROR7 = 100157, /* */ 134 GLU_TESS_ERROR8 = 100158, /* */ 135 135 136 136 GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1, … … 141 141 GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6, 142 142 143 /* NURBS */144 GLU_NURBS_MODE = 100160,145 GLU_NURBS_TESSELLATOR = 100161,146 GLU_NURBS_RENDERER = 100162,147 GLU_NURBS_BEGIN = 100164,148 GLU_NURBS_VERTEX = 100165,149 GLU_NURBS_NORMAL = 100166,150 GLU_NURBS_COLOR = 100167,151 GLU_NURBS_TEXTURE_COORD = 100168,152 GLU_NURBS_END = 100169,153 GLU_NURBS_BEGIN_DATA = 100170,154 GLU_NURBS_VERTEX_DATA = 100171,155 GLU_NURBS_NORMAL_DATA = 100172,156 GLU_NURBS_COLOR_DATA = 100173,157 GLU_NURBS_TEXTURE_COORD_DATA = 100174,158 GLU_NURBS_END_DATA = 100175,159 160 GLU_AUTO_LOAD_MATRIX= 100200,161 GLU_CULLING= 100201,162 GLU_PARAMETRIC_TOLERANCE= 100202,163 GLU_SAMPLING_TOLERANCE= 100203,164 GLU_DISPLAY_MODE= 100204,165 GLU_SAMPLING_METHOD= 100205,166 GLU_U_STEP= 100206,167 GLU_V_STEP= 100207,168 GLU_OBJECT_PARAMETRIC_ERROR = 100208,169 GLU_OBJECT_PATH_LENGTH = 100209,170 171 GLU_MAP1_TRIM_2 = 100210,172 GLU_MAP1_TRIM_3 = 100211,173 174 GLU_PATH_LENGTH= 100215,175 GLU_PARAMETRIC_ERROR= 100216,176 GLU_DOMAIN_DISTANCE= 100217,177 178 GLU_OUTLINE_POLYGON= 100240,179 GLU_OUTLINE_PATCH= 100241,180 181 GLU_ERROR= GLU_TESS_ERROR,143 /* NURBS */ 144 GLU_NURBS_MODE = 100160, 145 GLU_NURBS_TESSELLATOR = 100161, 146 GLU_NURBS_RENDERER = 100162, 147 GLU_NURBS_BEGIN = 100164, 148 GLU_NURBS_VERTEX = 100165, 149 GLU_NURBS_NORMAL = 100166, 150 GLU_NURBS_COLOR = 100167, 151 GLU_NURBS_TEXTURE_COORD = 100168, 152 GLU_NURBS_END = 100169, 153 GLU_NURBS_BEGIN_DATA = 100170, 154 GLU_NURBS_VERTEX_DATA = 100171, 155 GLU_NURBS_NORMAL_DATA = 100172, 156 GLU_NURBS_COLOR_DATA = 100173, 157 GLU_NURBS_TEXTURE_COORD_DATA = 100174, 158 GLU_NURBS_END_DATA = 100175, 159 160 GLU_AUTO_LOAD_MATRIX = 100200, 161 GLU_CULLING = 100201, 162 GLU_PARAMETRIC_TOLERANCE= 100202, 163 GLU_SAMPLING_TOLERANCE = 100203, 164 GLU_DISPLAY_MODE = 100204, 165 GLU_SAMPLING_METHOD = 100205, 166 GLU_U_STEP = 100206, 167 GLU_V_STEP = 100207, 168 GLU_OBJECT_PARAMETRIC_ERROR = 100208, 169 GLU_OBJECT_PATH_LENGTH = 100209, 170 171 GLU_MAP1_TRIM_2 = 100210, 172 GLU_MAP1_TRIM_3 = 100211, 173 174 GLU_PATH_LENGTH = 100215, 175 GLU_PARAMETRIC_ERROR = 100216, 176 GLU_DOMAIN_DISTANCE = 100217, 177 178 GLU_OUTLINE_POLYGON = 100240, 179 GLU_OUTLINE_PATCH = 100241, 180 181 GLU_ERROR = GLU_TESS_ERROR, 182 182 GLU_NURBS_ERROR = GLU_ERROR, /* FIXME: is this correct?? */ 183 183 184 GLU_NURBS_ERROR1 = 100251, /* spline order un-supported */185 GLU_NURBS_ERROR2 = 100252, /* too few knots */186 GLU_NURBS_ERROR3 = 100253, /* valid knot range is empty */187 GLU_NURBS_ERROR4 = 100254, /* decreasing knot sequence */188 GLU_NURBS_ERROR5 = 100255, /* knot multiplicity > spline order */189 GLU_NURBS_ERROR6 = 100256, /* endcurve() must follow bgncurve() */190 GLU_NURBS_ERROR7 = 100257, /* bgncurve() must precede endcurve() */191 GLU_NURBS_ERROR8 = 100258, /* ctrlarray or knot vector is NULL */192 GLU_NURBS_ERROR9 = 100259, /* can't draw pwlcurves */193 GLU_NURBS_ERROR10 = 100260, /* missing gluNurbsCurve() */194 GLU_NURBS_ERROR11 = 100261, /* missing gluNurbsSurface() */195 GLU_NURBS_ERROR12 = 100262, /* endtrim() must precede endsurface() */196 GLU_NURBS_ERROR13 = 100263, /* bgnsurface() must precede endsurface() */197 GLU_NURBS_ERROR14 = 100264, /* curve of improper type passed as trim curve */198 GLU_NURBS_ERROR15 = 100265, /* bgnsurface() must precede bgntrim() */199 GLU_NURBS_ERROR16 = 100266, /* endtrim() must follow bgntrim() */200 GLU_NURBS_ERROR17 = 100267, /* bgntrim() must precede endtrim()*/201 GLU_NURBS_ERROR18 = 100268, /* invalid or missing trim curve*/202 GLU_NURBS_ERROR19 = 100269, /* bgntrim() must precede pwlcurve() */203 GLU_NURBS_ERROR20 = 100270, /* pwlcurve referenced twice*/204 GLU_NURBS_ERROR21 = 100271, /* pwlcurve and nurbscurve mixed */205 GLU_NURBS_ERROR22 = 100272, /* improper usage of trim data type */206 GLU_NURBS_ERROR23 = 100273, /* nurbscurve referenced twice */207 GLU_NURBS_ERROR24 = 100274, /* nurbscurve and pwlcurve mixed */208 GLU_NURBS_ERROR25 = 100275, /* nurbssurface referenced twice */209 GLU_NURBS_ERROR26 = 100276, /* invalid property */210 GLU_NURBS_ERROR27 = 100277, /* endsurface() must follow bgnsurface() */211 GLU_NURBS_ERROR28 = 100278, /* intersecting or misoriented trim curves */212 GLU_NURBS_ERROR29 = 100279, /* intersecting trim curves */213 GLU_NURBS_ERROR30 = 100280, /* UNUSED */214 GLU_NURBS_ERROR31 = 100281, /* unconnected trim curves */215 GLU_NURBS_ERROR32 = 100282, /* unknown knot error */216 GLU_NURBS_ERROR33 = 100283, /* negative vertex count encountered */217 GLU_NURBS_ERROR34 = 100284, /* negative byte-stride */218 GLU_NURBS_ERROR35 = 100285, /* unknown type descriptor */219 GLU_NURBS_ERROR36 = 100286, /* null control point reference */220 GLU_NURBS_ERROR37 = 100287, /* duplicate point on pwlcurve */221 222 /* Errors */223 GLU_INVALID_ENUM= 100900,224 GLU_INVALID_VALUE= 100901,225 GLU_OUT_OF_MEMORY= 100902,226 GLU_INCOMPATIBLE_GL_VERSION= 100903,184 GLU_NURBS_ERROR1 = 100251, /* spline order un-supported */ 185 GLU_NURBS_ERROR2 = 100252, /* too few knots */ 186 GLU_NURBS_ERROR3 = 100253, /* valid knot range is empty */ 187 GLU_NURBS_ERROR4 = 100254, /* decreasing knot sequence */ 188 GLU_NURBS_ERROR5 = 100255, /* knot multiplicity > spline order */ 189 GLU_NURBS_ERROR6 = 100256, /* endcurve() must follow bgncurve() */ 190 GLU_NURBS_ERROR7 = 100257, /* bgncurve() must precede endcurve() */ 191 GLU_NURBS_ERROR8 = 100258, /* ctrlarray or knot vector is NULL */ 192 GLU_NURBS_ERROR9 = 100259, /* can't draw pwlcurves */ 193 GLU_NURBS_ERROR10 = 100260, /* missing gluNurbsCurve() */ 194 GLU_NURBS_ERROR11 = 100261, /* missing gluNurbsSurface() */ 195 GLU_NURBS_ERROR12 = 100262, /* endtrim() must precede endsurface() */ 196 GLU_NURBS_ERROR13 = 100263, /* bgnsurface() must precede endsurface() */ 197 GLU_NURBS_ERROR14 = 100264, /* curve of improper type passed as trim curve */ 198 GLU_NURBS_ERROR15 = 100265, /* bgnsurface() must precede bgntrim() */ 199 GLU_NURBS_ERROR16 = 100266, /* endtrim() must follow bgntrim() */ 200 GLU_NURBS_ERROR17 = 100267, /* bgntrim() must precede endtrim()*/ 201 GLU_NURBS_ERROR18 = 100268, /* invalid or missing trim curve*/ 202 GLU_NURBS_ERROR19 = 100269, /* bgntrim() must precede pwlcurve() */ 203 GLU_NURBS_ERROR20 = 100270, /* pwlcurve referenced twice*/ 204 GLU_NURBS_ERROR21 = 100271, /* pwlcurve and nurbscurve mixed */ 205 GLU_NURBS_ERROR22 = 100272, /* improper usage of trim data type */ 206 GLU_NURBS_ERROR23 = 100273, /* nurbscurve referenced twice */ 207 GLU_NURBS_ERROR24 = 100274, /* nurbscurve and pwlcurve mixed */ 208 GLU_NURBS_ERROR25 = 100275, /* nurbssurface referenced twice */ 209 GLU_NURBS_ERROR26 = 100276, /* invalid property */ 210 GLU_NURBS_ERROR27 = 100277, /* endsurface() must follow bgnsurface() */ 211 GLU_NURBS_ERROR28 = 100278, /* intersecting or misoriented trim curves */ 212 GLU_NURBS_ERROR29 = 100279, /* intersecting trim curves */ 213 GLU_NURBS_ERROR30 = 100280, /* UNUSED */ 214 GLU_NURBS_ERROR31 = 100281, /* unconnected trim curves */ 215 GLU_NURBS_ERROR32 = 100282, /* unknown knot error */ 216 GLU_NURBS_ERROR33 = 100283, /* negative vertex count encountered */ 217 GLU_NURBS_ERROR34 = 100284, /* negative byte-stride */ 218 GLU_NURBS_ERROR35 = 100285, /* unknown type descriptor */ 219 GLU_NURBS_ERROR36 = 100286, /* null control point reference */ 220 GLU_NURBS_ERROR37 = 100287, /* duplicate point on pwlcurve */ 221 222 /* Errors */ 223 GLU_INVALID_ENUM = 100900, 224 GLU_INVALID_VALUE = 100901, 225 GLU_OUT_OF_MEMORY = 100902, 226 GLU_INCOMPATIBLE_GL_VERSION = 100903, 227 227 GLU_INVALID_OPERATION = 100904, 228 228 229 /* New in GLU 1.1 */230 GLU_VERSION= 100800,231 GLU_EXTENSIONS= 100801,232 233 /*** GLU 1.0 tessellation - obsolete! ***/234 235 /* Contour types */236 GLU_CW= 100120,237 GLU_CCW= 100121,238 GLU_INTERIOR= 100122,239 GLU_EXTERIOR= 100123,240 GLU_UNKNOWN= 100124,241 242 /* Tessellator */243 GLU_BEGIN= GLU_TESS_BEGIN,244 GLU_VERTEX= GLU_TESS_VERTEX,245 GLU_END= GLU_TESS_END,246 GLU_EDGE_FLAG= GLU_TESS_EDGE_FLAG229 /* New in GLU 1.1 */ 230 GLU_VERSION = 100800, 231 GLU_EXTENSIONS = 100801, 232 233 /*** GLU 1.0 tessellation - obsolete! ***/ 234 235 /* Contour types */ 236 GLU_CW = 100120, 237 GLU_CCW = 100121, 238 GLU_INTERIOR = 100122, 239 GLU_EXTERIOR = 100123, 240 GLU_UNKNOWN = 100124, 241 242 /* Tessellator */ 243 GLU_BEGIN = GLU_TESS_BEGIN, 244 GLU_VERTEX = GLU_TESS_VERTEX, 245 GLU_END = GLU_TESS_END, 246 GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG 247 247 }; 248 248 … … 360 360 361 361 GLUAPI void GLAPIENTRY gluQuadricCallback( GLUquadricObj *qobj, 362 GLenum which, void (GLCALLBACK *fn)() ); 362 GLenum which, 363 void (GLCALLBACK *fn)() ); 363 364 364 365 GLUAPI void GLAPIENTRY gluCylinder( GLUquadricObj *qobj, … … 449 450 450 451 GLUAPI void GLAPIENTRY gluTessBeginPolygon( GLUtesselator *tobj, 451 void *polygon_data );452 void *polygon_data ); 452 453 453 454 GLUAPI void GLAPIENTRY gluTessBeginContour( GLUtesselator *tobj ); 454 455 455 456 GLUAPI void GLAPIENTRY gluTessVertex( GLUtesselator *tobj, GLdouble coords[3], 456 void *vertex_data );457 void *vertex_data ); 457 458 458 459 GLUAPI void GLAPIENTRY gluTessEndContour( GLUtesselator *tobj ); … … 461 462 462 463 GLUAPI void GLAPIENTRY gluTessProperty( GLUtesselator *tobj, GLenum which, 463 GLdouble value );464 GLdouble value ); 464 465 465 466 GLUAPI void GLAPIENTRY gluTessNormal( GLUtesselator *tobj, GLdouble x, 466 GLdouble y, GLdouble z );467 GLdouble y, GLdouble z ); 467 468 468 469 GLUAPI void GLAPIENTRY gluTessCallback( GLUtesselator *tobj, GLenum which, 469 void (GLCALLBACK *fn)() );470 void (GLCALLBACK *fn)() ); 470 471 471 472 GLUAPI void GLAPIENTRY gluGetTessProperty( GLUtesselator *tobj, GLenum which, 472 GLdouble *value );473 GLdouble *value ); 473 474 474 475 /* … … 502 503 503 504 #ifdef macintosh 504 #pragma enumsalwaysint reset505 #if PRAGMA_IMPORT_SUPPORTED506 #pragma import off507 #endif505 #pragma enumsalwaysint reset 506 #if PRAGMA_IMPORT_SUPPORTED 507 #pragma import off 508 #endif 508 509 #endif 509 510 -
trunk/src/opengl/mesa/api1.c
r2938 r3079 1 /* $Id: api1.c,v 1. 1 2000-02-29 00:49:57 sandervlExp $ */1 /* $Id: api1.c,v 1.2 2000-03-11 09:05:06 jeroen Exp $ */ 2 2 3 3 /* … … 54 54 #endif 55 55 56 #include <misc.h> 57 56 58 /* 57 59 * Part 1 of API functions … … 85 87 * function pointer. 86 88 */ 87 #define ARRAY_ELT( IM, i ) \88 { \89 GLuint count = IM->Count; \90 IM->Elt[count] = i; \91 IM->Flag[count] = ((IM->Flag[count] & IM->ArrayAndFlags) | \92 VERT_ELT);\93 IM->FlushElt |= IM->ArrayEltFlush; \94 IM->Count = count += IM->ArrayIncr; \95 if (count == VB_MAX) \96 IM->maybe_transform_vb( IM ); \89 #define ARRAY_ELT( IM, i ) \ 90 { \ 91 GLuint count = IM->Count; \ 92 IM->Elt[count] = i; \ 93 IM->Flag[count] = ((IM->Flag[count] & IM->ArrayAndFlags) | \ 94 VERT_ELT); \ 95 IM->FlushElt |= IM->ArrayEltFlush; \ 96 IM->Count = count += IM->ArrayIncr; \ 97 if (count == VB_MAX) \ 98 IM->maybe_transform_vb( IM ); \ 97 99 } 98 100 … … 125 127 if (mode < GL_POINTS || mode > GL_POLYGON) { 126 128 gl_compile_error( CC, GL_INVALID_ENUM, "glBegin" ); 127 return; 129 return; 128 130 } 129 131 … … 251 253 * color-material and vertex arrays. 252 254 */ 253 #define COLOR( IM, r,g,b,a ) \254 { \255 GLuint count = IM->Count; \256 IM->Flag[count] |= VERT_RGBA; \257 IM->Color[count][0] = r; \258 IM->Color[count][1] = g; \259 IM->Color[count][2] = b; \260 IM->Color[count][3] = a; \255 #define COLOR( IM, r,g,b,a ) \ 256 { \ 257 GLuint count = IM->Count; \ 258 IM->Flag[count] |= VERT_RGBA; \ 259 IM->Color[count][0] = r; \ 260 IM->Color[count][1] = g; \ 261 IM->Color[count][2] = b; \ 262 IM->Color[count][3] = a; \ 261 263 } 262 264 263 265 #if 0 264 #define COLOR4F( IM, r,g,b,a ) \265 { \266 GLuint count = IM->Count; \267 IM->Flag[count] |= VERT_RGBA | VERT_FLOAT_RGBA; \268 IM->FloatColor[count][0] = r; \269 IM->FloatColor[count][1] = g; \270 IM->FloatColor[count][2] = b; \271 IM->FloatColor[count][3] = a; \266 #define COLOR4F( IM, r,g,b,a ) \ 267 { \ 268 GLuint count = IM->Count; \ 269 IM->Flag[count] |= VERT_RGBA | VERT_FLOAT_RGBA; \ 270 IM->FloatColor[count][0] = r; \ 271 IM->FloatColor[count][1] = g; \ 272 IM->FloatColor[count][2] = b; \ 273 IM->FloatColor[count][3] = a; \ 272 274 } 273 275 #else 274 #define COLOR4F(IM, r, g, b, a) \275 { \276 GLubyte col[4]; \277 FLOAT_COLOR_TO_UBYTE_COLOR(col[0], r); \278 FLOAT_COLOR_TO_UBYTE_COLOR(col[1], g); \279 FLOAT_COLOR_TO_UBYTE_COLOR(col[2], b); \280 FLOAT_COLOR_TO_UBYTE_COLOR(col[3], a); \281 COLORV( IM, col ); \276 #define COLOR4F(IM, r, g, b, a) \ 277 { \ 278 GLubyte col[4]; \ 279 FLOAT_COLOR_TO_UBYTE_COLOR(col[0], r); \ 280 FLOAT_COLOR_TO_UBYTE_COLOR(col[1], g); \ 281 FLOAT_COLOR_TO_UBYTE_COLOR(col[2], b); \ 282 FLOAT_COLOR_TO_UBYTE_COLOR(col[3], a); \ 283 COLORV( IM, col ); \ 282 284 } 283 285 #endif … … 285 287 286 288 287 #define COLORV( IM, v ) \288 { \289 GLuint count = IM->Count; \290 IM->Flag[count] |= VERT_RGBA; \291 COPY_4UBV(IM->Color[count], v); \289 #define COLORV( IM, v ) \ 290 { \ 291 GLuint count = IM->Count; \ 292 IM->Flag[count] |= VERT_RGBA; \ 293 COPY_4UBV(IM->Color[count], v); \ 292 294 } 293 295 … … 297 299 GET_IMMEDIATE; 298 300 COLOR( IM, 299 BYTE_TO_UBYTE(red),300 BYTE_TO_UBYTE(green),301 BYTE_TO_UBYTE(blue),302 255 );301 BYTE_TO_UBYTE(red), 302 BYTE_TO_UBYTE(green), 303 BYTE_TO_UBYTE(blue), 304 255 ); 303 305 } 304 306 … … 339 341 GET_IMMEDIATE; 340 342 COLOR( IM, INT_TO_UBYTE(red), 341 INT_TO_UBYTE(green),342 INT_TO_UBYTE(blue),343 255);343 INT_TO_UBYTE(green), 344 INT_TO_UBYTE(blue), 345 255); 344 346 } 345 347 … … 349 351 GET_IMMEDIATE; 350 352 COLOR( IM, SHORT_TO_UBYTE(red), 351 SHORT_TO_UBYTE(green),352 SHORT_TO_UBYTE(blue),353 255);353 SHORT_TO_UBYTE(green), 354 SHORT_TO_UBYTE(blue), 355 255); 354 356 } 355 357 … … 366 368 GET_IMMEDIATE; 367 369 COLOR( IM, UINT_TO_UBYTE(red), 368 UINT_TO_UBYTE(green),369 UINT_TO_UBYTE(blue),370 255 );370 UINT_TO_UBYTE(green), 371 UINT_TO_UBYTE(blue), 372 255 ); 371 373 } 372 374 … … 376 378 GET_IMMEDIATE; 377 379 COLOR( IM, USHORT_TO_UBYTE(red), USHORT_TO_UBYTE(green), 378 USHORT_TO_UBYTE(blue),379 255 );380 USHORT_TO_UBYTE(blue), 381 255 ); 380 382 } 381 383 … … 385 387 GET_IMMEDIATE; 386 388 COLOR( IM, BYTE_TO_UBYTE(red), BYTE_TO_UBYTE(green), 387 BYTE_TO_UBYTE(blue), BYTE_TO_UBYTE(alpha) );389 BYTE_TO_UBYTE(blue), BYTE_TO_UBYTE(alpha) ); 388 390 } 389 391 390 392 391 393 void GLAPIENTRY glColor4d(CTX_ARG GLdouble red, GLdouble green, GLdouble blue, 392 GLdouble alpha )394 GLdouble alpha ) 393 395 { 394 396 GLubyte col[4]; … … 426 428 GET_IMMEDIATE; 427 429 COLOR( IM, INT_TO_UBYTE(red), INT_TO_UBYTE(green), 428 INT_TO_UBYTE(blue), INT_TO_UBYTE(alpha) );430 INT_TO_UBYTE(blue), INT_TO_UBYTE(alpha) ); 429 431 } 430 432 … … 435 437 GET_IMMEDIATE; 436 438 COLOR( IM, SHORT_TO_UBYTE(red), SHORT_TO_UBYTE(green), 437 SHORT_TO_UBYTE(blue), SHORT_TO_UBYTE(alpha) );439 SHORT_TO_UBYTE(blue), SHORT_TO_UBYTE(alpha) ); 438 440 } 439 441 … … 450 452 GET_IMMEDIATE; 451 453 COLOR( IM, UINT_TO_UBYTE(red), UINT_TO_UBYTE(green), 452 UINT_TO_UBYTE(blue), UINT_TO_UBYTE(alpha) );454 UINT_TO_UBYTE(blue), UINT_TO_UBYTE(alpha) ); 453 455 } 454 456 … … 458 460 GET_IMMEDIATE; 459 461 COLOR( IM, USHORT_TO_UBYTE(red), USHORT_TO_UBYTE(green), 460 USHORT_TO_UBYTE(blue), USHORT_TO_UBYTE(alpha) );462 USHORT_TO_UBYTE(blue), USHORT_TO_UBYTE(alpha) ); 461 463 } 462 464 … … 466 468 GET_IMMEDIATE; 467 469 COLOR( IM, BYTE_TO_UBYTE(v[0]), BYTE_TO_UBYTE(v[1]), 468 BYTE_TO_UBYTE(v[2]), 255 );470 BYTE_TO_UBYTE(v[2]), 255 ); 469 471 } 470 472 … … 505 507 GET_IMMEDIATE; 506 508 COLOR( IM, INT_TO_UBYTE(v[0]), INT_TO_UBYTE(v[1]), 507 INT_TO_UBYTE(v[2]), 255 );509 INT_TO_UBYTE(v[2]), 255 ); 508 510 } 509 511 … … 513 515 GET_IMMEDIATE; 514 516 COLOR( IM, SHORT_TO_UBYTE(v[0]), SHORT_TO_UBYTE(v[1]), 515 SHORT_TO_UBYTE(v[2]), 255 );517 SHORT_TO_UBYTE(v[2]), 255 ); 516 518 } 517 519 … … 528 530 GET_IMMEDIATE; 529 531 COLOR( IM, UINT_TO_UBYTE(v[0]), UINT_TO_UBYTE(v[1]), 530 UINT_TO_UBYTE(v[2]), 255 );532 UINT_TO_UBYTE(v[2]), 255 ); 531 533 } 532 534 … … 536 538 GET_IMMEDIATE; 537 539 COLOR( IM, USHORT_TO_UBYTE(v[0]), USHORT_TO_UBYTE(v[1]), 538 USHORT_TO_UBYTE(v[2]), 255 );540 USHORT_TO_UBYTE(v[2]), 255 ); 539 541 540 542 } … … 545 547 GET_IMMEDIATE; 546 548 COLOR( IM, BYTE_TO_UBYTE(v[0]), BYTE_TO_UBYTE(v[1]), 547 BYTE_TO_UBYTE(v[2]), BYTE_TO_UBYTE(v[3]) );549 BYTE_TO_UBYTE(v[2]), BYTE_TO_UBYTE(v[3]) ); 548 550 } 549 551 … … 585 587 GET_IMMEDIATE; 586 588 COLOR( IM, INT_TO_UBYTE(v[0]), INT_TO_UBYTE(v[1]), 587 INT_TO_UBYTE(v[2]), INT_TO_UBYTE(v[3]) );589 INT_TO_UBYTE(v[2]), INT_TO_UBYTE(v[3]) ); 588 590 } 589 591 … … 593 595 GET_IMMEDIATE; 594 596 COLOR( IM, SHORT_TO_UBYTE(v[0]), SHORT_TO_UBYTE(v[1]), 595 SHORT_TO_UBYTE(v[2]), SHORT_TO_UBYTE(v[3]) );597 SHORT_TO_UBYTE(v[2]), SHORT_TO_UBYTE(v[3]) ); 596 598 } 597 599 … … 608 610 GET_IMMEDIATE; 609 611 COLOR( IM, UINT_TO_UBYTE(v[0]), UINT_TO_UBYTE(v[1]), 610 UINT_TO_UBYTE(v[2]), UINT_TO_UBYTE(v[3]) );612 UINT_TO_UBYTE(v[2]), UINT_TO_UBYTE(v[3]) ); 611 613 } 612 614 … … 616 618 GET_IMMEDIATE; 617 619 COLOR( IM, USHORT_TO_UBYTE(v[0]), USHORT_TO_UBYTE(v[1]), 618 USHORT_TO_UBYTE(v[2]), USHORT_TO_UBYTE(v[3]) );620 USHORT_TO_UBYTE(v[2]), USHORT_TO_UBYTE(v[3]) ); 619 621 } 620 622 … … 833 835 state = IM->BeginState; 834 836 inflags = (~state) & (VERT_BEGIN_0|VERT_BEGIN_1); 835 state |= inflags << 2; /* errors */837 state |= inflags << 2; /* errors */ 836 838 837 839 if (MESA_VERBOSE&VERBOSE_API) { 838 840 if (MESA_VERBOSE&VERBOSE_IMMEDIATE) 839 fprintf(stderr, "glEnd(IM %d), BeginState is %x, errors %x\n",840 IM->id, state,841 inflags<<2);841 fprintf(stderr, "glEnd(IM %d), BeginState is %x, errors %x\n", 842 IM->id, state, 843 inflags<<2); 842 844 else 843 fprintf(stderr, ">");845 fprintf(stderr, ">"); 844 846 } 845 847 … … 857 859 858 860 if (IM->FlushElt) { 859 gl_exec_array_elements( IM->backref, IM, last, count );860 IM->FlushElt = 0;861 gl_exec_array_elements( IM->backref, IM, last, count ); 862 IM->FlushElt = 0; 861 863 } 862 864 } … … 881 883 if (MESA_VERBOSE&VERBOSE_API) { 882 884 if (MESA_VERBOSE&VERBOSE_IMMEDIATE) 883 fprintf(stderr, "gl_End(IM %d), BeginState is %x, errors %x\n",884 IM->id, state,885 inflags<<2);885 fprintf(stderr, "gl_End(IM %d), BeginState is %x, errors %x\n", 886 IM->id, state, 887 inflags<<2); 886 888 else 887 fprintf(stderr, ">");889 fprintf(stderr, ">"); 888 890 } 889 891 890 state |= inflags << 2; /* errors */892 state |= inflags << 2; /* errors */ 891 893 892 894 if (inflags != (VERT_BEGIN_0|VERT_BEGIN_1)) … … 902 904 903 905 if (IM->FlushElt) { 904 gl_exec_array_elements( ctx, IM, last, count );905 IM->FlushElt = 0;906 gl_exec_array_elements( ctx, IM, last, count ); 907 IM->FlushElt = 0; 906 908 } 907 909 } … … 950 952 951 953 952 #define EVALCOORD1(IM, x) \ 953 { \ 954 GLuint count = IM->Count++; \ 955 IM->Flag[count] |= VERT_EVAL_C1; \ 956 ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \ 957 if (count == VB_MAX-1) \ 958 IM->maybe_transform_vb( IM ); \ 959 } 960 961 #define EVALCOORD2(IM, x, y) \ 962 { \ 963 GLuint count = IM->Count++; \ 964 IM->Flag[count] |= VERT_EVAL_C2; \ 965 ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \ 966 if (count == VB_MAX-1) \ 967 IM->maybe_transform_vb( IM ); \ 968 } 969 970 #define EVALPOINT1(IM, x) \ 971 { \ 972 GLuint count = IM->Count++; \ 973 IM->Flag[count] |= VERT_EVAL_P1; \ 974 ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \ 975 if (count == VB_MAX-1) \ 976 IM->maybe_transform_vb( IM ); \ 977 } 978 979 #define EVALPOINT2(IM, x, y) \ 980 { \ 981 GLuint count = IM->Count++; \ 982 IM->Flag[count] |= VERT_EVAL_P2; \ 983 ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \ 984 if (count == VB_MAX-1) \ 985 IM->maybe_transform_vb( IM ); \ 954 #define EVALCOORD1(IM, x) \ 955 { \ 956 GLuint count = IM->Count++; \ 957 IM->Flag[count] |= VERT_EVAL_C1; \ 958 ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \ 959 if (count == VB_MAX-1) \ 960 IM->maybe_transform_vb( IM ); \ 961 } 962 963 #define EVALCOORD2(IM, x, y) \ 964 { \ 965 GLuint count = IM->Count++; \ 966 IM->Flag[count] |= VERT_EVAL_C2; \ 967 ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \ 968 WriteLog("OPENGL32: EVALCOORD2 (%f,%f) IM: %08X - cnt %d\n",x,y,IM,count); \ 969 if (count == VB_MAX-1) \ 970 {WriteLog("OPENGL32: EVALCOORD2 is calling maybe_transform\n"); \ 971 IM->maybe_transform_vb( IM ); }\ 972 } 973 974 #define EVALPOINT1(IM, x) \ 975 { \ 976 GLuint count = IM->Count++; \ 977 IM->Flag[count] |= VERT_EVAL_P1; \ 978 ASSIGN_4V(IM->Obj[count], x, 0, 0, 1); \ 979 if (count == VB_MAX-1) \ 980 IM->maybe_transform_vb( IM ); \ 981 } 982 983 #define EVALPOINT2(IM, x, y) \ 984 { \ 985 GLuint count = IM->Count++; \ 986 IM->Flag[count] |= VERT_EVAL_P2; \ 987 ASSIGN_4V(IM->Obj[count], x, y, 0, 1); \ 988 if (count == VB_MAX-1) \ 989 IM->maybe_transform_vb( IM ); \ 986 990 } 987 991 … … 1173 1177 case GL_FOG_END: 1174 1178 case GL_FOG_INDEX: 1175 p[0] = (GLfloat) *params;1176 break;1179 p[0] = (GLfloat) *params; 1180 break; 1177 1181 case GL_FOG_COLOR: 1178 p[0] = INT_TO_FLOAT( params[0] );1179 p[1] = INT_TO_FLOAT( params[1] );1180 p[2] = INT_TO_FLOAT( params[2] );1181 p[3] = INT_TO_FLOAT( params[3] );1182 break;1182 p[0] = INT_TO_FLOAT( params[0] ); 1183 p[1] = INT_TO_FLOAT( params[1] ); 1184 p[2] = INT_TO_FLOAT( params[2] ); 1185 p[3] = INT_TO_FLOAT( params[3] ); 1186 break; 1183 1187 default: 1184 1188 /* Error will be caught later in gl_Fogfv */ … … 1477 1481 1478 1482 1479 #define INDEX( c ) \1480 { \1481 GLuint count; \1482 GET_IMMEDIATE; \1483 count = IM->Count; \1484 IM->Index[count] = c; \1485 IM->Flag[count] |= VERT_INDEX; \1483 #define INDEX( c ) \ 1484 { \ 1485 GLuint count; \ 1486 GET_IMMEDIATE; \ 1487 count = IM->Count; \ 1488 IM->Index[count] = c; \ 1489 IM->Flag[count] |= VERT_INDEX; \ 1486 1490 } 1487 1491 … … 1740 1744 1741 1745 for (i=0;i<16;i++) { 1742 fm[i] = (GLfloat) m[i];1746 fm[i] = (GLfloat) m[i]; 1743 1747 } 1744 1748 … … 1946 1950 1947 1951 for (i=0;i<16;i++) { 1948 fm[i] = (GLfloat) m[i];1952 fm[i] = (GLfloat) m[i]; 1949 1953 } 1950 1954 … … 1974 1978 * (ie shared) normals. 1975 1979 */ 1976 #define NORMAL( x,y,z ) \1977 { \1978 GLuint count; \1979 GLfloat *normal; \1980 GET_IMMEDIATE; \1981 count = IM->Count; \1982 IM->Flag[count] |= VERT_NORM; \1983 normal = IM->Normal[count]; \1984 ASSIGN_3V(normal, x,y,z); \1980 #define NORMAL( x,y,z ) \ 1981 { \ 1982 GLuint count; \ 1983 GLfloat *normal; \ 1984 GET_IMMEDIATE; \ 1985 count = IM->Count; \ 1986 IM->Flag[count] |= VERT_NORM; \ 1987 normal = IM->Normal[count]; \ 1988 ASSIGN_3V(normal, x,y,z); \ 1985 1989 } 1986 1990 … … 1989 1993 { 1990 1994 NORMAL( BYTE_TO_FLOAT(nx), 1991 BYTE_TO_FLOAT(ny),1992 BYTE_TO_FLOAT(nz) );1995 BYTE_TO_FLOAT(ny), 1996 BYTE_TO_FLOAT(nz) ); 1993 1997 } 1994 1998 … … 2009 2013 { 2010 2014 NORMAL( INT_TO_FLOAT(nx), 2011 INT_TO_FLOAT(ny),2012 INT_TO_FLOAT(nz) );2015 INT_TO_FLOAT(ny), 2016 INT_TO_FLOAT(nz) ); 2013 2017 } 2014 2018 … … 2017 2021 { 2018 2022 NORMAL( SHORT_TO_FLOAT(nx), 2019 SHORT_TO_FLOAT(ny),2020 SHORT_TO_FLOAT(nz) );2023 SHORT_TO_FLOAT(ny), 2024 SHORT_TO_FLOAT(nz) ); 2021 2025 } 2022 2026 … … 2025 2029 { 2026 2030 NORMAL( BYTE_TO_FLOAT(v[0]), 2027 BYTE_TO_FLOAT(v[1]),2028 BYTE_TO_FLOAT(v[2]) );2031 BYTE_TO_FLOAT(v[1]), 2032 BYTE_TO_FLOAT(v[2]) ); 2029 2033 } 2030 2034 … … 2045 2049 { 2046 2050 NORMAL( INT_TO_FLOAT(v[0]), 2047 INT_TO_FLOAT(v[1]),2048 INT_TO_FLOAT(v[2]) );2051 INT_TO_FLOAT(v[1]), 2052 INT_TO_FLOAT(v[2]) ); 2049 2053 } 2050 2054 … … 2053 2057 { 2054 2058 NORMAL( SHORT_TO_FLOAT(v[0]), 2055 SHORT_TO_FLOAT(v[1]),2056 SHORT_TO_FLOAT(v[2]) );2057 } 2058 2059 SHORT_TO_FLOAT(v[1]), 2060 SHORT_TO_FLOAT(v[2]) ); 2061 } 2062
Note:
See TracChangeset
for help on using the changeset viewer.
