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/vbindirect.c

    r2938 r3598  
    1 /* $Id: vbindirect.c,v 1.1 2000-02-29 00:50:14 sandervl Exp $ */
     1/* $Id: vbindirect.c,v 1.2 2000-05-23 20:41:02 jeroen Exp $ */
    22
    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.
     
    3030
    3131
     32#include "glheader.h"
    3233#include "vb.h"
    3334#include "vbcull.h"
     
    115116                       const struct gl_prim_state *state,
    116117                       const GLuint *elt,
    117                        GLuint start,
    118                        GLuint count )
     118                       GLuint start,
     119                       GLuint count )
    119120{
    120121   GLcontext *ctx = VB->ctx;
     
    126127      const GLubyte *clip = VB->ClipMask;
    127128      for (i = start ; i < count ; i++)
    128         if (!clip[elt[i]])
    129             ctx->Driver.PointsFunc( ctx, elt[i], elt[i] );
     129        if (!clip[elt[i]])
     130            ctx->Driver.PointsFunc( ctx, elt[i], elt[i] );
    130131   } else {
    131132      for (i = start ; i < count ; i++)
    132         ctx->Driver.PointsFunc( ctx, elt[i], elt[i] );
     133        ctx->Driver.PointsFunc( ctx, elt[i], elt[i] );
    133134   }
    134135}
     
    136137static void
    137138indexed_render_lines( struct vertex_buffer *VB,
    138                       const struct gl_prim_state *state,
    139                       const GLuint *elt,
    140                       GLuint start,
    141                       GLuint count )
     139                      const struct gl_prim_state *state,
     140                      const GLuint *elt,
     141                      GLuint start,
     142                      GLuint count )
    142143{
    143144   GLcontext *ctx = VB->ctx;
     
    151152
    152153      for (i = start ; i < count ; i++) {
    153         GLuint curr = elt[i];
    154         if (state->draw) {
    155             if (clip[curr] | clip[prev])
    156                gl_render_clipped_line( ctx, prev, curr );
    157             else
    158                ctx->Driver.LineFunc( ctx, prev, curr, curr );   
     154        GLuint curr = elt[i];
     155        if (state->draw) {
     156            if (clip[curr] | clip[prev])
     157               gl_render_clipped_line( ctx, prev, curr );
     158            else
     159               ctx->Driver.LineFunc( ctx, prev, curr, curr );
    159160         }
    160          prev = curr;   
    161         state = state->next;
     161         prev = curr;
     162        state = state->next;
    162163      }
    163164      if (state->finish_loop) {
    164         GLuint curr = elt[start];
    165         if (clip[curr] | clip[prev])
    166             gl_render_clipped_line( ctx, prev, curr );
    167         else
    168             ctx->Driver.LineFunc( ctx, prev, curr, curr );
     165        GLuint curr = elt[start];
     166        if (clip[curr] | clip[prev])
     167            gl_render_clipped_line( ctx, prev, curr );
     168        else
     169            ctx->Driver.LineFunc( ctx, prev, curr, curr );
    169170      }
    170171   } else {
    171172      GLuint prev = 0;
    172173      for (i = start ; i < count ; i++) {
    173         GLuint curr = elt[i];
    174         if (state->draw) ctx->Driver.LineFunc( ctx, prev, curr, curr );
    175         prev = curr;
    176         state = state->next;
     174        GLuint curr = elt[i];
     175        if (state->draw) ctx->Driver.LineFunc( ctx, prev, curr, curr );
     176        prev = curr;
     177        state = state->next;
    177178      }
    178179      if (state->finish_loop) {
    179         GLuint curr = elt[start];
    180         ctx->Driver.LineFunc( ctx, prev, curr, curr );
     180        GLuint curr = elt[start];
     181        ctx->Driver.LineFunc( ctx, prev, curr, curr );
    181182      }
    182183   }
     
    187188static void
    188189indexed_render_tris( struct vertex_buffer *VB,
    189                      const struct gl_prim_state *state,
    190                      const GLuint *elt,
    191                      GLuint start,
    192                      GLuint count )
     190                     const struct gl_prim_state *state,
     191                     const GLuint *elt,
     192                     GLuint start,
     193                     GLuint count )
    193194{
    194195   GLcontext *ctx = VB->ctx;
     
    203204      const GLubyte *clip = VB->ClipMask;
    204205      for (i = start ; i < count ; i++) {
    205         v[2] = elt[i];
    206         if (state->draw) {
    207             if (clip[v[0]] | clip[v[1]] | clip[v[2]]) {
    208                if (!(clip[v[0]] & clip[v[1]] & clip[v[2]] & CLIP_ALL_BITS)) {
    209                   COPY_3V(vlist, v);
    210                   gl_render_clipped_triangle( ctx, 3, vlist, vlist[2] );
    211                }
    212             }
    213             else
    214                ctx->TriangleFunc( ctx, v[0], v[1], v[2], v[2] );
    215         }
    216         v[0] = v[state->v0];
    217         v[1] = v[state->v1];
    218         state = state->next;
     206        v[2] = elt[i];
     207        if (state->draw) {
     208            if (clip[v[0]] | clip[v[1]] | clip[v[2]]) {
     209               if (!(clip[v[0]] & clip[v[1]] & clip[v[2]] & CLIP_ALL_BITS)) {
     210                  COPY_3V(vlist, v);
     211                  gl_render_clipped_triangle( ctx, 3, vlist, vlist[2] );
     212               }
     213            }
     214            else
     215               ctx->TriangleFunc( ctx, v[0], v[1], v[2], v[2] );
     216        }
     217        v[0] = v[state->v0];
     218        v[1] = v[state->v1];
     219        state = state->next;
    219220      }
    220221   } else {
     
    223224
    224225      for (i = start ; i < count ; i++) {
    225         v[2] = elt[i];
    226         if (state->draw)
    227             tf( ctx, v[0], v[1], v[2], v[2] );
    228         v[0] = v[state->v0];
    229         v[1] = v[state->v1];
    230         state = state->next;
     226        v[2] = elt[i];
     227        if (state->draw)
     228            tf( ctx, v[0], v[1], v[2], v[2] );
     229        v[0] = v[state->v0];
     230        v[1] = v[state->v1];
     231        state = state->next;
    231232      }
    232233   }
     
    236237static void
    237238indexed_render_noop( struct vertex_buffer *VB,
    238                      const struct gl_prim_state *state,
    239                      const GLuint *elt,
    240                      GLuint start,
    241                      GLuint count )
    242 {
    243         (void) VB;
    244         (void) state;
    245         (void) elt;
    246         (void) start;
    247         (void) count;
     239                     const struct gl_prim_state *state,
     240                     const GLuint *elt,
     241                     GLuint start,
     242                     GLuint count )
     243{
     244        (void) VB;
     245        (void) state;
     246        (void) elt;
     247        (void) start;
     248        (void) count;
    248249}
    249250
    250251
    251252typedef void (*indexed_render_func)( struct vertex_buffer *VB,
    252                                      const struct gl_prim_state *state,
    253                                      const GLuint *elt,
    254                                      GLuint start,
    255                                      GLuint count );
     253                                     const struct gl_prim_state *state,
     254                                     const GLuint *elt,
     255                                     GLuint start,
     256                                     GLuint count );
    256257
    257258
     
    297298
    298299   gl_import_client_data( VB, ctx->RenderFlags,
    299                           (VB->ClipOrMask
    300                            ? VEC_WRITABLE|VEC_GOOD_STRIDE
    301                            : VEC_GOOD_STRIDE));
     300                          (VB->ClipOrMask
     301                           ? VEC_WRITABLE|VEC_GOOD_STRIDE
     302                           : VEC_GOOD_STRIDE));
    302303
    303304   ctx->VB = VB;
     
    313314
    314315      if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
    315         VB->Specular = VB->Spec[0];
    316         VB->ColorPtr = VB->Color[0];
    317         VB->IndexPtr = VB->Index[0];
     316        VB->Specular = VB->Spec[0];
     317        VB->ColorPtr = VB->Color[0];
     318        VB->IndexPtr = VB->Index[0];
    318319      }
    319320
    320321   } while (ctx->Driver.MultipassFunc &&
    321             ctx->Driver.MultipassFunc( VB, ++p ));
     322            ctx->Driver.MultipassFunc( VB, ++p ));
    322323
    323324
     
    346347
    347348   gl_import_client_data( cvaVB, ctx->RenderFlags,
    348                           (VB->ClipOrMask
    349                            ? VEC_WRITABLE|VEC_GOOD_STRIDE
    350                            : VEC_GOOD_STRIDE));
     349                          (VB->ClipOrMask
     350                           ? VEC_WRITABLE|VEC_GOOD_STRIDE
     351                           : VEC_GOOD_STRIDE));
    351352
    352353   ctx->VB = cvaVB;
     
    360361   do {
    361362      for (i = VB->CopyStart ; i < count ; parity = 0, i = next ) {
    362         prim = VB->Primitive[i];
    363         next = VB->NextPrimitive[i];
    364 
    365         state = gl_prim_state_machine[prim][parity];
    366         func = prim_func[prim];
    367 
    368         func( cvaVB, state, VB->EltPtr->data, i, next );
    369 
    370         if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
    371             cvaVB->Specular = cvaVB->Spec[0];
    372             cvaVB->ColorPtr = cvaVB->Color[0];
    373             cvaVB->IndexPtr = cvaVB->Index[0];
    374         }
     363        prim = VB->Primitive[i];
     364        next = VB->NextPrimitive[i];
     365
     366        state = gl_prim_state_machine[prim][parity];
     367        func = prim_func[prim];
     368
     369        func( cvaVB, state, VB->EltPtr->data, i, next );
     370
     371        if (ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
     372            cvaVB->Specular = cvaVB->Spec[0];
     373            cvaVB->ColorPtr = cvaVB->Color[0];
     374            cvaVB->IndexPtr = cvaVB->Index[0];
     375        }
    375376      }
    376377
    377378   } while (ctx->Driver.MultipassFunc &&
    378             ctx->Driver.MultipassFunc( VB, ++p ));
     379            ctx->Driver.MultipassFunc( VB, ++p ));
    379380
    380381
Note: See TracChangeset for help on using the changeset viewer.