1 | /* $Id: quads.c,v 1.2 2000-05-23 20:40:51 jeroen Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Mesa 3-D graphics library
|
---|
5 | * Version: 3.3
|
---|
6 | *
|
---|
7 | * Copyright (C) 1999 Brian Paul All Rights Reserved.
|
---|
8 | *
|
---|
9 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
10 | * copy of this software and associated documentation files (the "Software"),
|
---|
11 | * to deal in the Software without restriction, including without limitation
|
---|
12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
13 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
14 | * Software is furnished to do so, subject to the following conditions:
|
---|
15 | *
|
---|
16 | * The above copyright notice and this permission notice shall be included
|
---|
17 | * in all copies or substantial portions of the Software.
|
---|
18 | *
|
---|
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
22 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
23 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
25 | */
|
---|
26 | /* $XFree86: xc/lib/GL/mesa/src/quads.c,v 1.2 1999/04/04 00:20:30 dawes Exp $ */
|
---|
27 |
|
---|
28 |
|
---|
29 |
|
---|
30 |
|
---|
31 |
|
---|
32 | /*
|
---|
33 | * Quadrilateral rendering functions.
|
---|
34 | */
|
---|
35 |
|
---|
36 |
|
---|
37 | #ifdef PC_HEADER
|
---|
38 | #include "all.h"
|
---|
39 | #else
|
---|
40 | #include "glheader.h"
|
---|
41 | #include "types.h"
|
---|
42 | #include "quads.h"
|
---|
43 | #endif
|
---|
44 |
|
---|
45 |
|
---|
46 |
|
---|
47 | /*
|
---|
48 | * At this time there is no quadrilateral optimization. Just call the
|
---|
49 | * triangle function twice.
|
---|
50 | * v0, v1, v2, v3 in CCW order = front facing.
|
---|
51 | */
|
---|
52 | static void basic_quad( GLcontext *ctx,
|
---|
53 | GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv )
|
---|
54 | {
|
---|
55 | /* (*ctx->Driver.TriangleFunc)( ctx, v0, v1, v3, pv ); */
|
---|
56 | /* (*ctx->Driver.TriangleFunc)( ctx, v1, v2, v3, pv ); */
|
---|
57 | (*ctx->Driver.TriangleFunc)( ctx, v0, v1, v2, pv );
|
---|
58 | (*ctx->Driver.TriangleFunc)( ctx, v0, v2, v3, pv );
|
---|
59 | }
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 | /*
|
---|
64 | * Draw nothing (NULL raster mode)
|
---|
65 | */
|
---|
66 | static void null_quad( GLcontext *ctx,
|
---|
67 | GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv )
|
---|
68 | {
|
---|
69 | (void) ctx;
|
---|
70 | (void) v0;
|
---|
71 | (void) v1;
|
---|
72 | (void) v2;
|
---|
73 | (void) v3;
|
---|
74 | (void) pv;
|
---|
75 | }
|
---|
76 |
|
---|
77 |
|
---|
78 |
|
---|
79 | void gl_set_quad_function( GLcontext *ctx )
|
---|
80 | {
|
---|
81 | if (ctx->RenderMode==GL_RENDER) {
|
---|
82 | if (ctx->NoRaster) {
|
---|
83 | ctx->Driver.QuadFunc = null_quad;
|
---|
84 | }
|
---|
85 | else if (ctx->Driver.QuadFunc) {
|
---|
86 | /* Device driver will draw quads. */
|
---|
87 | return;
|
---|
88 | }
|
---|
89 | else
|
---|
90 | ctx->Driver.QuadFunc = basic_quad;
|
---|
91 |
|
---|
92 | }
|
---|
93 | else {
|
---|
94 | /* if in feedback or selection mode we can fall back to triangle code */
|
---|
95 | ctx->Driver.QuadFunc = basic_quad;
|
---|
96 | }
|
---|
97 | }
|
---|
98 |
|
---|
99 |
|
---|