Ignore:
Timestamp:
May 23, 2000, 10:41:28 PM (25 years ago)
Author:
jeroen
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/opengl/mesa/3dfx/fxcliptmp.h

    r2938 r3598  
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    9696#define SETUP S4
    9797
    98 
    99 static void TAG(fx_tri_view_clip)( struct vertex_buffer *VB,
    100                                    GLuint v[],
    101                                    GLubyte mask )
     98#define DRAW_LINE(tmp0, tmp1, width)    \
     99  do {                                  \
     100    GrVertex verts[4];                  \
     101    float dx, dy, ix, iy;               \
     102                                        \
     103    dx = tmp0->x - tmp1->x;             \
     104    dy = tmp0->y - tmp1->y;             \
     105                                        \
     106    if (dx * dx > dy * dy) {            \
     107      iy = width * .5;                  \
     108      ix = 0;                           \
     109    } else {                            \
     110      iy = 0;                           \
     111      ix = width * .5;                  \
     112    }                                   \
     113                                        \
     114   verts[0] = *tmp0;                    \
     115   verts[1] = *tmp0;                    \
     116   verts[2] = *tmp1;                    \
     117   verts[3] = *tmp1;                    \
     118                                        \
     119   verts[0].x = tmp0->x - ix;           \
     120   verts[0].y = tmp0->y - iy;           \
     121                                        \
     122   verts[1].x = tmp0->x + ix;           \
     123   verts[1].y = tmp0->y + iy;           \
     124                                        \
     125   verts[2].x = tmp1->x + ix;           \
     126   verts[2].y = tmp1->y + iy;           \
     127                                        \
     128   verts[3].x = tmp1->x - ix;           \
     129   verts[3].y = tmp1->y - iy;           \
     130                                        \
     131   FX_grDrawPolygonVertexList(4, verts); \
     132  } while (0)
     133
     134static void TAG(fx_tri_view_clip)( struct vertex_buffer *VB,
     135                                   GLuint v[],
     136                                   GLubyte mask )
    102137{
    103138   GLcontext *ctx = VB->ctx;
     
    112147   GLubyte *clipmask = VB->ClipMask;
    113148
    114    GLuint tmu0_source = fxMesa->tmu_source[0];                         
    115    GLuint tmu1_source = fxMesa->tmu_source[1];                         
     149   GLuint tmu0_source = fxMesa->tmu_source[0];
     150   GLuint tmu1_source = fxMesa->tmu_source[1];
    116151   GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source];
    117152   GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source];
     
    124159      GLuint e = v[i];
    125160      verts[i] = 0;
    126       if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f;       
    127       vlist[i] = out; 
     161      if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f;
     162      vlist[i] = out;
    128163      COPY_STRIDE;
    129164      out += SIZE;
     
    135170      GrVertex *v = tmp, *v2, *v3;
    136171      VARS;
    137    
     172
    138173      for (i = 0 ; i < n ; i++)
    139         if (!verts[i]) {
    140             GLfloat *data = vlist[i];
    141             SETUP;
    142             verts[i] = v++;
    143         }
    144          
     174        if (!verts[i]) {
     175            GLfloat *data = vlist[i];
     176            SETUP;
     177            verts[i] = v++;
     178        }
     179
    145180      v = verts[0];
    146181      v2 = verts[1];
     
    148183
    149184      for (i = 2 ; i < n ; v2 = v3, v3=verts[++i])
    150         FX_grDrawTriangle(v, v2, v3);
     185        FX_grDrawTriangle(v, v2, v3);
    151186   }
    152187}
     
    156191
    157192
    158 static void TAG(fx_tri_clip_stride)( struct vertex_buffer *VB, 
    159                                      GLuint v[],
    160                                      GLuint mask )
     193static void TAG(fx_tri_clip_stride)( struct vertex_buffer *VB,
     194                                     GLuint v[],
     195                                     GLuint mask )
    161196{
    162197   GLcontext *ctx = VB->ctx;
     
    171206   GLubyte *clipmask = VB->ClipMask;
    172207
    173    GLuint tmu0_source = fxMesa->tmu_source[0];                         
    174    GLuint tmu1_source = fxMesa->tmu_source[1];                         
     208   GLuint tmu0_source = fxMesa->tmu_source[0];
     209   GLuint tmu1_source = fxMesa->tmu_source[1];
    175210   GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source];
    176211   GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source];
     
    183218      GLuint e = v[i];
    184219      verts[i] = 0;
    185       if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f;       
    186       vlist[i] = out; 
     220      if (!clipmask[e]) verts[i] = (GrVertex *)gWin[e].f;
     221      vlist[i] = out;
    187222      COPY_STRIDE;
    188223      out += SIZE;
     
    191226   if (VB->ClipPtr->size < 4) {
    192227      vlist[0][3] = vlist[1][3] = vlist[2][3] = 1.0;
    193       if (VB->ClipPtr->size == 2) 
    194         vlist[0][2] = vlist[1][2] = vlist[2][2] = 0.0;
    195    }
    196      
     228      if (VB->ClipPtr->size == 2)
     229        vlist[0][2] = vlist[1][2] = vlist[2][2] = 0.0;
     230   }
     231
    197232   if ((n = fx_clip_triangle( ctx, vlist, verts, SIZE, mask )) >= 3)
    198233   {
     
    200235      GrVertex *v = tmp, *v2, *v3;
    201236      VARS;
    202    
     237
    203238      for (i = 0 ; i < n ; i++)
    204         if (!verts[i]) {
    205             GLfloat *data = vlist[i];
    206             SETUP;
    207             verts[i] = v++;
    208         }
    209          
     239        if (!verts[i]) {
     240            GLfloat *data = vlist[i];
     241            SETUP;
     242            verts[i] = v++;
     243        }
     244
    210245      v = verts[0];
    211246      v2 = verts[1];
     
    213248
    214249      for (i = 2 ; i < n ; v2 = v3, v3=verts[++i])
    215         FX_grDrawTriangle(v, v2, v3);
     250        FX_grDrawTriangle(v, v2, v3);
    216251   }
    217252}
     
    219254
    220255
    221 static void TAG(fx_line_clip)( struct vertex_buffer *VB, 
    222                                GLuint v1, GLuint v2,
    223                                GLubyte mask )
     256static void TAG(fx_line_clip)( struct vertex_buffer *VB,
     257                               GLuint v1, GLuint v2,
     258                               GLubyte mask )
    224259{
    225260   GLcontext *ctx = VB->ctx;
     
    229264   GLfloat *out = data;
    230265   GLfloat *mat = ctx->Viewport.WindowMap.m;
     266   GLfloat w = ctx->Line.Width*.5;
    231267   GLuint  e, n;
    232268
    233    GLuint tmu0_source = fxMesa->tmu_source[0];                         
    234    GLuint tmu1_source = fxMesa->tmu_source[1];                         
     269   GLuint tmu0_source = fxMesa->tmu_source[0];
     270   GLuint tmu1_source = fxMesa->tmu_source[1];
    235271   GLvector4f *tc0_vec = VB->TexCoordPtr[tmu0_source];
    236272   GLvector4f *tc1_vec = VB->TexCoordPtr[tmu1_source];
     
    242278   (void) tmu1_source; (void) tc1_vec;
    243279
    244    vlist[0] = out; 
     280   vlist[0] = out;
    245281   e = v1;
    246282   COPY_STRIDE;
    247283   out += SIZE;
    248284
    249    vlist[1] = out; 
     285   vlist[1] = out;
    250286   e = v2;
    251287   COPY_STRIDE;
     
    254290   if (VB->ClipPtr->size < 4) {
    255291      vlist[0][3] = vlist[1][3] = 1.0;
    256       if (VB->ClipPtr->size == 2) 
    257         vlist[0][2] = vlist[1][2] = 0.0;
    258    }
    259      
     292      if (VB->ClipPtr->size == 2)
     293        vlist[0][2] = vlist[1][2] = 0.0;
     294   }
     295
    260296   if ((n = fx_clip_line( ctx, vlist, SIZE, mask )) != 0)
    261297   {
     
    272308      SETUP;
    273309
    274       FX_grDrawLine(gWin, v);     
     310      DRAW_LINE(gWin, v, w);
    275311   }
    276312}
     
    278314
    279315
    280 #undef V1 
    281 #undef S1 
    282 #undef C1 
    283 #undef Z1 
     316#undef V1
     317#undef S1
     318#undef C1
     319#undef Z1
    284320#undef T1
    285321
    286 #undef V2 
    287 #undef S2 
    288 #undef C2 
    289 #undef Z2 
     322#undef V2
     323#undef S2
     324#undef C2
     325#undef Z2
    290326#undef T2
    291327
    292 #undef V3 
    293 #undef S3 
    294 #undef C3 
    295 #undef Z3 
     328#undef V3
     329#undef S3
     330#undef C3
     331#undef Z3
    296332#undef T3
    297333
    298 #undef V4 
    299 #undef S4 
    300 #undef C4 
    301 #undef Z4 
     334#undef V4
     335#undef S4
     336#undef C4
     337#undef Z4
    302338#undef T4
    303339
    304 #undef VARS 
    305 #undef SETUP 
    306 #undef COPY 
     340#undef VARS
     341#undef SETUP
     342#undef COPY
    307343#undef COPY_STRIDE
    308344#undef SIZE
Note: See TracChangeset for help on using the changeset viewer.