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

  1. /* $Id: trans_tmp.h,v 1.2 1999/10/19 18:37:04 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.  * New (3.1) transformation code written by Keith Whitwell.
  29.  */
  30.  
  31.  
  32. /* KW: It might be possible to organize to do the translation *after*
  33.  *     culling in an array-optimized gl_transform_vb().  
  34.  */
  35.  
  36.  
  37. #ifdef DEST_4F
  38. static void DEST_4F( GLfloat (*t)[4],
  39.              const struct gl_client_array *from,
  40.              ARGS)
  41. {
  42.    GLuint stride = from->StrideB;
  43.    const GLubyte *f = (GLubyte *) from->Ptr + SRC_START * stride;
  44.    const GLubyte *first = f;
  45.    GLuint i;
  46.  
  47.    (void) first;
  48.    (void) start;
  49.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  50.       CHECK { 
  51.          NEXT_F2;
  52.      if (SZ >= 1) t[i][0] = TRX_4F(f, 0);
  53.      if (SZ >= 2) t[i][1] = TRX_4F(f, 1);
  54.      if (SZ >= 3) t[i][2] = TRX_4F(f, 2);
  55.      if (SZ == 4) t[i][3] = TRX_4F(f, 3);
  56.       }
  57.    }
  58. }
  59. #endif
  60.  
  61.  
  62. #ifdef DEST_3F
  63. static void DEST_3F( GLfloat (*t)[3],
  64.              const struct gl_client_array *from,
  65.              ARGS)
  66. {
  67.    GLuint stride = from->StrideB;
  68.    const GLubyte *f = (GLubyte *) from->Ptr + SRC_START * stride;
  69.    const GLubyte *first = f;
  70.    GLuint i;
  71.    (void) first;
  72.    (void) start;
  73.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  74.       CHECK {
  75.          NEXT_F2;
  76.      t[i][0] = TRX_3F(f, 0);
  77.      t[i][1] = TRX_3F(f, 1);
  78.      t[i][2] = TRX_3F(f, 2);
  79.       }
  80.    }
  81. }
  82. #endif
  83.  
  84. #ifdef DEST_4UB
  85. static void DEST_4UB( GLubyte (*t)[4],
  86.               const struct gl_client_array *from,
  87.               ARGS)
  88. {
  89.    GLuint stride = from->StrideB;
  90.    const GLubyte *f = (GLubyte *) from->Ptr + SRC_START * stride;
  91.    const GLubyte *first = f;
  92.    GLuint i;
  93.    (void) start;
  94.    (void) first;
  95.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  96.       CHECK {
  97.          NEXT_F2;
  98.      if (SZ >= 1) TRX_UB(t[i][0], f, 0);
  99.      if (SZ >= 2) TRX_UB(t[i][1], f, 1);
  100.      if (SZ >= 3) TRX_UB(t[i][2], f, 2); 
  101.      if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255;
  102.       }
  103.    }
  104. }
  105. #endif
  106.  
  107.  
  108. #ifdef DEST_1UB
  109. static void DEST_1UB( GLubyte *t,
  110.               const struct gl_client_array *from,
  111.               ARGS)
  112. {
  113.    GLuint stride = from->StrideB;
  114.    const GLubyte *f = (GLubyte *) from->Ptr + SRC_START * stride;
  115.    const GLubyte *first = f;
  116.    GLuint i;
  117.    (void) start;
  118.    (void) first;
  119.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  120.       CHECK {
  121.          NEXT_F2;
  122.       TRX_UB(t[i], f, 0);
  123.       }
  124.    }
  125. }
  126. #endif
  127.  
  128.  
  129. #ifdef DEST_1UI
  130. static void DEST_1UI( GLuint *t,
  131.               const struct gl_client_array *from,
  132.               ARGS)
  133. {
  134.    GLuint stride = from->StrideB;
  135.    const GLubyte *f = (GLubyte *) from->Ptr + SRC_START * stride;
  136.    const GLubyte *first = f;
  137.    GLuint i;
  138.    (void) start;
  139.    (void) first;
  140.  
  141.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  142.       CHECK {
  143.          NEXT_F2;
  144.      t[i] = TRX_UI(f, 0);
  145.       }
  146.    }
  147. }
  148. #endif
  149.  
  150.  
  151. static void INIT(void)
  152. {
  153. #ifdef DEST_1UI
  154.    ASSERT(SZ == 1);
  155.    TAB(1ui)[SRC_IDX] = DEST_1UI;
  156. #endif
  157. #ifdef DEST_1UB
  158.    ASSERT(SZ == 1);
  159.    TAB(1ub)[SRC_IDX] = DEST_1UB;
  160. #endif
  161. #ifdef DEST_3F
  162.    ASSERT(SZ == 3);
  163.    TAB(3f)[SRC_IDX] = DEST_3F;
  164. #endif
  165. #ifdef DEST_4UB
  166.    TAB(4ub)[SZ][SRC_IDX] = DEST_4UB;
  167. #endif
  168. #ifdef DEST_4F
  169.    TAB(4f)[SZ][SRC_IDX] = DEST_4F;
  170. #endif
  171.    
  172. }
  173.  
  174.  
  175. #undef INIT
  176. #undef DEST_1UI
  177. #undef DEST_1UB
  178. #undef DEST_4UB
  179. #undef DEST_3F
  180. #undef DEST_4F
  181. #undef SZ
  182. #undef TAG
  183.  
  184.  
  185.