draw_pipe_unfilled.c File Reference

Include dependency graph for draw_pipe_unfilled.c:

Go to the source code of this file.

Data Structures

struct  unfilled_stage
 Drawing stage for handling glPolygonMode(line/point). More...

Functions

static struct unfilled_stageunfilled_stage (struct draw_stage *stage)
static void point (struct draw_stage *stage, struct vertex_header *v0)
static void line (struct draw_stage *stage, struct vertex_header *v0, struct vertex_header *v1)
static void points (struct draw_stage *stage, struct prim_header *header)
static void lines (struct draw_stage *stage, struct prim_header *header)
static void unfilled_tri (struct draw_stage *stage, struct prim_header *header)
static void unfilled_first_tri (struct draw_stage *stage, struct prim_header *header)
static void unfilled_flush (struct draw_stage *stage, unsigned flags)
static void unfilled_reset_stipple_counter (struct draw_stage *stage)
static void unfilled_destroy (struct draw_stage *stage)
struct draw_stagedraw_unfilled_stage (struct draw_context *draw)
 Create unfilled triangle stage.


Function Documentation

struct draw_stage* draw_unfilled_stage ( struct draw_context draw  )  [read]

Create unfilled triangle stage.

Definition at line 177 of file draw_pipe_unfilled.c.

References CALLOC_STRUCT, draw_stage::destroy, draw_stage::draw, draw_alloc_temp_verts(), draw_pipe_passthrough_line(), draw_pipe_passthrough_point(), draw_stage::flush, draw_stage::line, draw_stage::next, draw_stage::point, draw_stage::reset_stipple_counter, unfilled_stage::stage, draw_stage::tmp, draw_stage::tri, unfilled_destroy(), unfilled_first_tri(), unfilled_flush(), and unfilled_reset_stipple_counter().

00178 {
00179    struct unfilled_stage *unfilled = CALLOC_STRUCT(unfilled_stage);
00180    if (unfilled == NULL)
00181       goto fail;
00182 
00183    if (!draw_alloc_temp_verts( &unfilled->stage, 0 ))
00184       goto fail;
00185 
00186    unfilled->stage.draw = draw;
00187    unfilled->stage.next = NULL;
00188    unfilled->stage.tmp = NULL;
00189    unfilled->stage.point = draw_pipe_passthrough_point;
00190    unfilled->stage.line = draw_pipe_passthrough_line;
00191    unfilled->stage.tri = unfilled_first_tri;
00192    unfilled->stage.flush = unfilled_flush;
00193    unfilled->stage.reset_stipple_counter = unfilled_reset_stipple_counter;
00194    unfilled->stage.destroy = unfilled_destroy;
00195 
00196    return &unfilled->stage;
00197 
00198  fail:
00199    if (unfilled)
00200       unfilled->stage.destroy( &unfilled->stage );
00201 
00202    return NULL;
00203 }

static void line ( struct draw_stage stage,
struct vertex_header v0,
struct vertex_header v1 
) [static]

Definition at line 68 of file draw_pipe_unfilled.c.

References draw_stage::line, draw_stage::next, and prim_header::v.

00071 {
00072    struct prim_header tmp;
00073    tmp.v[0] = v0;
00074    tmp.v[1] = v1;
00075    stage->next->line( stage->next, &tmp );
00076 }

static void lines ( struct draw_stage stage,
struct prim_header header 
) [static]

Definition at line 92 of file draw_pipe_unfilled.c.

References DRAW_PIPE_EDGE_FLAG_0, DRAW_PIPE_EDGE_FLAG_1, DRAW_PIPE_EDGE_FLAG_2, DRAW_PIPE_RESET_STIPPLE, vertex_header::edgeflag, prim_header::flags, line(), draw_stage::next, draw_stage::reset_stipple_counter, and prim_header::v.

00094 {
00095    struct vertex_header *v0 = header->v[0];
00096    struct vertex_header *v1 = header->v[1];
00097    struct vertex_header *v2 = header->v[2];
00098 
00099    if (header->flags & DRAW_PIPE_RESET_STIPPLE)
00100       stage->next->reset_stipple_counter( stage->next );
00101 
00102    if ((header->flags & DRAW_PIPE_EDGE_FLAG_2) && v2->edgeflag) line( stage, v2, v0 );
00103    if ((header->flags & DRAW_PIPE_EDGE_FLAG_0) && v0->edgeflag) line( stage, v0, v1 );
00104    if ((header->flags & DRAW_PIPE_EDGE_FLAG_1) && v1->edgeflag) line( stage, v1, v2 );
00105 }

