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 / cybDisplay / cybFastPoints.c < prev    next >
Encoding:
Text File  |  1999-09-23  |  2.7 KB  |  101 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. void cybFastPointsFunction(GLcontext * ctx, GLuint first, GLuint last)
  30. {
  31.   amigaMesaContext amesa;
  32.   struct vertex_buffer *VB;
  33.   struct RastPort *rp;
  34.   GLubyte *mask;
  35.   GLuint i;
  36.  
  37.   amesa = ((amigaMesaContext) ctx->DriverCtx);
  38.   VB = ctx->VB;
  39.   rp = amesa->rp;
  40.  
  41.   DEBUGOUT(1, "cybFastPointsFunction: ");
  42.  
  43.   mask = VB->ClipMask;
  44.   if (!(amesa->visual->flags & VISUAL_RGBMODE)) {
  45.     GLuint *ItoP = amesa->ItoP;
  46.  
  47.     DEBUGOUT(1, "VB.IndexColor\n");
  48.     for (i = first; i <= last; i++) {
  49.       if (!*mask++) {
  50.     int x, y;
  51.  
  52.     x = FIXx((GLint) (VB->Win.data[i][0]));
  53.     y = FIXy((GLint) (VB->Win.data[i][1]));
  54.  
  55.     WriteRGBPixel(rp, x, y, GetRGBPLocal(VB->IndexPtr->data[i]) >> 8);
  56.     DEBUGOUT(9, " WriteRGBPixel(%d, %d)\n", x, y);
  57.       }
  58.     }
  59.   }
  60.   else {
  61.     DEBUGOUT(1, "VB.RGBColor\n");
  62.  
  63.     for (i = first; i <= last; i++) {
  64.       if (!*mask++) {
  65.     int x, y;
  66.  
  67.     x = FIXx((GLint) (VB->Win.data[i][0]));
  68.     y = FIXy((GLint) (VB->Win.data[i][1]));
  69.  
  70.     WriteRGBPixel(rp, x, y, (*((GLuint *) VB->ColorPtr->data[i])) >> 8);
  71.     DEBUGOUT(9, " WriteRGBPixel(%d, %d)\n", x, y);
  72.       }
  73.     }
  74.   }
  75. }
  76.  
  77. points_func cybChoosePointsFunction(GLcontext * ctx)
  78. {
  79.   /*
  80.    * Examine the current rendering state and return a pointer to a 
  81.    * fast point-rendering function if possible. 
  82.    */
  83.  
  84.   DEBUGOUT(1, "cybChoosePointsFunction\n");
  85.  
  86.   if ((ctx->Point.Size == 1.0) &&
  87.       (!ctx->Point.SmoothFlag) &&
  88.       (ctx->RasterMask == 0) &&                            /* what means rastermask really? */
  89.       (!ctx->Texture.Enabled))
  90.     return cybFastPointsFunction;
  91.  
  92.   return NULL;
  93. }
  94.  
  95. points_func cybChoosePointsFunctionDB(GLcontext * ctx)
  96. {
  97.   DEBUGOUT(1, "cybChoosePointsFunctionDB\n");
  98.  
  99.   return NULL;
  100. }
  101.