home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / System / Mesa-3.1 / src / quads.c < prev    next >
C/C++ Source or Header  |  2000-01-07  |  3KB  |  104 lines

  1. /* $Id: quads.c,v 1.4 1999/10/08 09:27:11 keithw Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  3.1
  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. #ifndef XFree86Server
  41. #include <stdio.h>
  42. #else
  43. #include "GL/xf86glx.h"
  44. #endif
  45. #include "types.h"
  46. #include "quads.h"
  47. #endif
  48.  
  49.  
  50.  
  51. /*
  52.  * At this time there is no quadrilateral optimization.  Just call the
  53.  * triangle function twice.
  54.  * v0, v1, v2, v3 in CCW order = front facing.
  55.  */
  56. static void basic_quad( GLcontext *ctx,
  57.                         GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv )
  58. {
  59. /*     (*ctx->Driver.TriangleFunc)( ctx, v0, v1, v3, pv ); */
  60. /*     (*ctx->Driver.TriangleFunc)( ctx, v1, v2, v3, pv ); */
  61.    (*ctx->Driver.TriangleFunc)( ctx, v0, v1, v2, pv );
  62.    (*ctx->Driver.TriangleFunc)( ctx, v0, v2, v3, pv );
  63. }
  64.  
  65.  
  66.  
  67. /*
  68.  * Draw nothing (NULL raster mode)
  69.  */
  70. static void null_quad( GLcontext *ctx,
  71.                        GLuint v0, GLuint v1, GLuint v2, GLuint v3, GLuint pv )
  72. {
  73.    (void) ctx;
  74.    (void) v0;
  75.    (void) v1;
  76.    (void) v2;
  77.    (void) v3;
  78.    (void) pv;
  79. }
  80.  
  81.  
  82.  
  83. void gl_set_quad_function( GLcontext *ctx )
  84. {
  85.    if (ctx->RenderMode==GL_RENDER) {
  86.       if (ctx->NoRaster) {
  87.          ctx->Driver.QuadFunc = null_quad;
  88.       }
  89.       else if (ctx->Driver.QuadFunc) {
  90.          /* Device driver will draw quads. */
  91.      return;
  92.       }
  93.       else 
  94.          ctx->Driver.QuadFunc = basic_quad;
  95.       
  96.    }
  97.    else {
  98.       /* if in feedback or selection mode we can fall back to triangle code */
  99.       ctx->Driver.QuadFunc = basic_quad;
  100.    }      
  101. }
  102.  
  103.  
  104.