home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / System / Mesa-3.1 / src / interp_tmp.h < prev    next >
Text File  |  2000-01-07  |  4KB  |  112 lines

  1. /* $Id: interp_tmp.h,v 1.2.2.1 1999/11/25 16:51:24 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.  
  27.  
  28. static void NAME( struct vertex_buffer *VB,
  29.           GLuint dst, GLfloat t, GLuint in, GLuint out )
  30. {
  31. #if (IND & (CLIP_RGBA0|CLIP_FOG_COORD))
  32.    GLfloat col[3][4];
  33. #endif
  34.  
  35.    (void) VB;
  36.    (void) dst;
  37.    (void) t;
  38.    (void) in;
  39.    (void) out;
  40.  
  41. #if (IND & CLIP_RGBA0)
  42.    UBYTE_RGBA_TO_FLOAT_RGBA(col[1], VB->Color[0]->data[in]);
  43.    UBYTE_RGBA_TO_FLOAT_RGBA(col[2], VB->Color[0]->data[out]);
  44.    INTERP_SZ( t, col, 0, 1, 2, 4 );
  45.    FLOAT_RGBA_TO_UBYTE_RGBA(VB->Color[0]->data[dst], col[0]);
  46. #endif
  47.  
  48. #if (IND & CLIP_RGBA1)
  49.    if (VB->ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
  50.       UBYTE_RGBA_TO_FLOAT_RGBA(col[1], VB->Color[1]->data[in]);
  51.       UBYTE_RGBA_TO_FLOAT_RGBA(col[2], VB->Color[1]->data[out]);
  52.       INTERP_SZ( t, col, 0, 1, 2, 4 );
  53.       FLOAT_RGBA_TO_UBYTE_RGBA(VB->Color[1]->data[dst], col[0]);
  54.    }
  55.  
  56.    if (VB->ctx->TriangleCaps & DD_SEPERATE_SPECULAR) 
  57.    {
  58.       UBYTE_RGBA_TO_FLOAT_RGBA(col[1], VB->Spec[0][in]);
  59.       UBYTE_RGBA_TO_FLOAT_RGBA(col[2], VB->Spec[0][out]);
  60.       INTERP_SZ( t, col, 0, 1, 2, 3 );
  61.       FLOAT_RGBA_TO_UBYTE_RGBA(VB->Spec[0][dst], col[0]);
  62.  
  63.       if (VB->ctx->TriangleCaps & DD_TRI_LIGHT_TWOSIDE) {
  64.      UBYTE_RGBA_TO_FLOAT_RGBA(col[1], VB->Spec[1][in]);
  65.      UBYTE_RGBA_TO_FLOAT_RGBA(col[2], VB->Spec[1][out]);
  66.      INTERP_SZ( t, col, 0, 1, 2, 3 );
  67.      FLOAT_RGBA_TO_UBYTE_RGBA(VB->Spec[1][dst], col[0]);
  68.       }
  69.    }      
  70. #endif
  71.  
  72. #if (IND & CLIP_FOG_COORD)
  73.    col[0][0] = UBYTE_COLOR_TO_FLOAT_COLOR( VB->Spec[0][in][3]);
  74.    col[0][1] = UBYTE_COLOR_TO_FLOAT_COLOR( VB->Spec[0][out][3]);
  75.    col[0][2] = LINTERP( t, col[0][0], col[0][1] );
  76.    FLOAT_COLOR_TO_UBYTE_COLOR(VB->Spec[0][dst][3], col[0][2]);
  77. #endif
  78.  
  79.  
  80. #if (IND & CLIP_INDEX0)
  81.    VB->IndexPtr->data[dst] = (GLuint) (GLint) 
  82.       LINTERP( t, 
  83.            (GLfloat) VB->Index[0]->data[in],
  84.            (GLfloat) VB->Index[0]->data[out] );
  85. #endif
  86.  
  87. #if (IND & CLIP_INDEX1)
  88.    VB->Index[1]->data[dst] = (GLuint) (GLint) 
  89.       LINTERP( t, 
  90.            (GLfloat) VB->Index[1]->data[in],
  91.            (GLfloat) VB->Index[1]->data[out] );
  92. #endif
  93.  
  94. #if (IND & CLIP_TEX0)
  95.    INTERP_SZ( t, 
  96.           VB->TexCoordPtr[0]->data, 
  97.           dst, in, out, 
  98.           VB->TexCoordPtr[0]->size );
  99. #endif
  100.  
  101. #if (IND & CLIP_TEX1)
  102.    INTERP_SZ( t, 
  103.           VB->TexCoordPtr[1]->data, 
  104.           dst, in, out, 
  105.           VB->TexCoordPtr[1]->size );
  106. #endif
  107. }
  108.  
  109.  
  110. #undef IND
  111. #undef NAME
  112.