static void point ( struct draw_stage stage,
struct vertex_header v0 
) [static]

Definition at line 60 of file draw_pipe_unfilled.c.

References draw_stage::next, draw_stage::point, and prim_header::v.

00062 {
00063    struct prim_header tmp;
00064    tmp.v[0] = v0;
00065    stage->next->point( stage->next, &tmp );
00066 }

static void points ( struct draw_stage stage,
struct prim_header header 
) [static]

Definition at line 79 of file draw_pipe_unfilled.c.

References DRAW_PIPE_EDGE_FLAG_0, DRAW_PIPE_EDGE_FLAG_1, DRAW_PIPE_EDGE_FLAG_2, vertex_header::edgeflag, prim_header::flags, point(), and prim_header::v.

00081 {
00082    struct vertex_header *v0 = header->v[0];
00083    struct vertex_header *v1 = header->v[1];
00084    struct vertex_header *v2 = header->v[2];
00085 
00086    if ((header->flags & DRAW_PIPE_EDGE_FLAG_0) && v0->edgeflag) point( stage, v0 );
00087    if ((header->flags & DRAW_PIPE_EDGE_FLAG_1) && v1->edgeflag) point( stage, v1 );
00088    if ((header->flags & DRAW_PIPE_EDGE_FLAG_2) && v2->edgeflag) point( stage, v2 );
00089 }

static void unfilled_destroy ( struct draw_stage stage  )  [static]

Definition at line 167 of file draw_pipe_unfilled.c.

References draw_free_temp_verts(), and FREE.

00168 {
00169    draw_free_temp_verts( stage );
00170    FREE( stage );
00171 }

static void unfilled_first_tri ( struct draw_stage stage,
struct prim_header header 
) [static]

Definition at line 138 of file draw_pipe_unfilled.c.

References draw_stage::draw, pipe_rasterizer_state::fill_ccw, pipe_rasterizer_state::fill_cw, unfilled_stage::mode, draw_context::rasterizer, draw_stage::tri, unfilled_stage(), and unfilled_tri().

00140 {
00141    struct unfilled_stage *unfilled = unfilled_stage(stage);
00142 
00143    unfilled->mode[0] = stage->draw->rasterizer->fill_ccw; /* front */
00144    unfilled->mode[1] = stage->draw->rasterizer->fill_cw;  /* back */
00145 
00146    stage->tri = unfilled_tri;
00147    stage->tri( stage, header );
00148 }

static void unfilled_flush ( struct draw_stage stage,
unsigned  flags 
) [static]

Definition at line 152 of file draw_pipe_unfilled.c.

References draw_stage::flush, draw_stage::next, draw_stage::tri, and unfilled_first_tri().

00154 {
00155    stage->next->flush( stage->next, flags );
00156 
00157    stage->tri = unfilled_first_tri;
00158 }

static void unfilled_reset_stipple_counter ( struct draw_stage stage  )  [static]

Definition at line 161 of file draw_pipe_unfilled.c.

References draw_stage::next, and draw_stage::reset_stipple_counter.

00162 {
00163    stage->next->reset_stipple_counter( stage->next );
00164 }

static struct unfilled_stage* unfilled_stage ( struct draw_stage stage  )  [static, read]

Definition at line 53 of file draw_pipe_unfilled.c.

00054 {
00055    return (struct unfilled_stage *)stage;
00056 }

static void unfilled_tri ( struct draw_stage stage,
struct prim_header header 
) [static]

Definition at line 116 of file draw_pipe_unfilled.c.

References assert, prim_header::det, lines(), unfilled_stage::mode, mode, draw_stage::next, PIPE_POLYGON_MODE_FILL, PIPE_POLYGON_MODE_LINE, PIPE_POLYGON_MODE_POINT, points(), draw_stage::tri, and unfilled_stage().

00118 {
00119    struct unfilled_stage *unfilled = unfilled_stage(stage);
00120    unsigned mode = unfilled->mode[header->det >= 0.0];
00121   
00122    switch (mode) {
00123    case PIPE_POLYGON_MODE_FILL:
00124       stage->next->tri( stage->next, header );
00125       break;
00126    case PIPE_POLYGON_MODE_LINE:
00127       lines( stage, header );
00128       break;
00129    case PIPE_POLYGON_MODE_POINT:
00130       points( stage, header );
00131       break;
00132    default:
00133       assert(0);
00134    }   
00135 }


Generated on Tue Sep 29 06:25:20 2009 for Gallium3D by  doxygen 1.5.4