home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mesa5.zip / mesa5src.zip / math / m_trans_tmp.h < prev    next >
Text File  |  2002-12-01  |  6KB  |  282 lines

  1. /* $Id: m_trans_tmp.h,v 1.7 2002/01/30 16:52:02 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  4.0.2
  6.  *
  7.  * Copyright (C) 1999-2002  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: This file also included by tnl/trans_elt.c to build code
  33.  *     specific to the implementation of array-elements in the
  34.  *     tnl module.
  35.  */
  36.  
  37.  
  38. #ifdef DEST_4F
  39. static void DEST_4F( GLfloat (*t)[4],
  40.              CONST void *ptr,
  41.              GLuint stride,
  42.              ARGS )
  43. {
  44.    const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
  45.    const GLubyte *first = f;
  46.    GLuint i;
  47.  
  48. //EK??   (void) first;
  49. //EK??   (void) start;
  50.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  51.       CHECK {
  52.          NEXT_F2;
  53.  
  54. //       if (SZ >= 1) t[i][0] = TRX_4F(f, 0);
  55. //     if (SZ >= 2) t[i][1] = TRX_4F(f, 1);
  56. //     if (SZ >= 3) t[i][2] = TRX_4F(f, 2);
  57. //     if (SZ == 4) t[i][3] = TRX_4F(f, 3); else t[i][3] = 1.0;
  58. #     if (SZ >= 1) 
  59.             t[i][0] = TRX_4F(f, 0);
  60. #endif
  61. #     if (SZ >= 2) 
  62.         t[i][1] = TRX_4F(f, 1);
  63. #endif
  64. #     if (SZ >= 3)
  65.         t[i][2] = TRX_4F(f, 2);
  66. #endif
  67. #     if (SZ == 4) 
  68.         t[i][3] = TRX_4F(f, 3);
  69. #else
  70.         t[i][3] = 1.0;
  71. #endif
  72.       }
  73.    }
  74. }
  75. #endif
  76.  
  77.  
  78. #ifdef DEST_3F
  79. static void DEST_3F( GLfloat (*t)[3],
  80.              CONST void *ptr,
  81.              GLuint stride,
  82.              ARGS )
  83. {
  84.    const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
  85.    const GLubyte *first = f;
  86.    GLuint i;
  87. //EK??   (void) first;
  88. //EK??   (void) start;
  89.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  90.       CHECK {
  91.          NEXT_F2;
  92.      t[i][0] = TRX_3F(f, 0);
  93.      t[i][1] = TRX_3F(f, 1);
  94.      t[i][2] = TRX_3F(f, 2);
  95.       }
  96.    }
  97. }
  98. #endif
  99.  
  100. #ifdef DEST_1F
  101. static void DEST_1F( GLfloat *t,
  102.              CONST void *ptr,
  103.              GLuint stride,
  104.              ARGS )
  105. {
  106.    const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
  107.    const GLubyte *first = f;
  108.    GLuint i;
  109. //EK??   (void) first;
  110. //EK??   (void) start;
  111.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  112.       CHECK {
  113.          NEXT_F2;
  114.      t[i] = TRX_1F(f, 0);
  115.       }
  116.    }
  117. }
  118. #endif
  119.  
  120. #ifdef DEST_4UB
  121. static void DEST_4UB( GLubyte (*t)[4],
  122.                       CONST void *ptr,
  123.                       GLuint stride,
  124.                       ARGS )
  125. {
  126.    const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
  127.    const GLubyte *first = f;
  128.    GLuint i;
  129. //EK??   (void) start;
  130. //EK??   (void) first;
  131.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  132.       CHECK {
  133.          NEXT_F2;
  134. //     if (SZ >= 1) TRX_UB(t[i][0], f, 0);
  135. //     if (SZ >= 2) TRX_UB(t[i][1], f, 1);
  136. //     if (SZ >= 3) TRX_UB(t[i][2], f, 2);
  137. //     if (SZ == 4) TRX_UB(t[i][3], f, 3); else t[i][3] = 255;
  138. #     if (SZ >= 1) 
  139.         TRX_UB(t[i][0], f, 0);
  140. #endif
  141. #         if (SZ >= 2) 
  142.         TRX_UB(t[i][1], f, 1);
  143. #endif
  144. #     if (SZ >= 3) 
  145.         TRX_UB(t[i][2], f, 2);
  146. #endif
  147. #     if (SZ == 4) 
  148.         TRX_UB(t[i][3], f, 3);
  149. #else 
  150.         t[i][3] = 255;
  151. #endif
  152.       }
  153.    }
  154. }
  155. #endif
  156.  
  157.  
  158. #ifdef DEST_4US
  159. static void DEST_4US( GLushort (*t)[4],
  160.                       CONST void *ptr,
  161.                       GLuint stride,
  162.                       ARGS )
  163. {
  164.    const GLubyte *f = (GLubyte *) ((GLubyte *) ptr + SRC_START * stride);
  165.    const GLubyte *first = f;
  166.    GLuint i;
  167. //EK??   (void) start;
  168. //EK??   (void) first;
  169.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  170.       CHECK {
  171.          NEXT_F2;
  172. //     if (SZ >= 1) TRX_US(t[i][0], f, 0);
  173. //     if (SZ >= 2) TRX_US(t[i][1], f, 1);
  174. //     if (SZ >= 3) TRX_US(t[i][2], f, 2);
  175. //     if (SZ == 4) TRX_US(t[i][3], f, 3); else t[i][3] = 65535;
  176.  
  177. #     if (SZ >= 1) 
  178.         TRX_US(t[i][0], f, 0);
  179. #endif
  180. #     if (SZ >= 2) 
  181.         TRX_US(t[i][1], f, 1);
  182. #endif
  183. #     if (SZ >= 3)
  184.         TRX_US(t[i][2], f, 2);
  185. #endif
  186. #     if (SZ == 4) 
  187.         TRX_US(t[i][3], f, 3);
  188. #        else 
  189.         t[i][3] = 65535;
  190. #        endif
  191.  
  192.       }
  193.    }
  194. }
  195. #endif
  196.  
  197.  
  198. #ifdef DEST_1UB
  199. static void DEST_1UB( GLubyte *t,
  200.               CONST void *ptr,
  201.               GLuint stride,
  202.               ARGS )
  203. {
  204.    const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
  205.    const GLubyte *first = f;
  206.    GLuint i;
  207. //EK??   (void) start;
  208. //EK??   (void) first;
  209.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  210.       CHECK {
  211.          NEXT_F2;
  212.       TRX_UB(t[i], f, 0);
  213.       }
  214.    }
  215. }
  216. #endif
  217.  
  218.  
  219. #ifdef DEST_1UI
  220. static void DEST_1UI( GLuint *t,
  221.               CONST void *ptr,
  222.               GLuint stride,
  223.               ARGS )
  224. {
  225.    const GLubyte *f = (GLubyte *) ptr + SRC_START * stride;
  226.    const GLubyte *first = f;
  227.    GLuint i;
  228. //EK??   (void) start;
  229. //EK??   (void) first;
  230.  
  231.    for (i = DST_START ; i < n ; i++, NEXT_F) {
  232.       CHECK {
  233.          NEXT_F2;
  234.      t[i] = TRX_UI(f, 0);
  235.       }
  236.    }
  237. }
  238. #endif
  239.  
  240.  
  241. static void INIT(void)
  242. {
  243. #ifdef DEST_1UI
  244.    ASSERT(SZ == 1);
  245.    TAB(_1ui)[SRC_IDX] = DEST_1UI;
  246. #endif
  247. #ifdef DEST_1UB
  248.    ASSERT(SZ == 1);
  249.    TAB(_1ub)[SRC_IDX] = DEST_1UB;
  250. #endif
  251. #ifdef DEST_1F
  252.    ASSERT(SZ == 1);
  253.    TAB(_1f)[SRC_IDX] = DEST_1F;
  254. #endif
  255. #ifdef DEST_3F
  256.    ASSERT(SZ == 3);
  257.    TAB(_3f)[SRC_IDX] = DEST_3F;
  258. #endif
  259. #ifdef DEST_4UB
  260.    TAB(_4ub)[SZ][SRC_IDX] = DEST_4UB;
  261. #endif
  262. #ifdef DEST_4US
  263.    TAB(_4us)[SZ][SRC_IDX] = DEST_4US;
  264. #endif
  265. #ifdef DEST_4F
  266.    TAB(_4f)[SZ][SRC_IDX] = DEST_4F;
  267. #endif
  268.  
  269. }
  270.  
  271.  
  272. #undef INIT
  273. #undef DEST_1UI
  274. #undef DEST_1UB
  275. #undef DEST_4UB
  276. #undef DEST_4US
  277. #undef DEST_3F
  278. #undef DEST_4F
  279. #undef DEST_1F
  280. #undef SZ
  281. #undef TAG
  282.