Changeset 3079 for trunk/src


Ignore:
Timestamp:
Mar 11, 2000, 10:05:07 AM (25 years ago)
Author:
jeroen
Message:

* empty log message *

Location:
trunk/src/opengl
Files:
18 edited

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:00 jeroen Exp $ */
     1/* $Id: glcurveval.cpp,v 1.2 2000-03-11 09:05:01 jeroen Exp $ */
    22/*
    33** License Applicability. Except to the extent portions of this file are
     
    3737 * glcurveval.c++
    3838 *
    39  * $Date: 2000-02-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:00 jeroen 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 $
    4141 */
    4242
     
    8888OpenGLCurveEvaluator::addMap(CurveMap *m)
    8989{
    90         m = m;
     90        m = m;
    9191}
    9292
     
    9494OpenGLCurveEvaluator::range1f(long type, REAL *from, REAL *to)
    9595{
    96         type = type;
    97         from = from;
    98         to = to;
     96        type = type;
     97        from = from;
     98        to = to;
    9999}
    100100
     
    102102OpenGLCurveEvaluator::domain1f(REAL ulo, REAL uhi)
    103103{
    104         ulo = ulo;
    105         uhi = uhi;
     104        ulo = ulo;
     105        uhi = uhi;
    106106}
    107107
     
    202202void
    203203OpenGLCurveEvaluator::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 */
    210210)
    211211{
     
    216216      switch(type){
    217217      case GL_MAP1_VERTEX_3:
    218         which = 0;
    219         dimension = 3;
    220         break;
     218        which = 0;
     219        dimension = 3;
     220        break;
    221221      case GL_MAP1_VERTEX_4:
    222         which=0;
    223         dimension = 4;
    224         break;
     222        which=0;
     223        dimension = 4;
     224        break;
    225225      case GL_MAP1_INDEX:
    226         which=2;
    227         dimension = 1;
    228         break;
     226        which=2;
     227        dimension = 1;
     228        break;
    229229      case GL_MAP1_COLOR_4:
    230         which=2;
    231         dimension = 4;
    232         break;
     230        which=2;
     231        dimension = 4;
     232        break;
    233233      case GL_MAP1_NORMAL:
    234         which=1;
    235         dimension = 3;
    236         break;
     234        which=1;
     235        dimension = 3;
     236        break;
    237237      case GL_MAP1_TEXTURE_COORD_1:
    238         which=3;
    239         dimension = 1;
    240         break;
     238        which=3;
     239        dimension = 1;
     240        break;
    241241      case GL_MAP1_TEXTURE_COORD_2:
    242         which=3;
    243         dimension = 2;
    244         break;
    245        
     242        which=3;
     243        dimension = 2;
     244        break;
     245
    246246      case GL_MAP1_TEXTURE_COORD_3:
    247         which=3;
    248         dimension = 3;
    249         break;
     247        which=3;
     248        dimension = 3;
     249        break;
    250250      case GL_MAP1_TEXTURE_COORD_4:
    251         which=3;
    252         dimension = 4;
    253         break; 
     251        which=3;
     252        dimension = 4;
     253        break;
    254254      }
    255       inMap1f(which, dimension, ulo, uhi, stride, order, pts); 
     255      inMap1f(which, dimension, ulo, uhi, stride, order, pts);
    256256    }
    257257  else
    258258    glMap1f((GLenum) type, (GLfloat) ulo, (GLfloat) uhi, (GLint) stride,
    259             (GLint) order, (const GLfloat *) pts);
     259            (GLint) order, (const GLfloat *) pts);
    260260}
    261261
     
    276276      case N_MESHFILL:
    277277      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;
    280280      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;
    283283      }
    284284    }
     
    304304
    305305void
    306 OpenGLCurveEvaluator::putCallBack(GLenum which, GLvoid (GLAPI *fn)(...))
     306OpenGLCurveEvaluator::putCallBack(GLenum which, GLvoid (GLCALLBACK *fn)(...))
    307307{
    308308  switch(which)
    309309  {
    310310    case GLU_NURBS_BEGIN:
    311       beginCallBackN = (void (GLAPI *) (GLenum)) fn;
     311      beginCallBackN = (void (GLCALLBACK *) (GLenum)) fn;
    312312      break;
    313313    case GLU_NURBS_END:
    314       endCallBackN = (void (GLAPI *) (void)) fn;
     314      endCallBackN = (void (GLCALLBACK *) (void)) fn;
    315315      break;
    316316    case GLU_NURBS_VERTEX:
    317       vertexCallBackN = (void (GLAPI *) (const GLfloat*)) fn;
     317      vertexCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn;
    318318      break;
    319319    case GLU_NURBS_NORMAL:
    320       normalCallBackN = (void (GLAPI *) (const GLfloat*)) fn;
     320      normalCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn;
    321321      break;
    322322    case GLU_NURBS_COLOR:
    323       colorCallBackN = (void (GLAPI *) (const GLfloat*)) fn;
     323      colorCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn;
    324324      break;
    325325    case GLU_NURBS_TEXTURE_COORD:
    326       texcoordCallBackN = (void (GLAPI *) (const GLfloat*)) fn;
     326      texcoordCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn;
    327327      break;
    328328    case GLU_NURBS_BEGIN_DATA:
    329       beginCallBackData = (void (GLAPI *) (GLenum, void*)) fn;
     329      beginCallBackData = (void (GLCALLBACK *) (GLenum, void*)) fn;
    330330      break;
    331331    case GLU_NURBS_END_DATA:
    332       endCallBackData = (void (GLAPI *) (void*)) fn;
     332      endCallBackData = (void (GLCALLBACK *) (void*)) fn;
    333333      break;
    334334    case GLU_NURBS_VERTEX_DATA:
    335       vertexCallBackData = (void (GLAPI *) (const GLfloat*, void*)) fn;
     335      vertexCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn;
    336336      break;
    337337    case GLU_NURBS_NORMAL_DATA:
    338       normalCallBackData = (void (GLAPI *) (const GLfloat*, void*)) fn;
     338      normalCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn;
    339339      break;
    340340    case GLU_NURBS_COLOR_DATA:
    341       colorCallBackData = (void (GLAPI *) (const GLfloat*, void*)) fn;
     341      colorCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn;
    342342      break;
    343343    case GLU_NURBS_TEXTURE_COORD_DATA:
    344       texcoordCallBackData = (void (GLAPI *) (const GLfloat*, void*)) fn;
     344      texcoordCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn;
    345345      break;
    346346  }
  • trunk/src/opengl/glu/nurbs/interface/glcurveval.h

    r2689 r3079  
    1 /* $Id: glcurveval.h,v 1.1 2000-02-09 08:49:01 jeroen Exp $ */
     1/* $Id: glcurveval.h,v 1.2 2000-03-11 09:05:02 jeroen Exp $ */
    22/*
    33** License Applicability. Except to the extent portions of this file are
     
    3737 * glcurveval.h
    3838 *
    39  * $Date: 2000-02-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:01 jeroen 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 $
    4141 */
    4242
     
    7272class OpenGLCurveEvaluator : public BasicCurveEvaluator  {
    7373public:
    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 *);
    7979
    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);
    8989
    90     void                bgnline(void);
    91     void                endline(void);
     90    void                bgnline(void);
     91    void                endline(void);
    9292
    9393    void                put_vertices_call_back(int flag)
    9494      {
    95         output_triangles = flag;
     95        output_triangles = flag;
    9696      }
    97     void               putCallBack(GLenum which, GLvoid (GLAPI *fn)(...));
     97    void               putCallBack(GLenum which, GLvoid (GLCALLBACK *fn)(...));
    9898    void               set_callback_userData(void *data)
    9999      {
    100         userData = data;
     100        userData = data;
    101101      }
    102102
     
    116116
    117117void 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);
    124124
    125125void inPreEvaluate(int order, REAL vprime, REAL *coeff);
     
    128128void inMapMesh1f(int umin, int umax);
    129129
    130 void     (GLAPI *beginCallBackN) (GLenum type);
    131 void     (GLAPI *endCallBackN)   (void);
    132 void     (GLAPI *vertexCallBackN) (const GLfloat *vert);
    133 void     (GLAPI *normalCallBackN) (const GLfloat *normal);
    134 void     (GLAPI *colorCallBackN) (const GLfloat *color);
    135 void     (GLAPI *texcoordCallBackN) (const GLfloat *texcoord);
     130void     (GLCALLBACK *beginCallBackN) (GLenum type);
     131void     (GLCALLBACK *endCallBackN)   (void);
     132void     (GLCALLBACK *vertexCallBackN) (const GLfloat *vert);
     133void     (GLCALLBACK *normalCallBackN) (const GLfloat *normal);
     134void     (GLCALLBACK *colorCallBackN) (const GLfloat *color);
     135void     (GLCALLBACK *texcoordCallBackN) (const GLfloat *texcoord);
    136136
    137 void     (GLAPI *beginCallBackData) (GLenum type, void* data);
    138 void     (GLAPI *endCallBackData)   (void* data);
    139 void     (GLAPI *vertexCallBackData) (const GLfloat *vert, void* data);
    140 void     (GLAPI *normalCallBackData) (const GLfloat *normal, void* data);
    141 void     (GLAPI *colorCallBackData) (const GLfloat *color, void* data);
    142 void     (GLAPI *texcoordCallBackData) (const GLfloat *texcoord, void* data);
     137void     (GLCALLBACK *beginCallBackData) (GLenum type, void* data);
     138void     (GLCALLBACK *endCallBackData)   (void* data);
     139void     (GLCALLBACK *vertexCallBackData) (const GLfloat *vert, void* data);
     140void     (GLCALLBACK *normalCallBackData) (const GLfloat *normal, void* data);
     141void     (GLCALLBACK *colorCallBackData) (const GLfloat *color, void* data);
     142void     (GLCALLBACK *texcoordCallBackData) (const GLfloat *texcoord, void* data);
    143143
    144 void* userData; //the opaque pointer for Data callback functions
    145 void  beginCallBack(GLenum type, void* data);
     144void* userData;           /* the opaque pointer for Data callback functions*/
     145void beginCallBack(GLenum type, void* data);
    146146void endCallBack(void* data);
    147147void 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 sandervl Exp $ */
     1/* $Id: glinterface.cpp,v 1.3 2000-03-11 09:05:02 jeroen Exp $ */
    22/*
    33** License Applicability. Except to the extent portions of this file are
     
    3333** compliant with the OpenGL(R) version 1.2.1 Specification.
    3434**
    35 ** $Date: 2000-02-29 13:56:48 $ $Revision: 1.2 $
     35** $Date: 2000-03-11 09:05:02 $ $Revision: 1.3 $
    3636*/
    3737/*
    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 sandervl Exp $
     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 $
    3939*/
    4040
     
    6363void glu_LOD_eval_list(GLUnurbs *nurb, int level)
    6464{
    65         nurb->LOD_eval_list(level);
     65        nurb->LOD_eval_list(level);
    6666}
    6767
     
    152152void GLAPI
    153153gluPwlCurve(GLUnurbs *r, GLint count, INREAL array[],
    154                 GLint stride, GLenum type)
     154                GLint stride, GLenum type)
    155155{
    156156#ifdef DOWN_LOAD_NURBS
     
    161161    switch(type) {
    162162      case GLU_MAP1_TRIM_2:
    163         realType = N_P2D;
    164         break;
     163        realType = N_P2D;
     164        break;
    165165      case GLU_MAP1_TRIM_3:
    166         realType = N_P2DR;
    167         break;
     166        realType = N_P2DR;
     167        break;
    168168      default:
    169         realType = type;
    170         break;
     169        realType = type;
     170        break;
    171171    }
    172172    r->pwlcurve(count, array, sizeof(INREAL) * stride, realType);
     
    175175void GLAPI
    176176gluNurbsCurve(GLUnurbs *r, GLint nknots, INREAL knot[], GLint stride,
    177                   INREAL ctlarray[], GLint order, GLenum type)
     177                  INREAL ctlarray[], GLint order, GLenum type)
    178178{
    179179#ifdef DOWN_LOAD_NURBS
     
    185185    switch(type) {
    186186      case GLU_MAP1_TRIM_2:
    187         realType = N_P2D;
    188         break;
     187        realType = N_P2D;
     188        break;
    189189      case GLU_MAP1_TRIM_3:
    190         realType = N_P2DR;
    191         break;
     190        realType = N_P2DR;
     191        break;
    192192      default:
    193         realType = type;
    194         break;
     193        realType = type;
     194        break;
    195195    }
    196196
    197197    r->nurbscurve(nknots, knot, sizeof(INREAL) * stride, ctlarray, order,
    198             realType);
     198            realType);
    199199}
    200200
    201201void GLAPI
    202202gluNurbsSurface(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)
    207207{
    208208#ifdef DOWN_LOAD_NURBS
     
    221221    }
    222222tempNurb = 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
    229229  }
    230230#endif
    231231
    232232    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);
    235235}
    236236
    237237void GLAPI
    238238gluLoadSamplingMatrices(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])
    241241{
    242242    r->useGLMatrices(modelMatrix, projMatrix, viewport);
     
    251251      case GLU_AUTO_LOAD_MATRIX:
    252252        r->setautoloadmode(value);
    253         return;
     253        return;
    254254
    255255      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);
    265265        return;
    266266
    267267      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;
    274274            r->set_is_domain_distance_sampling(1); //optimzing untrimmed case
    275275
    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 {
    285285            r->postError(GLU_INVALID_VALUE);
    286286            return;
    287287        }
    288288
    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;
    294294
    295295      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;
    301301
    302302      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);
    304304        r->setnurbsproperty(GL_MAP2_VERTEX_4, N_ERROR_TOLERANCE, value);
    305305        r->setnurbsproperty(GL_MAP1_VERTEX_3, N_ERROR_TOLERANCE, value);
    306306        r->setnurbsproperty(GL_MAP1_VERTEX_4, N_ERROR_TOLERANCE, value);
    307307        return;
    308        
     308
    309309
    310310      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;
    325325
    326326      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 case
     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 case
    333333        r->set_domain_distance_u_rate(value);
    334         break;
     334        break;
    335335
    336336      case GLU_V_STEP:
     
    340340        r->setnurbsproperty(GL_MAP2_VERTEX_4, N_T_STEPS, value);
    341341
    342         //added for optimizing untrimmed case
     342        //added for optimizing untrimmed case
    343343        r->set_domain_distance_v_rate(value);
    344         break;
    345        
     344        break;
     345
    346346      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         else
    352           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;
    354354
    355355      default:
    356         r->postError(GLU_INVALID_ENUM);
    357         return;
     356        r->postError(GLU_INVALID_ENUM);
     357        return;
    358358    }
    359359}
     
    366366    switch(property) {
    367367      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;
    374374      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;
    382382      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;
    395395      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;
    398398      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);
    400400        break;
    401401
    402402      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;
    405405      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;
    408408      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;
    418418
    419419      case GLU_NURBS_MODE:
    420         if(r->is_callback())
    421           *value = GLU_NURBS_TESSELLATOR;
    422         else
    423           *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
    426426      default:
    427         r->postError(GLU_INVALID_ENUM);
    428         return;
     427        r->postError(GLU_INVALID_ENUM);
     428        return;
    429429    }
    430430}
     
    446446    case GLU_NURBS_TEXTURE_COORD_DATA:
    447447    case GLU_NURBS_COLOR_DATA:
    448         nobj->putSurfCallBack(which, (GLvoid (*)(...))fn);
     448        nobj->putSurfCallBack(which, (GLvoid (* GLCALLBACK)(...))fn);
    449449        break;
    450450
    451451    case GLU_NURBS_ERROR:
    452         nobj->errorCallback = (void (*)( GLenum )) fn;
     452        nobj->errorCallback = (void (* GLCALLBACK)( GLenum )) fn;
    453453        break;
    454454    default:
  • trunk/src/opengl/glu/nurbs/interface/glrenderer.h

    r2689 r3079  
    1 /* $Id: glrenderer.h,v 1.1 2000-02-09 08:49:01 jeroen Exp $ */
     1/* $Id: glrenderer.h,v 1.2 2000-03-11 09:05:02 jeroen Exp $ */
    22/*
    33** License Applicability. Except to the extent portions of this file are
     
    3737 * glrenderer.h
    3838 *
    39  * $Date: 2000-02-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:01 jeroen 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 $
    4141 */
    4242
     
    5656    void        loadGLMatrices( void );
    5757    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 );
    6161
    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                    {
    7367
    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;
    7770
    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)(...))
    7979      {
    80         curveEvaluator.putCallBack(which, fn);
    81         surfaceEvaluator.putCallBack(which, fn);
     80        curveEvaluator.putCallBack(which, fn);
     81        surfaceEvaluator.putCallBack(which, fn);
    8282      }
    8383
    8484    int         get_vertices_call_back()
    8585      {
    86         return surfaceEvaluator.get_vertices_call_back();
     86        return surfaceEvaluator.get_vertices_call_back();
    8787      }
    8888
    8989    void        put_vertices_call_back(int flag)
    9090      {
    91         surfaceEvaluator.put_vertices_call_back(flag);
     91        surfaceEvaluator.put_vertices_call_back(flag);
    9292      }
    9393
     
    112112    void LOD_eval_list(int level)
    113113      {
    114         surfaceEvaluator.LOD_eval_list(level);
     114        surfaceEvaluator.LOD_eval_list(level);
    115115      }
    116116
     
    118118    int        is_callback()
    119119      {
    120         return callbackFlag;
     120        return callbackFlag;
    121121      }
    122122    void       put_callbackFlag(int flag)
    123123      {
    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);
    127127      }
    128128
    129129private:
    130     GLboolean                   autoloadmode;
    131     OpenGLSurfaceEvaluator      surfaceEvaluator;
    132     OpenGLCurveEvaluator        curveEvaluator;
     130    GLboolean                   autoloadmode;
     131    OpenGLSurfaceEvaluator      surfaceEvaluator;
     132    OpenGLCurveEvaluator        curveEvaluator;
    133133
    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] );
    142142
    143143   int                  callbackFlag;
  • trunk/src/opengl/glu/nurbs/interface/glsurfeval.cpp

    r2996 r3079  
    1 /* $Id: glsurfeval.cpp,v 1.2 2000-03-04 19:10:13 jeroen Exp $ */
     1/* $Id: glsurfeval.cpp,v 1.3 2000-03-11 09:05:02 jeroen Exp $ */
    22/*
    33** License Applicability. Except to the extent portions of this file are
     
    3737 * glsurfeval.c++
    3838 *
    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:13 jeroen 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 $
    4141 */
    4242
     
    5252#include "bezierPatchMesh.h"
    5353
    54 
    5554//extern int surfcount;
    5655//int surfcount=0;
    5756
    58 /*#define USE_INTERNAL_EVAL*/ //use internal evaluator
     57#define USE_INTERNAL_EVAL                     /* use internal evaluator*/
    5958
    6059/*whether do evaluation or not*/
     
    11261125    glEvalCoord2f((GLfloat) u, (GLfloat) v);
    11271126
    1128 
    11291127#endif
    11301128
     
    11921190
    11931191void
    1194 OpenGLSurfaceEvaluator::putCallBack(GLenum which, GLvoid (GLAPI *fn)(...))
     1192OpenGLSurfaceEvaluator::putCallBack(GLenum which, GLvoid (GLCALLBACK *fn)(...))
    11951193{
    11961194  switch(which)
    11971195    {
    11981196    case GLU_NURBS_BEGIN:
    1199       beginCallBackN = (void (GLAPI *) (GLenum)) fn;
     1197      beginCallBackN = (void (GLCALLBACK *) (GLenum)) fn;
    12001198      break;
    12011199    case GLU_NURBS_END:
    1202       endCallBackN = (void (GLAPI *) (void)) fn;
     1200      endCallBackN = (void (GLCALLBACK *) (void)) fn;
    12031201      break;
    12041202    case GLU_NURBS_VERTEX:
    1205       vertexCallBackN = (void (GLAPI *) (const GLfloat*)) fn;
     1203      vertexCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn;
    12061204      break;
    12071205    case GLU_NURBS_NORMAL:
    1208       normalCallBackN = (void (GLAPI *) (const GLfloat*)) fn;
     1206      normalCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn;
    12091207      break;
    12101208    case GLU_NURBS_COLOR:
    1211       colorCallBackN = (void (GLAPI *) (const GLfloat*)) fn;
     1209      colorCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn;
    12121210      break;
    12131211    case GLU_NURBS_TEXTURE_COORD:
    1214       texcoordCallBackN = (void (GLAPI *) (const GLfloat*)) fn;
     1212      texcoordCallBackN = (void (GLCALLBACK *) (const GLfloat*)) fn;
    12151213      break;
    12161214    case GLU_NURBS_BEGIN_DATA:
    1217       beginCallBackData = (void (GLAPI *) (GLenum, void*)) fn;
     1215      beginCallBackData = (void (GLCALLBACK *) (GLenum, void*)) fn;
    12181216      break;
    12191217    case GLU_NURBS_END_DATA:
    1220       endCallBackData = (void (GLAPI *) (void*)) fn;
     1218      endCallBackData = (void (GLCALLBACK *) (void*)) fn;
    12211219      break;
    12221220    case GLU_NURBS_VERTEX_DATA:
    1223       vertexCallBackData = (void (GLAPI *) (const GLfloat*, void*)) fn;
     1221      vertexCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn;
    12241222      break;
    12251223    case GLU_NURBS_NORMAL_DATA:
    1226       normalCallBackData = (void (GLAPI *) (const GLfloat*, void*)) fn;
     1224      normalCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn;
    12271225      break;
    12281226    case GLU_NURBS_COLOR_DATA:
    1229       colorCallBackData = (void (GLAPI *) (const GLfloat*, void*)) fn;
     1227      colorCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn;
    12301228      break;
    12311229    case GLU_NURBS_TEXTURE_COORD_DATA:
    1232       texcoordCallBackData = (void (GLAPI *) (const GLfloat*, void*)) fn;
     1230      texcoordCallBackData = (void (GLCALLBACK *) (const GLfloat*, void*)) fn;
    12331231      break;
    12341232
  • trunk/src/opengl/glu/nurbs/interface/glsurfeval.h

    r2689 r3079  
    1 /* $Id: glsurfeval.h,v 1.1 2000-02-09 08:49:02 jeroen Exp $ */
     1/* $Id: glsurfeval.h,v 1.2 2000-03-11 09:05:03 jeroen Exp $ */
    22/*
    33** License Applicability. Except to the extent portions of this file are
     
    3737 * glsurfeval.h
    3838 *
    39  * $Date: 2000-02-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:02 jeroen 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 $
    4141 */
    4242
     
    6262#define IN_MAX_BEZIER_ORDER 40 /*XXX should be bigger than machine order*/
    6363#endif
    64                        
     64
    6565#ifndef IN_MAX_DIMENSION
    6666#define IN_MAX_DIMENSION 4
     
    9090class StoredVertex {
    9191public:
    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);
    9999
    100100private:
    101     int         type;
    102     REAL        coord[2];
    103     long        point[2];
     101    int         type;
     102    REAL        coord[2];
     103    long        point[2];
    104104};
    105105
    106106class OpenGLSurfaceEvaluator : public BasicSurfaceEvaluator {
    107107public:
    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 );
    135135
    136136    void                bgntfan( void );
     
    141141                                   int n_right, REAL u_right, REAL* right_val);
    142142
    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)(...));
    150150    int                 get_vertices_call_back()
    151151      {
    152         return output_triangles;
     152        return output_triangles;
    153153      }
    154154    void                put_vertices_call_back(int flag)
    155155      {
    156         output_triangles = flag;
     156        output_triangles = flag;
    157157      }
    158158
     
    179179
    180180private:
    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;
    185185
    186186    GLint              gl_polygon_mode[2];/*to save and restore so that
    187                                         *no side effect
    188                                         */
     187                                        *no side effect
     188                                        */
    189189    bezierPatchMesh        *global_bpm; //for output triangles
    190190    int                output_triangles; //true 1 or false 0
     
    192192
    193193
    194     void (GLAPI *beginCallBackN) (GLenum type);
    195     void (GLAPI *endCallBackN)   (void);
    196     void (GLAPI *vertexCallBackN) (const GLfloat *vert);
    197     void (GLAPI *normalCallBackN) (const GLfloat *normal);
    198     void (GLAPI *colorCallBackN) (const GLfloat *color);
    199     void (GLAPI *texcoordCallBackN) (const GLfloat *texcoord);
    200 
    201     void (GLAPI *beginCallBackData) (GLenum type, void* data);
    202     void (GLAPI *endCallBackData)   (void* data);
    203     void (GLAPI *vertexCallBackData) (const GLfloat *vert, void* data);
    204     void (GLAPI *normalCallBackData) (const GLfloat *normal, void* data);
    205     void (GLAPI *colorCallBackData) (const GLfloat *color, void* data);
    206     void (GLAPI *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.*/
    217217
    218218   /*LOD evaluation*/
    219219   void LOD_triangle(REAL A[2], REAL B[2], REAL C[2],
    220                      int level);
     220                     int level);
    221221   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()           */
    224224
    225225   /*************begin for internal evaluators*****************/
    226                        
     226
    227227 /*the following global variables are only defined in this file.
    228228 *They are used to cache the precomputed Bezier polynomial values.
     
    272272/*functions*/
    273273 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);
    278278 void inPreEvaluate(int order, REAL vprime, REAL *coeff);
    279279 void inPreEvaluateWithDeriv(int order, REAL vprime, REAL *coeff, REAL *coeffDeriv);
     
    281281 void inComputeNormal2(REAL *pu, REAL *pv, REAL *n);
    282282 void inDoEvalCoord2(REAL u, REAL v,
    283                      REAL *retPoint, REAL *retNormal);
     283                     REAL *retPoint, REAL *retNormal);
    284284 void inDoEvalCoord2NOGE(REAL u, REAL v,
    285                      REAL *retPoint, REAL *retNormal);
     285                     REAL *retPoint, REAL *retNormal);
    286286 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);
    296296
    297297 void inMapGrid2f(int nu, REAL u0, REAL u1,
    298                   int nv, REAL v0, REAL v1);
     298                  int nv, REAL v0, REAL v1);
    299299
    300300 void inEvalMesh2(int lowU, int lowV, int highU, int highV);
     
    303303
    304304void 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]);
    306306
    307307void 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]);
    309309
    310310void inEvalUStrip(int n_upper, REAL v_upper, REAL* upper_val,
     
    326326
    327327void 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);
    332332
    333333void 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);
    338338
    339339
    340340void inDoEvalCoord2NOGE_BV(REAL u, REAL v,
    341                            REAL *retPoint, REAL *retNormal);
     341                           REAL *retPoint, REAL *retNormal);
    342342
    343343void inDoEvalCoord2NOGE_BU(REAL u, REAL v,
    344                            REAL *retPoint, REAL *retNormal);
     344                           REAL *retPoint, REAL *retNormal);
    345345
    346346void inBPMEval(bezierPatchMesh* bpm);
     
    362362
    363363void 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);
    374374
    375375void inDoDomain2WithDerivsEM(surfEvalMachine *em, REAL u, REAL v,
    376                                 REAL *retPoint, REAL *retdu, REAL *retdv);
     376                                REAL *retPoint, REAL *retdu, REAL *retdv);
    377377void inDoDomain2EM(surfEvalMachine *em, REAL u, REAL v,
    378                                 REAL *retPoint);
     378                                REAL *retPoint);
    379379 void inDoEvalCoord2EM(REAL u, REAL v);
    380380
     
    386386
    387387   /*************end for internal evaluators*****************/
    388                
     388
    389389};
    390390
     
    393393    switch(type) {
    394394      case TYPECOORD:
    395         eval->coord2f(coord[0], coord[1]);
    396         break;
     395        eval->coord2f(coord[0], coord[1]);
     396        break;
    397397      case TYPEPOINT:
    398         eval->point2i(point[0], point[1]);
    399         break;
     398        eval->point2i(point[0], point[1]);
     399        break;
    400400      default:
    401         break;
     401        break;
    402402    }
    403403}
  • trunk/src/opengl/glu/nurbs/interface/insurfeval.cpp

    r2689 r3079  
    1 /* $Id: insurfeval.cpp,v 1.1 2000-02-09 08:49:02 jeroen Exp $ */
     1/* $Id: insurfeval.cpp,v 1.2 2000-03-11 09:05:03 jeroen Exp $ */
    22/*
    33** License Applicability. Except to the extent portions of this file are
     
    3333** compliant with the OpenGL(R) version 1.2.1 Specification.
    3434**
    35 ** $Date: 2000-02-09 08:49:02 $ $Revision: 1.1 $
     35** $Date: 2000-03-11 09:05:03 $ $Revision: 1.2 $
    3636*/
    3737/*
    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:02 jeroen 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 $
    3939*/
    4040
     
    6666
    6767static 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)
    6969{
    7070  REAL a,a1,b,b1;
     
    9494
    9595void OpenGLSurfaceEvaluator::LOD_triangle(REAL A[2], REAL B[2], REAL C[2],
    96                         int level)
     96                        int level)
    9797{
    9898  int k,j;
     
    118118
    119119      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);
    122122#ifdef USE_LOD
    123123          LOD_EVAL_COORD(u,v);
    124 //        glEvalCoord2f(u,v);
     124//        glEvalCoord2f(u,v);
    125125#else
    126           inDoEvalCoord2EM(u,v);
     126          inDoEvalCoord2EM(u,v);
    127127#endif
    128128
    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);
    130130
    131131#ifdef USE_LOD
    132           LOD_EVAL_COORD(u,v);
    133 //        glEvalCoord2f(u,v);
     132          LOD_EVAL_COORD(u,v);
     133//        glEvalCoord2f(u,v);
    134134#else
    135           inDoEvalCoord2EM(u,v);
     135          inDoEvalCoord2EM(u,v);
    136136#endif
    137         }
    138 //      endCallBack(); 
     137        }
     138//      endCallBack();
    139139glEnd();
    140140    }
     
    142142
    143143void OpenGLSurfaceEvaluator::LOD_eval(int num_vert, REAL* verts, int type,
    144                      int level
    145                      )
     144                     int level
     145                     )
    146146{
    147147  int i,k;
     
    151151    for(i=2, k=4; i<=num_vert-2; i+=2, k+=4)
    152152      {
    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                      );
     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                     );
    159159      }
    160160    if(num_vert % 2 ==1)
    161161      {
    162         LOD_triangle(verts+2*(num_vert-3), verts+2*(num_vert-2), verts+2*(num_vert-1),
    163                      level
    164                      );
     162        LOD_triangle(verts+2*(num_vert-3), verts+2*(num_vert-2), verts+2*(num_vert-1),
     163                     level
     164                     );
    165165      }
    166166    break;
     
    168168    for(i=1, k=2; i<=num_vert-2; i++, k+=2)
    169169      {
    170         LOD_triangle(verts,verts+k, verts+k+2,
    171                      level
    172                      );
     170        LOD_triangle(verts,verts+k, verts+k+2,
     171                     level
     172                     );
    173173      }
    174174    break;
     
    178178  }
    179179}
    180        
     180
    181181
    182182#endif //USE_LOD
     
    256256  int vstride = bpm->bpatch->dimension;
    257257  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);
    268268
    269269  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.*/
     
    13391339              leftMostV[1] = v_lower;
    13401340
    1341               leftMostNormal = lowerNormal[j-1];
    1342               leftMostXYZ = lowerXYZ[j-1];
     1341              leftMostNormal = lowerNormal[j-1];
     1342              leftMostXYZ = lowerXYZ[j-1];
    13431343            }
    13441344        }
     
    14231423            {
    14241424              bgntfan();
    1425               glNormal3fv(botMostNormal);
     1425              glNormal3fv(botMostNormal);
    14261426              glVertex3fv(botMostXYZ);
    14271427
    14281428              while(j<n_right){
    1429                 glNormal3fv(rightNormal[j]);
    1430                 glVertex3fv(rightXYZ[j]);
    1431                 j++;
     1429                glNormal3fv(rightNormal[j]);
     1430                glVertex3fv(rightXYZ[j]);
     1431                j++;
    14321432
    14331433              }
     
    14411441            {
    14421442              bgntfan();
    1443               glNormal3fv(botMostNormal);
    1444               glVertex3fv(botMostXYZ);
    1445        
     1443              glNormal3fv(botMostNormal);
     1444              glVertex3fv(botMostXYZ);
     1445
    14461446              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                }
    14511451
    14521452              endtfan();
     
    14581458          if(left_val[i] <= right_val[j])
    14591459            {
    1460               bgntfan();
    1461 
    1462               glNormal3fv(rightNormal[j]);
    1463               glVertex3fv(rightXYZ[j]);
     1460              bgntfan();
     1461
     1462              glNormal3fv(rightNormal[j]);
     1463              glVertex3fv(rightXYZ[j]);
    14641464
    14651465              /*find the last k>=i such that
     
    14801480              for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/
    14811481                {
    1482                   glNormal3fv(leftNormal[l]);
    1483                   glVertex3fv(leftXYZ[l]);
     1482                  glNormal3fv(leftNormal[l]);
     1483                  glVertex3fv(leftXYZ[l]);
    14841484
    14851485                }
    1486               glNormal3fv(botMostNormal);
    1487               glVertex3fv(botMostXYZ);
     1486              glNormal3fv(botMostNormal);
     1487              glVertex3fv(botMostXYZ);
    14881488
    14891489              endtfan();
     
    14931493              i = k+1;
    14941494
    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];
    14991499            }
    15001500          else /*left_val[i] > right_val[j])*/
    15011501            {
    1502               bgntfan();
    1503               glNormal3fv(leftNormal[i]);
    1504               glVertex3fv(leftXYZ[i]);
    1505        
     1502              bgntfan();
     1503              glNormal3fv(leftNormal[i]);
     1504              glVertex3fv(leftXYZ[i]);
     1505
    15061506              glNormal3fv(botMostNormal);
    1507               glVertex3fv(botMostXYZ);
    1508        
     1507              glVertex3fv(botMostXYZ);
     1508
    15091509
    15101510              /*find the last k>=j such that
     
    15161516                  if(right_val[k] >= left_val[i])
    15171517                    break;
    1518                   glNormal3fv(rightNormal[k]);
    1519                   glVertex3fv(rightXYZ[k]);
     1518                  glNormal3fv(rightNormal[k]);
     1519                  glVertex3fv(rightXYZ[k]);
    15201520
    15211521                  k++;
     
    15261526               */
    15271527              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];
    15331533            }
    15341534        }
     
    15361536  //clean up
    15371537  free(leftXYZ);
    1538   free(leftXYZ);
    1539   free(rightNormal);
     1538  free(rightXYZ);
     1539  free(leftNormal);
    15401540  free(rightNormal);
    15411541}
     
    15431543/*-----------------------begin evalMachine-------------------*/
    15441544void 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)
    15541554{
    15551555  int i,j,x;
     
    20462046#endif //GENERIC_TEST
    20472047
    2048             inDoEvalCoord2EM(u,v);
     2048            inDoEvalCoord2EM(u,v);
    20492049
    20502050#endif //USE_LOD
    20512051
    2052           k += 2;
    2053         }
     2052          k += 2;
     2053        }
    20542054      endCallBack(userData);
    20552055
  • trunk/src/opengl/glu/nurbs/internals/slicer.cpp

    r2689 r3079  
    1 /* $Id: slicer.cpp,v 1.1 2000-02-09 08:50:28 jeroen Exp $ */
     1/* $Id: slicer.cpp,v 1.2 2000-03-11 09:05:03 jeroen Exp $ */
    22/*
    33** License Applicability. Except to the extent portions of this file are
     
    3737 * slicer.c++
    3838 *
    39  * $Date: 2000-02-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:28 jeroen 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 $
    4141 */
    4242
     
    5555#include "varray.h"
    5656
    57 #include "polyUtil.h" //for area()
     57#include "polyUtil.h"                  /* for area()                       */
    5858
    5959//static int count=0;
     
    111111
    112112  n_changes  = (compV2InX(loop->prev->head(), loop->prev->tail())
    113                 != cur_sign);
     113                != cur_sign);
    114114
    115115  for(temp=loop->next; temp != loop; temp = temp->next)
     
    120120       {
    121121#ifdef DEBUG
    122         printf("***change signe\n");
     122        printf("***change signe\n");
    123123#endif
    124         n_changes++;
     124        n_changes++;
    125125       }
    126126    }
     
    154154      //first find bot
    155155      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        }
    160160      bot = temp->prev;
    161161      //then find top
    162162      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        }
    167167      top = temp;
    168168    }
     
    170170    {
    171171      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        }
    176176      top = temp->prev;
    177177      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        }
    182182      bot = temp;
    183183    }
     
    192192    {
    193193      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        }
    197197
    198198    }
     
    201201    {
    202202      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        }
    206206    }
    207207  for(i=bot->pwlArc->npts-2; i>=1; i--)
    208208    {
    209209      dec_chain.appendVertex(jarc->pwlArc->pts[i].param);
    210     }   
     210    }
    211211
    212212  monoTriangulationRec(top->tail(), bot->tail(), &inc_chain, 0,
    213                        &dec_chain, 0, &backend);
     213                       &dec_chain, 0, &backend);
    214214
    215215}
     
    225225      nlines++;
    226226      if(nlines == 5)
    227         break;
     227        break;
    228228    }
    229229  if(nlines != 4)
     
    238238printf("loop->next->head=(%f,%f)\n", loop->next->head()[0], loop->next->head()[1]);
    239239if(fabs(loop->tail()[0] - loop->head()[0])<0.000001)
    240         printf("equal 1\n");
     240        printf("equal 1\n");
    241241if(loop->next->tail()[1] == loop->next->head()[1])
    242         printf("equal 2\n");
     242        printf("equal 2\n");
    243243*/
    244244
     
    290290      int i;
    291291      for(i=0; i<n; i++)
    292         backend.tmeshvertNOGE(&verts[i]);
     292        backend.tmeshvertNOGE(&verts[i]);
    293293    }
    294294}
     
    319319    {
    320320      if(loop->tail()[1] > loop->prev->prev->tail()[1])
    321         {
    322 
    323         top = loop;
    324         }
     321        {
     322
     323        top = loop;
     324        }
    325325      else{
    326326
    327         top = loop->prev->prev;
    328         }
     327        top = loop->prev->prev;
     328        }
    329329    }
    330330  else
    331331    {
    332332      if(loop->tail()[0] > loop->prev->prev->tail()[0])
    333         {
    334           //loop is the right arc
    335 
    336           top = loop->next;
    337         }
     333        {
     334          //loop is the right arc
     335
     336          top = loop->next;
     337        }
    338338      else
    339         {
    340 
    341           top = loop->prev;
    342         }
     339        {
     340
     341          top = loop->prev;
     342        }
    343343    }
    344344  left = top->next;
     
    353353      int nu = top->pwlArc->npts;
    354354      if(nu < bot->pwlArc->npts)
    355         nu = bot->pwlArc->npts;
     355        nu = bot->pwlArc->npts;
    356356      int nv = left->pwlArc->npts;
    357357      if(nv < right->pwlArc->npts)
    358         nv = right->pwlArc->npts;
     358        nv = right->pwlArc->npts;
    359359/*
    360360      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        }
    365365*/
    366366    }
     
    376376
    377377      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);
    379379      else
    380         triangulateRectAux(top->pwlArc, bot->pwlArc, left->pwlArc, right->pwlArc, backend);
     380        triangulateRectAux(top->pwlArc, bot->pwlArc, left->pwlArc, right->pwlArc, backend);
    381381    }
    382382}
     
    397397
    398398      if(top->npts == 2) {
    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();
     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();
    415415      }
    416416      else if(bot->npts == 2) {
    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();
     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();
    433433      }
    434434      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 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        
     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
    569569      }
    570570    }
     
    573573
    574574static 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)
    577577{
    578578  TrimVertex trimVert;
     
    580580
    581581  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);
    583583
    584584  if(n_ulines>1 && n_vlines>1)
     
    593593      backend.bgnqstrip();
    594594      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        }
    603603      backend.endqstrip();
    604604
     
    617617      assert(upper_val);
    618618      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        }
    628628      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_val
    639                              );
    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        }
    641641
    642642      free(upper_val);
     
    649649      assert(left_val);
    650650      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        }
    660660      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_val
    669                              );
    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        }
    671671      free(left_val);
    672672      return;
    673673    }
    674        
     674
    675675  //the following is a different version of the above code. If you comment
    676676  //the above code, the following code will still work. The reason to leave
     
    689689      assert(temp_u_val);
    690690      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];
    692692    }
    693693  u_val = temp_u_val;
     
    699699      backend.bgntfan();
    700700      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;
    703703      }
    704704      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;
    708708      }
    709        
     709
    710710      backend.tmeshvert(& trimVert);
    711711      for(i=d1; i< parc->npts; i++)
    712         backend.tmeshvert(& parc->pts[i]);
     712        backend.tmeshvert(& parc->pts[i]);
    713713      backend.endtfan();
    714714
     
    723723      backend.tmeshvert(& parc->pts[parc->npts-1]);
    724724      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           else
    731             {
    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        }
    737737      backend.endtfan();
    738738
     
    744744    for(i=d1, j=d2; i>=0; i--, j++)
    745745      {
    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
    760760      }
    761761    backend.endqstrip();
     
    781781
    782782      if(loop->tail()[1] > loop->prev->prev->tail()[1])
    783         {
    784 
    785         top = loop;
    786         }
     783        {
     784
     785        top = loop;
     786        }
    787787      else{
    788788
    789         top = loop->prev->prev;
    790         }
     789        top = loop->prev->prev;
     790        }
    791791    }
    792792  else
    793793    {
    794794      if(loop->tail()[0] > loop->prev->prev->tail()[0])
    795         {
    796           //loop is the right arc
    797 
    798           top = loop->next;
    799         }
     795        {
     796          //loop is the right arc
     797
     798          top = loop->next;
     799        }
    800800      else
    801         {
    802 
    803           top = loop->prev;
    804         }
     801        {
     802
     803          top = loop->prev;
     804        }
    805805    }
    806806
     
    813813                 left->pwlArc->npts +
    814814                 bot->pwlArc->npts +
    815                   right->pwlArc->npts
    816                       + 2*n_ulines + 2*n_vlines
    817                         -8;
     815                  right->pwlArc->npts
     816                      + 2*n_ulines + 2*n_vlines
     817                        -8;
    818818  num_quads += (n_ulines-1)*(n_vlines-1);
    819819#endif
    820820/*
    821821  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);
    823823//  if(n_ulines>1 && n_vlines>1)
    824824    backend.surfmesh(0,0,n_ulines+1,n_vlines+1);
     
    911911      directedLine *dline = arcToDLine(arc);
    912912      if(ret == NULL)
    913         ret = dline;
     913        ret = dline;
    914914      else
    915         ret->insert(dline);
     915        ret->insert(dline);
    916916      return ret;
    917917    }
     
    919919    {
    920920      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           else
    933             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        }
    935935      return ret;
    936936    }
     
    938938
    939939
    940        
     940
    941941directedLine* arcLoopToDLineLoop(Arc_ptr loop)
    942942{
     
    970970      rectBlock* block = rbArray->get_element(l);
    971971      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        }
    988988    }
    989989
     
    10011001  //we need counter-clockwise.
    10021002  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);
    10041004
    10051005
     
    10111011
    10121012      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        }
    10161016    }
    10171017}
     
    10331033      case PRIMITIVE_STREAM_FAN:
    10341034
    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
    10491049      default:
    1050         fprintf(stderr, "evalStream: not implemented yet\n");
    1051         exit(1);
     1050        fprintf(stderr, "evalStream: not implemented yet\n");
     1051        exit(1);
    10521052
    10531053      }
     
    10551055  free(trimVert);
    10561056}
    1057        
    1058        
    1059        
     1057
     1058
     1059
    10601060
    10611061void Slicer::slice_new(Arc_ptr loop)
     
    11071107    {
    11081108      if(vlinear)
    1109         triangulateRect(loop, backend, 1, ulinear, vlinear);
     1109        triangulateRect(loop, backend, 1, ulinear, vlinear);
    11101110      else if(ulinear)
    1111         triangulateRect(loop, backend, -1, ulinear, vlinear);   
     1111        triangulateRect(loop, backend, -1, ulinear, vlinear);
    11121112      else
    1113         triangulateRect(loop, backend, 0, ulinear, vlinear);           
     1113        triangulateRect(loop, backend, 0, ulinear, vlinear);
    11141114    }
    11151115
     
    11511151  printf("num_quads = %i\n", num_quads);
    11521152#endif
     1153
    11531154}
    11541155
     
    11701171
    11711172Slicer::Slicer( Backend &b )
    1172         : CoveAndTiler( b ), Mesher( b ), backend( b )
     1173        : CoveAndTiler( b ), Mesher( b ), backend( b )
    11731174{
    11741175    ulinear = 0;
     
    12191220
    12201221    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             else
    1236                 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();
    12381239            if( isolines ) {
    1239                 outline();
    1240             } else {
    1241                 if( canTile() )
    1242                     coveAndTile();
    1243                 else
    1244                     mesh();
    1245             }
     1240                outline();
     1241            } else {
     1242                if( canTile() )
     1243                    coveAndTile();
     1244                else
     1245                    mesh();
     1246            }
    12461247        }
    12471248   }
     
    12571258    backend.bgnoutline();
    12581259    while( (nextupper( &upper )) ) {
    1259         if( upper.isGridVert() )
    1260             backend.linevert( upper.g );
    1261         else
    1262             backend.linevert( upper.t );
     1260        if( upper.isGridVert() )
     1261            backend.linevert( upper.g );
     1262        else
     1263            backend.linevert( upper.t );
    12631264    }
    12641265    backend.endoutline();
     
    12661267    backend.bgnoutline();
    12671268    while( (nextlower( &lower )) ) {
    1268         if( lower.isGridVert() )
    1269             backend.linevert( lower.g );
    1270         else
    1271             backend.linevert( lower.t );
     1269        if( lower.isGridVert() )
     1270            backend.linevert( lower.g );
     1271        else
     1272            backend.linevert( lower.t );
    12721273    }
    12731274    backend.endoutline();
     
    12811282
    12821283    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:38 jeroen Exp $ */
     1/* $Id: tess.c,v 1.2 2000-03-11 09:05:04 jeroen Exp $ */
    22/*
    33** License Applicability. Except to the extent portions of this file are
     
    3737** Author: Eric Veach, July 1994.
    3838**
    39 ** $Date: 2000-02-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:38 jeroen 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 $
    4141*/
    4242
     
    5959#define FALSE 0
    6060
    61 /*ARGSUSED*/ static void GLAPI noBegin( GLenum type ) {}
    62 /*ARGSUSED*/ static void GLAPI noEdgeFlag( GLboolean boundaryEdge ) {}
    63 /*ARGSUSED*/ static void GLAPI noVertex( void *data ) {}
    64 /*ARGSUSED*/ static void GLAPI noEnd( void ) {}
    65 /*ARGSUSED*/ static void GLAPI noError( GLenum errnum ) {}
    66 /*ARGSUSED*/ static void GLAPI noCombine( 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],
    6767                                    GLfloat weight[4], void **dataOut ) {}
    68 /*ARGSUSED*/ static void GLAPI noMesh( 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,
    7272                                             void *polygonData ) {}
    73 /*ARGSUSED*/ void GLAPI __gl_noEdgeFlagData( GLboolean boundaryEdge,
     73/*ARGSUSED*/ void __gl_noEdgeFlagData( GLboolean boundaryEdge,
    7474                                       void *polygonData ) {}
    75 /*ARGSUSED*/ void GLAPI __gl_noVertexData( void *data,
     75/*ARGSUSED*/ void __gl_noVertexData( void *data,
    7676                                              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,
    7979                                             void *polygonData ) {}
    80 /*ARGSUSED*/ void GLAPI __gl_noCombineData( GLdouble coords[3],
     80/*ARGSUSED*/ void __gl_noCombineData( GLdouble coords[3],
    8181                                               void *data[4],
    8282                                               GLfloat weight[4],
     
    105105
    106106  if (memInit( MAX_FAST_ALLOC ) == 0) {
    107      return 0;                  /* out of memory */
     107     return 0;                  /* out of memory */
    108108  }
    109109  tess = (GLUtesselator *)memAlloc( sizeof( GLUtesselator ));
    110110  if (tess == NULL) {
    111      return 0;                  /* out of memory */
     111     return 0;                  /* out of memory */
    112112  }
    113113
     
    167167      switch( tess->state ) {
    168168      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;
    172172      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;
    176176      }
    177177    } else {
    178178      switch( tess->state ) {
    179179      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;
    183183      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;
    188188      }
    189189    }
     
    192192
    193193
    194 void GLAPI
     194GLUAPI void GLAPIENTRY
    195195gluDeleteTess( GLUtesselator *tess )
    196196{
     
    200200
    201201
    202 void GLAPI
     202GLUAPI void GLAPIENTRY
    203203gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value )
    204204{
     
    213213  case GLU_TESS_WINDING_RULE:
    214214    windingRule = (GLenum) value;
    215     if( windingRule != value ) break;   /* not an integer */
     215    if( windingRule != value ) break;   /* not an integer */
    216216
    217217    switch( windingRule ) {
     
    239239
    240240/* Returns tessellator property */
    241 void GLAPI
     241GLUAPI void GLAPIENTRY
    242242gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value )
    243243{
     
    250250   case GLU_TESS_WINDING_RULE:
    251251      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);
    256256      *value= tess->windingRule;
    257257      break;
     
    267267} /* gluGetTessProperty() */
    268268
    269 void GLAPI
     269GLUAPI void GLAPIENTRY
    270270gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z )
    271271{
     
    275275}
    276276
    277 void GLAPI
    278 gluTessCallback( GLUtesselator *tess, GLenum which, void (GLAPI *fn)())
     277GLUAPI void GLAPIENTRY
     278gluTessCallback( GLUtesselator *tess, GLenum which, void (GLCALLBACK *fn)())
    279279{
    280280  switch( which ) {
    281281  case GLU_TESS_BEGIN:
    282     tess->callBegin = (fn == NULL) ? &noBegin : (void (GLAPI *)(GLenum)) fn;
     282    tess->callBegin = (fn == NULL) ? &noBegin : (void (GLCALLBACK *)(GLenum)) fn;
    283283    return;
    284284  case GLU_TESS_BEGIN_DATA:
    285285    tess->callBeginData = (fn == NULL) ?
    286         &__gl_noBeginData : (void (GLAPI *)(GLenum, void *)) fn;
     286        &__gl_noBeginData : (void (GLCALLBACK *)(GLenum, void *)) fn;
    287287    return;
    288288  case GLU_TESS_EDGE_FLAG:
    289289    tess->callEdgeFlag = (fn == NULL) ? &noEdgeFlag :
    290                                         (void (GLAPI *)(GLboolean)) fn;
     290                                        (void (GLCALLBACK *)(GLboolean)) fn;
    291291    /* If the client wants boundary edges to be flagged,
    292292     * we render everything as separate triangles (no strips or fans).
     
    296296  case GLU_TESS_EDGE_FLAG_DATA:
    297297    tess->callEdgeFlagData= (fn == NULL) ?
    298         &__gl_noEdgeFlagData : (void (GLAPI *)(GLboolean, void *)) fn;
     298        &__gl_noEdgeFlagData : (void (GLCALLBACK *)(GLboolean, void *)) fn;
    299299    /* If the client wants boundary edges to be flagged,
    300300     * we render everything as separate triangles (no strips or fans).
     
    304304  case GLU_TESS_VERTEX:
    305305    tess->callVertex = (fn == NULL) ? &noVertex :
    306                                       (void (GLAPI *)(void *)) fn;
     306                                      (void (GLCALLBACK *)(void *)) fn;
    307307    return;
    308308  case GLU_TESS_VERTEX_DATA:
    309309    tess->callVertexData = (fn == NULL) ?
    310         &__gl_noVertexData : (void (GLAPI *)(void *, void *)) fn;
     310        &__gl_noVertexData : (void (GLCALLBACK *)(void *, void *)) fn;
    311311    return;
    312312  case GLU_TESS_END:
    313     tess->callEnd = (fn == NULL) ? &noEnd : (void (GLAPI *)(void)) fn;
     313    tess->callEnd = (fn == NULL) ? &noEnd : (void (GLCALLBACK *)(void)) fn;
    314314    return;
    315315  case GLU_TESS_END_DATA:
    316316    tess->callEndData = (fn == NULL) ? &__gl_noEndData :
    317                                        (void (GLAPI *)(void *)) fn;
     317                                       (void (GLCALLBACK *)(void *)) fn;
    318318    return;
    319319  case GLU_TESS_ERROR:
    320     tess->callError = (fn == NULL) ? &noError : (void (GLAPI *)(GLenum)) fn;
     320    tess->callError = (fn == NULL) ? &noError : (void (GLCALLBACK *)(GLenum)) fn;
    321321    return;
    322322  case GLU_TESS_ERROR_DATA:
    323323    tess->callErrorData = (fn == NULL) ?
    324         &__gl_noErrorData : (void (GLAPI *)(GLenum, void *)) fn;
     324        &__gl_noErrorData : (void (GLCALLBACK *)(GLenum, void *)) fn;
    325325    return;
    326326  case GLU_TESS_COMBINE:
    327327    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;
    329329    return;
    330330  case GLU_TESS_COMBINE_DATA:
    331331    tess->callCombineData = (fn == NULL) ? &__gl_noCombineData :
    332                                            (void (GLAPI *)(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;
    337337    return;
    338338  case GLU_TESS_MESH:
    339     tess->callMesh = (fn == NULL) ? &noMesh : (void (GLAPI *)(GLUmesh *)) fn;
     339    tess->callMesh = (fn == NULL) ? &noMesh : (void (GLCALLBACK *)(GLUmesh *)) fn;
    340340    return;
    341341  default:
     
    414414
    415415
    416 void GLAPI
     416GLUAPI void GLAPIENTRY
    417417gluTessVertex( GLUtesselator *tess, GLdouble coords[3], void *data )
    418418{
     
    461461
    462462
    463 void GLAPI
     463GLUAPI void GLAPIENTRY
    464464gluTessBeginPolygon( GLUtesselator *tess, void *data )
    465465{
     
    475475
    476476
    477 void GLAPI
     477GLUAPI void GLAPIENTRY
    478478gluTessBeginContour( GLUtesselator *tess )
    479479{
     
    492492
    493493
    494 void GLAPI
     494GLUAPI void GLAPIENTRY
    495495gluTessEndContour( GLUtesselator *tess )
    496496{
     
    499499}
    500500
    501 void GLAPI
     501GLUAPI void GLAPIENTRY
    502502gluTessEndPolygon( GLUtesselator *tess )
    503503{
    504504  GLUmesh *mesh;
    505505
    506   if (setjmp(tess->env) != 0) { 
     506  if (setjmp(tess->env) != 0) {
    507507     /* come back here if out of memory */
    508508     CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY );
     
    522522       */
    523523      if( __gl_renderCache( tess )) {
    524         tess->polygonData= NULL;
    525         return;
     524        tess->polygonData= NULL;
     525        return;
    526526      }
    527527    }
     
    541541   */
    542542  if ( !__gl_computeInterior( tess ) ) {
    543      longjmp(tess->env,1);      /* could've used a label */
     543     longjmp(tess->env,1);      /* could've used a label */
    544544  }
    545545
     
    557557      rc = __gl_meshTessellateInterior( mesh );
    558558    }
    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 */
    560560
    561561    __gl_meshCheckMesh( mesh );
     
    569569    {
    570570      if( tess->boundaryOnly ) {
    571         __gl_renderBoundary( tess, mesh );  /* output boundary contours */
     571        __gl_renderBoundary( tess, mesh );  /* output boundary contours */
    572572      } else {
    573         __gl_renderMesh( tess, mesh );     /* output strips and fans */
     573        __gl_renderMesh( tess, mesh );     /* output strips and fans */
    574574      }
    575575    }
     
    583583       */
    584584      __gl_meshDiscardExterior( mesh );
    585       (*tess->callMesh)( mesh );                /* user wants the mesh itself */
     585      (*tess->callMesh)( mesh );                /* user wants the mesh itself */
    586586      tess->mesh = NULL;
    587587      tess->polygonData= NULL;
     
    595595
    596596
    597 void GLAPI
     597GLUAPI void GLAPIENTRY
    598598gluDeleteMesh( GLUmesh *mesh )
    599599{
     
    607607/* Obsolete calls -- for backward compatibility */
    608608
    609 void GLAPI
     609GLUAPI void GLAPIENTRY
    610610gluBeginPolygon( GLUtesselator *tess )
    611611{
     
    616616
    617617/*ARGSUSED*/
    618 void GLAPI
     618GLUAPI void GLAPIENTRY
    619619gluNextContour( GLUtesselator *tess, GLenum type )
    620620{
     
    624624
    625625
    626 void GLAPI
     626GLUAPI void GLAPIENTRY
    627627gluEndPolygon( GLUtesselator *tess )
    628628{
  • trunk/src/opengl/glu/tess/tess.h

    r2689 r3079  
    1 /* $Id: tess.h,v 1.1 2000-02-09 08:47:38 jeroen Exp $ */
     1/* $Id: tess.h,v 1.2 2000-03-11 09:05:04 jeroen Exp $ */
    22/*
    33** License Applicability. Except to the extent portions of this file are
     
    3737** Author: Eric Veach, July 1994.
    3838**
    39 ** $Date: 2000-02-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:38 jeroen 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 $
    4141*/
    4242
     
    5858 * try a quick-and-dirty decomposition first.
    5959 */
    60 #define TESS_MAX_CACHE  100
     60#define TESS_MAX_CACHE  100
    6161
    6262typedef struct CachedVertex {
    63   GLdouble      coords[3];
    64   void          *data;
     63  GLdouble      coords[3];
     64  void          *data;
    6565} CachedVertex;
    6666
     
    6969  /*** state needed for collecting the input data ***/
    7070
    71   enum TessState state;         /* what begin/end calls have we seen? */
     71  enum TessState state;         /* what begin/end calls have we seen? */
    7272
    73   GLUhalfEdge   *lastEdge;      /* lastEdge->Org is the most recent vertex */
    74   GLUmesh       *mesh;          /* stores the input contours, and eventually
     73  GLUhalfEdge   *lastEdge;      /* lastEdge->Org is the most recent vertex */
     74  GLUmesh       *mesh;          /* stores the input contours, and eventually
    7575                                   the tessellation itself */
    7676
    77   void          (GLAPI *callError)( GLenum errnum );
     77  void          (GLCALLBACK *callError)( GLenum errnum );
    7878
    7979  /*** state needed for projecting onto the sweep plane ***/
    8080
    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) */
    8484
    8585  /*** state needed for the line sweep ***/
    8686
    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 */
    9090
    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 */
    9494
    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 );
    9797
    9898  /*** state needed for rendering callbacks (see render.c) ***/
    9999
    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;
    103103    /* list of triangles which could not be rendered as strips or fans */
    104104
    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 );
    110110
    111111
    112112  /*** state needed to cache single-contour polygons for renderCache() */
    113113
    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                  */
    117117
    118118  /*** 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 );
    128128
    129   jmp_buf env;                  /* place to jump to when memAllocs fail */
     129  jmp_buf env;                      /* place to jump to when memAllocs fail*/
    130130
    131   void *polygonData;            /* client data for current polygon */
     131  void *polygonData;                     /* client data for current polygon*/
    132132};
    133133
    134 void GLAPI __gl_noBeginData( GLenum type, void *polygonData );
    135 void GLAPI __gl_noEdgeFlagData( GLboolean boundaryEdge, void *polygonData );
    136 void GLAPI __gl_noVertexData( void *data, void *polygonData );
    137 void GLAPI __gl_noEndData( void *polygonData );
    138 void GLAPI __gl_noErrorData( GLenum errnum, void *polygonData );
    139 void GLAPI __gl_noCombineData( GLdouble coords[3], void *data[4],
    140                         GLfloat weight[4], void **outData,
    141                         void *polygonData );
     134void GLCALLBACK __gl_noBeginData( GLenum type, void *polygonData );
     135void GLCALLBACK __gl_noEdgeFlagData( GLboolean boundaryEdge, void *polygonData );
     136void GLCALLBACK __gl_noVertexData( void *data, void *polygonData );
     137void GLCALLBACK __gl_noEndData( void *polygonData );
     138void GLCALLBACK __gl_noErrorData( GLenum errnum, void *polygonData );
     139void GLCALLBACK __gl_noCombineData( GLdouble coords[3], void *data[4],
     140                        GLfloat weight[4], void **outData,
     141                        void *polygonData );
    142142
    143143#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 $ */
    22/*
    33** License Applicability. Except to the extent portions of this file are
     
    3333** compliant with the OpenGL(R) version 1.2.1 Specification.
    3434**
    35 ** $Date: 2000-02-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 $
    3737*/
    3838
     
    5555    GLint       orientation;
    5656    GLint       drawStyle;
    57     void        (GLAPI *errorCallback)( GLint );
     57    void        (GLCALLBACK *errorCallback)( GLint );
    5858};
    5959
     
    6565    newstate = (GLUquadric *) malloc(sizeof(GLUquadric));
    6666    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;
    6969    }
    7070    newstate->normals = GLU_SMOOTH;
     
    8686{
    8787    if (qobj->errorCallback) {
    88         qobj->errorCallback(which);
     88        qobj->errorCallback(which);
    8989    }
    9090}
    9191
    9292void GLAPI
    93 gluQuadricCallback(GLUquadric *qobj, GLenum which, void (GLAPI *fn)())
     93gluQuadricCallback(GLUquadric *qobj, GLenum which, void (GLCALLBACK *fn)())
    9494{
    9595    switch (which) {
    9696      case GLU_ERROR:
    97         qobj->errorCallback = (void (GLAPI *)(GLint)) fn;
    98         break;
     97        qobj->errorCallback = (void (GLCALLBACK *)(GLint)) fn;
     98        break;
    9999      default:
    100         gluQuadricError(qobj, GLU_INVALID_ENUM);
    101         return;
     100        gluQuadricError(qobj, GLU_INVALID_ENUM);
     101        return;
    102102    }
    103103}
     
    110110      case GLU_FLAT:
    111111      case GLU_NONE:
    112         break;
     112        break;
    113113      default:
    114         gluQuadricError(qobj, GLU_INVALID_ENUM);
    115         return;
     114        gluQuadricError(qobj, GLU_INVALID_ENUM);
     115        return;
    116116    }
    117117    qobj->normals = normals;
     
    130130      case GLU_OUTSIDE:
    131131      case GLU_INSIDE:
    132         break;
     132        break;
    133133      default:
    134         gluQuadricError(qobj, GLU_INVALID_ENUM);
    135         return;
     134        gluQuadricError(qobj, GLU_INVALID_ENUM);
     135        return;
    136136    }
    137137    qobj->orientation = orientation;
     
    146146      case GLU_FILL:
    147147      case GLU_SILHOUETTE:
    148         break;
     148        break;
    149149      default:
    150         gluQuadricError(qobj, GLU_INVALID_ENUM);
    151         return;
     150        gluQuadricError(qobj, GLU_INVALID_ENUM);
     151        return;
    152152    }
    153153    qobj->drawStyle = drawStyle;
     
    156156void GLAPI
    157157gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius,
    158                 GLdouble height, GLint slices, GLint stacks)
     158                GLdouble height, GLint slices, GLint stacks)
    159159{
    160160    GLint i,j,max;
     
    178178
    179179    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;
    183183    }
    184184
     
    187187    length = SQRT(deltaRadius*deltaRadius + height*height);
    188188    if (length == 0.0) {
    189         gluQuadricError(qobj, GLU_INVALID_VALUE);
    190         return;
     189        gluQuadricError(qobj, GLU_INVALID_VALUE);
     190        return;
    191191    }
    192192
     
    196196    needCache2 = needCache3 = 0;
    197197    if (qobj->normals == GLU_SMOOTH) {
    198         needCache2 = 1;
     198        needCache2 = 1;
    199199    }
    200200
    201201    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        }
    208208    }
    209209
     
    212212
    213213    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);
    226226    }
    227227
    228228    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        }
    239239    }
    240240
     
    242242    cosCache[slices] = cosCache[0];
    243243    if (needCache2) {
    244         sinCache2[slices] = sinCache2[0];
    245         cosCache2[slices] = cosCache2[0];
     244        sinCache2[slices] = sinCache2[0];
     245        cosCache2[slices] = cosCache2[0];
    246246    }
    247247    if (needCache3) {
    248         sinCache3[slices] = sinCache3[0];
    249         cosCache3[slices] = cosCache3[0];
     248        sinCache3[slices] = sinCache3[0];
     249        cosCache3[slices] = cosCache3[0];
    250250    }
    251251
    252252    switch (qobj->drawStyle) {
    253253      case GLU_FILL:
    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;
     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;
    315315      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;
    343343      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... */
    371371      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;
    425425      default:
    426         break;
     426        break;
    427427    }
    428428}
     
    430430void GLAPI
    431431gluDisk(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius,
    432             GLint slices, GLint loops)
     432            GLint slices, GLint loops)
    433433{
    434434    gluPartialDisk(qobj, innerRadius, outerRadius, slices, loops, 0.0, 360.0);
     
    437437void GLAPI
    438438gluPartialDisk(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)
    441441{
    442442    GLint i,j,max;
     
    455455    if (slices >= CACHE_SIZE) slices = CACHE_SIZE-1;
    456456    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;
    460460    }
    461461
     
    463463    if (sweepAngle > 360.0) sweepAngle = 360.0;
    464464    if (sweepAngle < 0) {
    465         startAngle += sweepAngle;
    466         sweepAngle = -sweepAngle;
     465        startAngle += sweepAngle;
     466        sweepAngle = -sweepAngle;
    467467    }
    468468
    469469    if (sweepAngle == 360.0) {
    470         slices2 = slices;
     470        slices2 = slices;
    471471    } else {
    472         slices2 = slices + 1;
     472        slices2 = slices + 1;
    473473    }
    474474
     
    480480    angleOffset = startAngle / 180.0 * PI;
    481481    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);
    485485    }
    486486
    487487    if (sweepAngle == 360.0) {
    488         sinCache[slices] = sinCache[0];
    489         cosCache[slices] = cosCache[0];
     488        sinCache[slices] = sinCache[0];
     489        cosCache[slices] = cosCache[0];
    490490    }
    491491
     
    493493      case GLU_FLAT:
    494494      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;
    501501      default:
    502502      case GLU_NONE:
    503         break;
     503        break;
    504504    }
    505505
    506506    switch (qobj->drawStyle) {
    507507      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;
    588588      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;
    607607      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;
    658658      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;
    696696      default:
    697         break;
     697        break;
    698698    }
    699699}
     
    727727    if (stacks >= CACHE_SIZE) stacks = CACHE_SIZE-1;
    728728    if (slices < 2 || stacks < 1 || radius < 0.0) {
    729         gluQuadricError(qobj, GLU_INVALID_VALUE);
    730         return;
     729        gluQuadricError(qobj, GLU_INVALID_VALUE);
     730        return;
    731731    }
    732732
     
    737737
    738738    if (qobj->normals == GLU_SMOOTH) {
    739         needCache2 = GL_TRUE;
     739        needCache2 = GL_TRUE;
    740740    }
    741741
    742742    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        }
    749749    }
    750750
    751751    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        }
    759759    }
    760760
    761761    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);
    774774    }
    775775    /* Make sure it comes to a point */
     
    778778
    779779    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        }
    795795    }
    796796
     
    798798    cosCache1a[slices] = cosCache1a[0];
    799799    if (needCache2) {
    800         sinCache2a[slices] = sinCache2a[0];
    801         cosCache2a[slices] = cosCache2a[0];
     800        sinCache2a[slices] = sinCache2a[0];
     801        cosCache2a[slices] = cosCache2a[0];
    802802    }
    803803    if (needCache3) {
    804         sinCache3a[slices] = sinCache3a[0];
    805         cosCache3a[slices] = cosCache3a[0];
     804        sinCache3a[slices] = sinCache3a[0];
     805        cosCache3a[slices] = cosCache3a[0];
    806806    }
    807807
    808808    switch (qobj->drawStyle) {
    809809      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 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;
     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;
    10411041      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;
    10801080      case GLU_LINE:
    10811081      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;
    11621162      default:
    1163         break;
     1163        break;
    11641164    }
    11651165}
  • trunk/src/opengl/glut/glut_event.c

    r3022 r3079  
    1 /* $Id: glut_event.c,v 1.5 2000-03-05 10:19:38 jeroen Exp $ */
     1/* $Id: glut_event.c,v 1.6 2000-03-11 09:05:04 jeroen Exp $ */
    22/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1997, 1998. */
    33
     
    321321processEventsAndTimeouts(void)
    322322{
     323  WriteLog("processEventsAndTimeouts() entry\n");
    323324  do {
    324325#if defined(_WIN32) || defined(__WIN32OS2__)
     
    826827#endif /* _WIN32 */
    827828    if (__glutTimerList) {
     829  WriteLog("processEventsAndTimeouts -> Calling handleTimeouts\n");
    828830      handleTimeouts();
     831  WriteLog("processEventsAndTimeouts -> Call handleTimeouts returned\n");
    829832    }
    830833  }
     
    931934  if (XPending(__glutDisplay)) {
    932935  immediatelyHandleXinput:
     936    WriteLog("waitForSmoething: Calling processEventsAndTimeouts\n");
    933937    processEventsAndTimeouts();
     938    WriteLog("waitForSmoething: Call processEventsAndTimeouts returned\n");
    934939  } else {
    935940    if (__glutTimerList)
     
    942947{
    943948  if (XPending(__glutDisplay)) {
     949    WriteLog("idleWait: Calling processEventsAndTimeouts\n");
    944950    processEventsAndTimeouts();
     951    WriteLog("idleWait: Call processEventsAndTimeouts returned\n");
    945952  } else {
    946953    if (__glutTimerList) {
     
    13711378        waitForSomething();
    13721379      } else {
     1380    WriteLog("glutMainLoop: Calling processEventsAndTimeouts\n");
    13731381        processEventsAndTimeouts();
     1382    WriteLog("glutMainLoop: Call processEventsAndTimeouts returned\n");
    13741383      }
    13751384    }
  • 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 $ */
    22/*
    33 * GLUT Termination - on exit cleanup any open windows
     
    66
    77#include <odinwrap.h>
     8#include "glut.h"
    89#include "glu.h"
    9 #include "glut.h"
    1010#include "glutint.h"
    1111
  • trunk/src/opengl/glut/glut_win.c

    r3022 r3079  
    1 /* $Id: glut_win.c,v 1.5 2000-03-05 10:19:38 jeroen Exp $ */
     1/* $Id: glut_win.c,v 1.6 2000-03-11 09:05:05 jeroen Exp $ */
    22/* Copyright (c) Mark J. Kilgard, 1994, 1997.  */
    33
     
    403403}
    404404
    405 void CDECL
     405void GLCALLBACK
    406406__glutDefaultDisplay(void)
    407407{
     
    413413}
    414414
    415 void CDECL
     415void GLCALLBACK
    416416__glutDefaultReshape(int width, int height)
    417417{
     
    10031003}
    10041004
    1005 static void GLAPIENTRY
     1005static void GLCALLBACK
    10061006visibilityHelper(int status)
    10071007{
  • trunk/src/opengl/glut/glutint.h

    r3022 r3079  
    1 /* $Id: glutint.h,v 1.4 2000-03-05 10:19:38 jeroen Exp $ */
     1/* $Id: glutint.h,v 1.5 2000-03-11 09:05:05 jeroen Exp $ */
    22#ifndef __glutint_h__
    33#define __glutint_h__
     
    253253
    254254/* GLUT  function types */
    255 typedef void (* CDECL GLUTdisplayCB) (void);
    256 typedef void (* CDECL GLUTreshapeCB) (int, int);
    257 typedef void (* CDECL GLUTkeyboardCB) (unsigned char, int, int);
    258 typedef void (* CDECL GLUTmouseCB) (int, int, int, int);
    259 typedef void (* CDECL GLUTmotionCB) (int, int);
    260 typedef void (* CDECL GLUTpassiveCB) (int, int);
    261 typedef void (* CDECL GLUTentryCB) (int);
    262 typedef void (* CDECL GLUTvisibilityCB) (int);
    263 typedef void (* CDECL GLUTwindowStatusCB) (int);
    264 typedef void (* CDECL GLUTidleCB) (void);
    265 typedef void (* CDECL GLUTtimerCB) (int);
    266 typedef void (* CDECL GLUTmenuStateCB) (int);  /* DEPRICATED.              */
    267 typedef void (* CDECL GLUTmenuStatusCB) (int, int, int);
    268 typedef void (* CDECL GLUTselectCB) (int);
    269 typedef void (* CDECL GLUTspecialCB) (int, int, int);
    270 typedef void (* CDECL GLUTspaceMotionCB) (int, int, int);
    271 typedef void (* CDECL GLUTspaceRotateCB) (int, int, int);
    272 typedef void (* CDECL GLUTspaceButtonCB) (int, int);
    273 typedef void (* CDECL GLUTdialsCB) (int, int);
    274 typedef void (* CDECL GLUTbuttonBoxCB) (int, int);
    275 typedef void (* CDECL GLUTtabletMotionCB) (int, int);
    276 typedef void (* CDECL GLUTtabletButtonCB) (int, int, int, int);
    277 typedef void (* CDECL GLUTjoystickCB) (unsigned int buttonMask, int x, int y, int z);
     255typedef void (* GLCALLBACK GLUTdisplayCB) (void);
     256typedef void (* GLCALLBACK GLUTreshapeCB) (int, int);
     257typedef void (* GLCALLBACK GLUTkeyboardCB) (unsigned char, int, int);
     258typedef void (* GLCALLBACK GLUTmouseCB) (int, int, int, int);
     259typedef void (* GLCALLBACK GLUTmotionCB) (int, int);
     260typedef void (* GLCALLBACK GLUTpassiveCB) (int, int);
     261typedef void (* GLCALLBACK GLUTentryCB) (int);
     262typedef void (* GLCALLBACK GLUTvisibilityCB) (int);
     263typedef void (* GLCALLBACK GLUTwindowStatusCB) (int);
     264typedef void (* GLCALLBACK GLUTidleCB) (void);
     265typedef void (* GLCALLBACK GLUTtimerCB) (int);
     266typedef void (* GLCALLBACK GLUTmenuStateCB) (int);  /* DEPRICATED.              */
     267typedef void (* GLCALLBACK GLUTmenuStatusCB) (int, int, int);
     268typedef void (* GLCALLBACK GLUTselectCB) (int);
     269typedef void (* GLCALLBACK GLUTspecialCB) (int, int, int);
     270typedef void (* GLCALLBACK GLUTspaceMotionCB) (int, int, int);
     271typedef void (* GLCALLBACK GLUTspaceRotateCB) (int, int, int);
     272typedef void (* GLCALLBACK GLUTspaceButtonCB) (int, int);
     273typedef void (* GLCALLBACK GLUTdialsCB) (int, int);
     274typedef void (* GLCALLBACK GLUTbuttonBoxCB) (int, int);
     275typedef void (* GLCALLBACK GLUTtabletMotionCB) (int, int);
     276typedef void (* GLCALLBACK GLUTtabletButtonCB) (int, int, int, int);
     277typedef void (* GLCALLBACK GLUTjoystickCB) (unsigned int buttonMask, int x, int y, int z);
    278278#ifdef SUPPORT_FORTRAN
    279279typedef void (*GLUTdisplayFCB) (void);
     
    664664extern GLUTmenuItem *__glutItemSelected;
    665665extern GLUTmenu **__glutMenuList;
    666 extern void (* CDECL __glutMenuStatusFunc) (int, int, int);
     666extern void (* GLCALLBACK __glutMenuStatusFunc) (int, int, int);
    667667extern void __glutMenuModificationError(void);
    668668extern void __glutSetMenuItem(GLUTmenuItem * item,
     
    746746extern void __glutReshapeFunc(GLUTreshapeCB reshapeFunc,
    747747  int callingConvention);
    748 extern void  CDECL __glutDefaultReshape(int, int);
     748extern void  GLCALLBACK __glutDefaultReshape(int, int);
    749749extern GLUTwindow *__glutCreateWindow(
    750750  GLUTwindow * parent,
  • trunk/src/opengl/glut/win32_menu.c

    r3022 r3079  
    1 /* $Id: win32_menu.c,v 1.3 2000-03-05 10:19:39 jeroen Exp $ */
     1/* $Id: win32_menu.c,v 1.4 2000-03-11 09:05:05 jeroen Exp $ */
    22/* Copyright (c) Mark J. Kilgard, 1994, 1997, 1998. */
    33/* Copyright (c) Nate Robins, 1997. */
     
    1919#include "glutint.h"
    2020
    21 void (* CDECL __glutMenuStatusFunc) (int, int, int);
     21void (* GLCALLBACK __glutMenuStatusFunc) (int, int, int);
    2222extern GLUTmenu *__glutMappedMenu;
    2323extern GLUTwindow *__glutMenuWindow;
  • trunk/src/opengl/mesa/GL/glu.h

    r2945 r3079  
    1 /* $Id: glu.h,v 1.2 2000-02-29 13:56:52 sandervl Exp $ */
     1/* $Id: glu.h,v 1.3 2000-03-11 09:05:07 jeroen Exp $ */
    22
    33/*
     
    3838#include "GL/gl.h"
    3939
    40         /* to facilitate clean DLL building ... */
     40        /* to facilitate clean DLL building ... */
    4141#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 extern
    48 #       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 */
    4949#else
    50 #       define GLUAPI extern
     50#       define GLUAPI extern
    5151#endif /* WIN32 / CYGWIN32 bracket */
    5252
    5353#ifdef macintosh
    54         #pragma enumsalwaysint on
    55         #if PRAGMA_IMPORT_SUPPORTED
    56         #pragma import on
    57         #endif
     54        #pragma enumsalwaysint on
     55        #if PRAGMA_IMPORT_SUPPORTED
     56        #pragma import on
     57        #endif
    5858#endif
    5959
     
    7171
    7272
    73 #define GLU_VERSION_1_1         1
    74 #define GLU_VERSION_1_2         1
     73#define GLU_VERSION_1_1         1
     74#define GLU_VERSION_1_2         1
    7575
    7676
     
    8282
    8383enum {
    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,  /* */
    135135
    136136        GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1,
     
    141141        GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6,
    142142
    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,
    182182        GLU_NURBS_ERROR         = GLU_ERROR, /* FIXME: is this correct?? */
    183183
    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,
    227227        GLU_INVALID_OPERATION           = 100904,
    228228
    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_FLAG
     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_FLAG
    247247};
    248248
     
    360360
    361361GLUAPI void GLAPIENTRY gluQuadricCallback( GLUquadricObj *qobj,
    362                                          GLenum which, void (GLCALLBACK *fn)() );
     362                                           GLenum which,
     363                                           void (GLCALLBACK *fn)() );
    363364
    364365GLUAPI void GLAPIENTRY gluCylinder( GLUquadricObj *qobj,
     
    449450
    450451GLUAPI void GLAPIENTRY gluTessBeginPolygon( GLUtesselator *tobj,
    451                                             void *polygon_data );
     452                                            void *polygon_data );
    452453
    453454GLUAPI void GLAPIENTRY gluTessBeginContour( GLUtesselator *tobj );
    454455
    455456GLUAPI void GLAPIENTRY gluTessVertex( GLUtesselator *tobj, GLdouble coords[3],
    456                                       void *vertex_data );
     457                                      void *vertex_data );
    457458
    458459GLUAPI void GLAPIENTRY gluTessEndContour( GLUtesselator *tobj );
     
    461462
    462463GLUAPI void GLAPIENTRY gluTessProperty( GLUtesselator *tobj, GLenum which,
    463                                         GLdouble value );
     464                                        GLdouble value );
    464465
    465466GLUAPI void GLAPIENTRY gluTessNormal( GLUtesselator *tobj, GLdouble x,
    466                                       GLdouble y, GLdouble z );
     467                                      GLdouble y, GLdouble z );
    467468
    468469GLUAPI void GLAPIENTRY gluTessCallback( GLUtesselator *tobj, GLenum which,
    469                                         void (GLCALLBACK *fn)() );
     470                                        void (GLCALLBACK *fn)() );
    470471
    471472GLUAPI void GLAPIENTRY gluGetTessProperty( GLUtesselator *tobj, GLenum which,
    472                                            GLdouble *value );
     473                                           GLdouble *value );
    473474
    474475/*
     
    502503
    503504#ifdef macintosh
    504         #pragma enumsalwaysint reset
    505         #if PRAGMA_IMPORT_SUPPORTED
    506         #pragma import off
    507         #endif
     505        #pragma enumsalwaysint reset
     506        #if PRAGMA_IMPORT_SUPPORTED
     507        #pragma import off
     508        #endif
    508509#endif
    509510
  • trunk/src/opengl/mesa/api1.c

    r2938 r3079  
    1 /* $Id: api1.c,v 1.1 2000-02-29 00:49:57 sandervl Exp $ */
     1/* $Id: api1.c,v 1.2 2000-03-11 09:05:06 jeroen Exp $ */
    22
    33/*
     
    5454#endif
    5555
     56#include <misc.h>
     57
    5658/*
    5759 * Part 1 of API functions
     
    8587 * function pointer.
    8688 */
    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 );                             \
    9799}
    98100
     
    125127   if (mode < GL_POINTS || mode > GL_POLYGON) {
    126128      gl_compile_error( CC, GL_INVALID_ENUM, "glBegin" );
    127       return;           
     129      return;
    128130   }
    129131
     
    251253 * color-material and vertex arrays.
    252254 */
    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;                     \
    261263}
    262264
    263265#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;                        \
    272274}
    273275#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 );                           \
    282284}
    283285#endif
     
    285287
    286288
    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);              \
    292294}
    293295
     
    297299   GET_IMMEDIATE;
    298300   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 );
    303305}
    304306
     
    339341   GET_IMMEDIATE;
    340342   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);
    344346}
    345347
     
    349351   GET_IMMEDIATE;
    350352   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);
    354356}
    355357
     
    366368   GET_IMMEDIATE;
    367369   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 );
    371373}
    372374
     
    376378   GET_IMMEDIATE;
    377379   COLOR( IM, USHORT_TO_UBYTE(red), USHORT_TO_UBYTE(green),
    378           USHORT_TO_UBYTE(blue),
    379           255 );
     380          USHORT_TO_UBYTE(blue),
     381          255 );
    380382}
    381383
     
    385387   GET_IMMEDIATE;
    386388   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) );
    388390}
    389391
    390392
    391393void GLAPIENTRY glColor4d(CTX_ARG GLdouble red, GLdouble green, GLdouble blue,
    392                            GLdouble alpha )
     394                           GLdouble alpha )
    393395{
    394396   GLubyte col[4];
     
    426428   GET_IMMEDIATE;
    427429   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) );
    429431}
    430432
     
    435437   GET_IMMEDIATE;
    436438   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) );
    438440}
    439441
     
    450452   GET_IMMEDIATE;
    451453   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) );
    453455}
    454456
     
    458460   GET_IMMEDIATE;
    459461   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) );
    461463}
    462464
     
    466468   GET_IMMEDIATE;
    467469   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 );
    469471}
    470472
     
    505507   GET_IMMEDIATE;
    506508   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 );
    508510}
    509511
     
    513515   GET_IMMEDIATE;
    514516   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 );
    516518}
    517519
     
    528530   GET_IMMEDIATE;
    529531   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 );
    531533}
    532534
     
    536538   GET_IMMEDIATE;
    537539   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 );
    539541
    540542}
     
    545547   GET_IMMEDIATE;
    546548   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]) );
    548550}
    549551
     
    585587   GET_IMMEDIATE;
    586588   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]) );
    588590}
    589591
     
    593595   GET_IMMEDIATE;
    594596   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]) );
    596598}
    597599
     
    608610   GET_IMMEDIATE;
    609611   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]) );
    611613}
    612614
     
    616618   GET_IMMEDIATE;
    617619   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]) );
    619621}
    620622
     
    833835   state = IM->BeginState;
    834836   inflags = (~state) & (VERT_BEGIN_0|VERT_BEGIN_1);
    835    state |= inflags << 2;       /* errors */
     837   state |= inflags << 2;       /* errors */
    836838
    837839   if (MESA_VERBOSE&VERBOSE_API) {
    838840      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);
    842844      else
    843         fprintf(stderr, ">");
     845        fprintf(stderr, ">");
    844846   }
    845847
     
    857859
    858860      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;
    861863      }
    862864   }
     
    881883   if (MESA_VERBOSE&VERBOSE_API) {
    882884      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);
    886888      else
    887         fprintf(stderr, ">");
     889        fprintf(stderr, ">");
    888890   }
    889891
    890    state |= inflags << 2;       /* errors */
     892   state |= inflags << 2;       /* errors */
    891893
    892894   if (inflags != (VERT_BEGIN_0|VERT_BEGIN_1))
     
    902904
    903905      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;
    906908      }
    907909   }
     
    950952
    951953
    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 );                     \
    986990}
    987991
     
    11731177      case GL_FOG_END:
    11741178      case GL_FOG_INDEX:
    1175         p[0] = (GLfloat) *params;
    1176         break;
     1179        p[0] = (GLfloat) *params;
     1180        break;
    11771181      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;
    11831187      default:
    11841188         /* Error will be caught later in gl_Fogfv */
     
    14771481
    14781482
    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;               \
    14861490}
    14871491
     
    17401744
    17411745   for (i=0;i<16;i++) {
    1742           fm[i] = (GLfloat) m[i];
     1746          fm[i] = (GLfloat) m[i];
    17431747   }
    17441748
     
    19461950
    19471951   for (i=0;i<16;i++) {
    1948           fm[i] = (GLfloat) m[i];
     1952          fm[i] = (GLfloat) m[i];
    19491953   }
    19501954
     
    19741978 *     (ie shared) normals.
    19751979 */
    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);                    \
    19851989}
    19861990
     
    19891993{
    19901994   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) );
    19931997}
    19941998
     
    20092013{
    20102014   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) );
    20132017}
    20142018
     
    20172021{
    20182022   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) );
    20212025}
    20222026
     
    20252029{
    20262030   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]) );
    20292033}
    20302034
     
    20452049{
    20462050   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]) );
    20492053}
    20502054
     
    20532057{
    20542058   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.