home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 2000 April & May / AMIGA_2000_04.iso / patches / mesa3.1 / mesa-3_1.lha / src / AOS / wrpDisplay / wrpFastRaster.c < prev    next >
Encoding:
Text File  |  1999-09-23  |  3.2 KB  |  125 lines

  1. /*
  2.  * $Id: $
  3.  */
  4.  
  5. /*
  6.  * Mesa 3-D graphics library
  7.  * Version:  3.1
  8.  * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
  9.  *
  10.  * This library is free software; you can redistribute it and/or
  11.  * modify it under the terms of the GNU Library General Public
  12.  * License as published by the Free Software Foundation; either
  13.  * version 2 of the License, or (at your option) any later version.
  14.  *
  15.  * This library is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18.  * Library General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU Library General Public
  21.  * License along with this library; if not, write to the Free
  22.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. /**********************************************************************/
  26. /*****            Accelerated point, line, polygon rendering      *****/
  27. /**********************************************************************/
  28.  
  29. rastersetup_func wrpChooseRasterSetupFunction(GLcontext * ctx)
  30. {
  31.   struct TDdriver *TDdriver;
  32.  
  33.   DEBUGOUT(1, "wrpChooseRasterSetup()\n");
  34.  
  35.   TDdriver = ((amigaMesaContext) ctx->DriverCtx)->TDdriver;
  36.  
  37.   if (ctx->Depth.Test) {
  38.     if (ctx->Light.ShadeModel == GL_SMOOTH) {
  39.       if (ctx->Texture.Enabled) {
  40.     if (ctx->Light.Model.TwoSide) {
  41.       TDdriver->CopyVertex = wrpCopyFlatTexZ;
  42.       return wrpSetupFlatTexZ;
  43.     }
  44.  
  45.     TDdriver->CopyVertex = wrpCopyGouraudTexZ;
  46.     return wrpSetupGouraudTexZ;
  47.       }
  48.  
  49.       if (ctx->Fog.Enabled) {
  50.     if (ctx->Light.Model.TwoSide) {
  51.       TDdriver->CopyVertex = wrpCopyFlatFogZ;
  52.       return wrpSetupFlatFogZ;
  53.     }
  54.  
  55.     TDdriver->CopyVertex = wrpCopyGouraudFogZ;
  56.     return wrpSetupGouraudFogZ;
  57.       }
  58.  
  59.       if (ctx->Light.Model.TwoSide) {
  60.     TDdriver->CopyVertex = wrpCopyFlatZ;
  61.     return wrpSetupFlatZ;
  62.       }
  63.  
  64.       TDdriver->CopyVertex = wrpCopyGouraudZ;
  65.       return wrpSetupGouraudZ;
  66.     }
  67.  
  68.     if (ctx->Texture.Enabled) {
  69.       TDdriver->CopyVertex = wrpCopyFlatTexZ;
  70.       return wrpSetupFlatTexZ;
  71.     }
  72.  
  73.     if (ctx->Fog.Enabled) {
  74.       TDdriver->CopyVertex = wrpCopyFlatFogZ;
  75.       return wrpSetupFlatFogZ;
  76.     }
  77.  
  78.     TDdriver->CopyVertex = wrpCopyFlatZ;
  79.     return wrpSetupFlatZ;
  80.   }
  81.  
  82.   if (ctx->Light.ShadeModel == GL_SMOOTH) {
  83.     if (ctx->Texture.Enabled) {
  84.       if (ctx->Light.Model.TwoSide) {
  85.     TDdriver->CopyVertex = wrpCopyFlatTex;
  86.     return wrpSetupFlatTex;
  87.       }
  88.  
  89.       TDdriver->CopyVertex = wrpCopyGouraudTex;
  90.       return wrpSetupGouraudTex;
  91.     }
  92.  
  93.     if (ctx->Fog.Enabled) {
  94.       if (ctx->Light.Model.TwoSide) {
  95.     TDdriver->CopyVertex = wrpCopyFlatFog;
  96.     return wrpSetupFlatFog;
  97.       }
  98.  
  99.       TDdriver->CopyVertex = wrpCopyGouraudFog;
  100.       return wrpSetupGouraudFog;
  101.     }
  102.  
  103.     if (ctx->Light.Model.TwoSide) {
  104.       TDdriver->CopyVertex = wrpCopyFlat;
  105.       return wrpSetupFlat;
  106.     }
  107.  
  108.     TDdriver->CopyVertex = wrpCopyGouraud;
  109.     return wrpSetupGouraud;
  110.   }
  111.  
  112.   if (ctx->Texture.Enabled) {
  113.     TDdriver->CopyVertex = wrpCopyFlatTex;
  114.     return wrpSetupFlatTex;
  115.   }
  116.  
  117.   if (ctx->Fog.Enabled) {
  118.     TDdriver->CopyVertex = wrpCopyFlatFog;
  119.     return wrpSetupFlatFog;
  120.   }
  121.  
  122.   TDdriver->CopyVertex = wrpCopyFlat;
  123.   return wrpSetupFlat;
  124. }
  125.