ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

m_xform_tmp.h
Go to the documentation of this file.
00001 
00002 /*
00003  * Mesa 3-D graphics library
00004  * Version:  3.5
00005  *
00006  * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
00007  *
00008  * Permission is hereby granted, free of charge, to any person obtaining a
00009  * copy of this software and associated documentation files (the "Software"),
00010  * to deal in the Software without restriction, including without limitation
00011  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00012  * and/or sell copies of the Software, and to permit persons to whom the
00013  * Software is furnished to do so, subject to the following conditions:
00014  *
00015  * The above copyright notice and this permission notice shall be included
00016  * in all copies or substantial portions of the Software.
00017  *
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00020  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00021  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00022  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00023  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00024  */
00025 
00026 /*
00027  * New (3.1) transformation code written by Keith Whitwell.
00028  */
00029 
00030 
00031 /*----------------------------------------------------------------------
00032  * Begin Keith's new code
00033  *
00034  *----------------------------------------------------------------------
00035  */
00036 
00037 /* KW: Fixed stride, now measured in bytes as is the OpenGL array stride.
00038  */
00039 
00040 /* KW: These are now parameterized to produce two versions, one
00041  *     which transforms all incoming points, and a second which
00042  *     takes notice of a cullmask array, and only transforms
00043  *     unculled vertices.
00044  */
00045 
00046 /* KW: 1-vectors can sneak into the texture pipeline via the array
00047  *     interface.  These functions are here because I want consistant
00048  *     treatment of the vertex sizes and a lazy strategy for
00049  *     cleaning unused parts of the vector, and so as not to exclude
00050  *     them from the vertex array interface.
00051  *
00052  *     Under our current analysis of matrices, there is no way that
00053  *     the product of a matrix and a 1-vector can remain a 1-vector,
00054  *     with the exception of the identity transform.
00055  */
00056 
00057 /* KW: No longer zero-pad outgoing vectors.  Now that external
00058  *     vectors can get into the pipeline we cannot ever assume
00059  *     that there is more to a vector than indicated by its
00060  *     size.
00061  */
00062 
00063 /* KW: Now uses clipmask and a flag to allow us to skip both/either
00064  *     cliped and/or culled vertices.
00065  */
00066 
00067 /* GH: Not any more -- it's easier (and faster) to just process the
00068  *     entire vector.  Clipping and culling are handled further down
00069  *     the pipe, most often during or after the conversion to some
00070  *     driver-specific vertex format.
00071  */
00072 
00073 static void _XFORMAPI
00074 TAG(transform_points1_general)( GLvector4f *to_vec,
00075                 const GLfloat m[16],
00076                 const GLvector4f *from_vec )
00077 {
00078    const GLuint stride = from_vec->stride;
00079    GLfloat *from = from_vec->start;
00080    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00081    GLuint count = from_vec->count;
00082    const GLfloat m0 = m[0],  m12 = m[12];
00083    const GLfloat m1 = m[1],  m13 = m[13];
00084    const GLfloat m2 = m[2],  m14 = m[14];
00085    const GLfloat m3 = m[3],  m15 = m[15];
00086    GLuint i;
00087    STRIDE_LOOP {
00088       const GLfloat ox = from[0];
00089       to[i][0] = m0 * ox + m12;
00090       to[i][1] = m1 * ox + m13;
00091       to[i][2] = m2 * ox + m14;
00092       to[i][3] = m3 * ox + m15;
00093    }
00094    to_vec->size = 4;
00095    to_vec->flags |= VEC_SIZE_4;
00096    to_vec->count = from_vec->count;
00097 }
00098 
00099 static void _XFORMAPI
00100 TAG(transform_points1_identity)( GLvector4f *to_vec,
00101                  const GLfloat m[16],
00102                  const GLvector4f *from_vec )
00103 {
00104    const GLuint stride = from_vec->stride;
00105    GLfloat *from = from_vec->start;
00106    GLuint count = from_vec->count;
00107    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00108    GLuint i;
00109    (void) m;
00110    if (to_vec == from_vec) return;
00111    STRIDE_LOOP {
00112       to[i][0] = from[0];
00113    }
00114    to_vec->size = 1;
00115    to_vec->flags |= VEC_SIZE_1;
00116    to_vec->count = from_vec->count;
00117 }
00118 
00119 static void _XFORMAPI
00120 TAG(transform_points1_2d)( GLvector4f *to_vec,
00121                const GLfloat m[16],
00122                const GLvector4f *from_vec )
00123 {
00124    const GLuint stride = from_vec->stride;
00125    GLfloat *from = from_vec->start;
00126    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00127    GLuint count = from_vec->count;
00128    const GLfloat m0 = m[0], m1 = m[1];
00129    const GLfloat m12 = m[12], m13 = m[13];
00130    GLuint i;
00131    STRIDE_LOOP {
00132       const GLfloat ox = from[0];
00133       to[i][0] = m0 * ox + m12;
00134       to[i][1] = m1 * ox + m13;
00135    }
00136    to_vec->size = 2;
00137    to_vec->flags |= VEC_SIZE_2;
00138    to_vec->count = from_vec->count;
00139 }
00140 
00141 static void _XFORMAPI
00142 TAG(transform_points1_2d_no_rot)( GLvector4f *to_vec,
00143                   const GLfloat m[16],
00144                   const GLvector4f *from_vec )
00145 {
00146    const GLuint stride = from_vec->stride;
00147    GLfloat *from = from_vec->start;
00148    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00149    GLuint count = from_vec->count;
00150    const GLfloat m0 = m[0], m12 = m[12], m13 = m[13];
00151    GLuint i;
00152    STRIDE_LOOP {
00153       const GLfloat ox = from[0];
00154       to[i][0] = m0 * ox + m12;
00155       to[i][1] =           m13;
00156    }
00157    to_vec->size = 2;
00158    to_vec->flags |= VEC_SIZE_2;
00159    to_vec->count = from_vec->count;
00160 }
00161 
00162 static void _XFORMAPI
00163 TAG(transform_points1_3d)( GLvector4f *to_vec,
00164                const GLfloat m[16],
00165                const GLvector4f *from_vec )
00166 {
00167    const GLuint stride = from_vec->stride;
00168    GLfloat *from = from_vec->start;
00169    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00170    GLuint count = from_vec->count;
00171    const GLfloat m0 = m[0], m1 = m[1], m2 = m[2];
00172    const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
00173    GLuint i;
00174    STRIDE_LOOP {
00175       const GLfloat ox = from[0];
00176       to[i][0] = m0 * ox + m12;
00177       to[i][1] = m1 * ox + m13;
00178       to[i][2] = m2 * ox + m14;
00179    }
00180    to_vec->size = 3;
00181    to_vec->flags |= VEC_SIZE_3;
00182    to_vec->count = from_vec->count;
00183 }
00184 
00185 
00186 static void _XFORMAPI
00187 TAG(transform_points1_3d_no_rot)( GLvector4f *to_vec,
00188                   const GLfloat m[16],
00189                   const GLvector4f *from_vec )
00190 {
00191    const GLuint stride = from_vec->stride;
00192    GLfloat *from = from_vec->start;
00193    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00194    GLuint count = from_vec->count;
00195    const GLfloat m0 = m[0];
00196    const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
00197    GLuint i;
00198    STRIDE_LOOP {
00199       const GLfloat ox = from[0];
00200       to[i][0] = m0 * ox           + m12;
00201       to[i][1] =                     m13;
00202       to[i][2] =                     m14;
00203    }
00204    to_vec->size = 3;
00205    to_vec->flags |= VEC_SIZE_3;
00206    to_vec->count = from_vec->count;
00207 }
00208 
00209 static void _XFORMAPI
00210 TAG(transform_points1_perspective)( GLvector4f *to_vec,
00211                     const GLfloat m[16],
00212                     const GLvector4f *from_vec )
00213 {
00214    const GLuint stride = from_vec->stride;
00215    GLfloat *from = from_vec->start;
00216    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00217    GLuint count = from_vec->count;
00218    const GLfloat m0 = m[0], m14 = m[14];
00219    GLuint i;
00220    STRIDE_LOOP {
00221       const GLfloat ox = from[0];
00222       to[i][0] = m0 * ox                ;
00223       to[i][1] =           0            ;
00224       to[i][2] =                     m14;
00225       to[i][3] = 0;
00226    }
00227    to_vec->size = 4;
00228    to_vec->flags |= VEC_SIZE_4;
00229    to_vec->count = from_vec->count;
00230 }
00231 
00232 
00233 
00234 
00235 /* 2-vectors, which are a lot more relevant than 1-vectors, are
00236  * present early in the geometry pipeline and throughout the
00237  * texture pipeline.
00238  */
00239 static void _XFORMAPI
00240 TAG(transform_points2_general)( GLvector4f *to_vec,
00241                 const GLfloat m[16],
00242                 const GLvector4f *from_vec )
00243 {
00244    const GLuint stride = from_vec->stride;
00245    GLfloat *from = from_vec->start;
00246    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00247    GLuint count = from_vec->count;
00248    const GLfloat m0 = m[0],  m4 = m[4],  m12 = m[12];
00249    const GLfloat m1 = m[1],  m5 = m[5],  m13 = m[13];
00250    const GLfloat m2 = m[2],  m6 = m[6],  m14 = m[14];
00251    const GLfloat m3 = m[3],  m7 = m[7],  m15 = m[15];
00252    GLuint i;
00253    STRIDE_LOOP {
00254       const GLfloat ox = from[0], oy = from[1];
00255       to[i][0] = m0 * ox + m4 * oy + m12;
00256       to[i][1] = m1 * ox + m5 * oy + m13;
00257       to[i][2] = m2 * ox + m6 * oy + m14;
00258       to[i][3] = m3 * ox + m7 * oy + m15;
00259    }
00260    to_vec->size = 4;
00261    to_vec->flags |= VEC_SIZE_4;
00262    to_vec->count = from_vec->count;
00263 }
00264 
00265 static void _XFORMAPI
00266 TAG(transform_points2_identity)( GLvector4f *to_vec,
00267                  const GLfloat m[16],
00268                  const GLvector4f *from_vec )
00269 {
00270    const GLuint stride = from_vec->stride;
00271    GLfloat *from = from_vec->start;
00272    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00273    GLuint count = from_vec->count;
00274    GLuint i;
00275    (void) m;
00276    if (to_vec == from_vec) return;
00277    STRIDE_LOOP {
00278       to[i][0] = from[0];
00279       to[i][1] = from[1];
00280    }
00281    to_vec->size = 2;
00282    to_vec->flags |= VEC_SIZE_2;
00283    to_vec->count = from_vec->count;
00284 }
00285 
00286 static void _XFORMAPI
00287 TAG(transform_points2_2d)( GLvector4f *to_vec,
00288                const GLfloat m[16],
00289                const GLvector4f *from_vec )
00290 {
00291    const GLuint stride = from_vec->stride;
00292    GLfloat *from = from_vec->start;
00293    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00294    GLuint count = from_vec->count;
00295    const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
00296    const GLfloat m12 = m[12], m13 = m[13];
00297    GLuint i;
00298    STRIDE_LOOP {
00299       const GLfloat ox = from[0], oy = from[1];
00300       to[i][0] = m0 * ox + m4 * oy + m12;
00301       to[i][1] = m1 * ox + m5 * oy + m13;
00302    }
00303    to_vec->size = 2;
00304    to_vec->flags |= VEC_SIZE_2;
00305    to_vec->count = from_vec->count;
00306 }
00307 
00308 static void _XFORMAPI
00309 TAG(transform_points2_2d_no_rot)( GLvector4f *to_vec,
00310                   const GLfloat m[16],
00311                   const GLvector4f *from_vec )
00312 {
00313    const GLuint stride = from_vec->stride;
00314    GLfloat *from = from_vec->start;
00315    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00316    GLuint count = from_vec->count;
00317    const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
00318    GLuint i;
00319    STRIDE_LOOP {
00320       const GLfloat ox = from[0], oy = from[1];
00321       to[i][0] = m0 * ox           + m12;
00322       to[i][1] =           m5 * oy + m13;
00323    }
00324    to_vec->size = 2;
00325    to_vec->flags |= VEC_SIZE_2;
00326    to_vec->count = from_vec->count;
00327 }
00328 
00329 static void _XFORMAPI
00330 TAG(transform_points2_3d)( GLvector4f *to_vec,
00331                const GLfloat m[16],
00332                const GLvector4f *from_vec )
00333 {
00334    const GLuint stride = from_vec->stride;
00335    GLfloat *from = from_vec->start;
00336    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00337    GLuint count = from_vec->count;
00338    const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
00339    const GLfloat m6 = m[6], m12 = m[12], m13 = m[13], m14 = m[14];
00340    GLuint i;
00341    STRIDE_LOOP {
00342       const GLfloat ox = from[0], oy = from[1];
00343       to[i][0] = m0 * ox + m4 * oy + m12;
00344       to[i][1] = m1 * ox + m5 * oy + m13;
00345       to[i][2] = m2 * ox + m6 * oy + m14;
00346    }
00347    to_vec->size = 3;
00348    to_vec->flags |= VEC_SIZE_3;
00349    to_vec->count = from_vec->count;
00350 }
00351 
00352 
00353 /* I would actually say this was a fairly important function, from
00354  * a texture transformation point of view.
00355  */
00356 static void _XFORMAPI
00357 TAG(transform_points2_3d_no_rot)( GLvector4f *to_vec,
00358                   const GLfloat m[16],
00359                   const GLvector4f *from_vec )
00360 {
00361    const GLuint stride = from_vec->stride;
00362    GLfloat *from = from_vec->start;
00363    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00364    GLuint count = from_vec->count;
00365    const GLfloat m0 = m[0], m5 = m[5];
00366    const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
00367    GLuint i;
00368    STRIDE_LOOP {
00369       const GLfloat ox = from[0], oy = from[1];
00370       to[i][0] = m0 * ox           + m12;
00371       to[i][1] =           m5 * oy + m13;
00372       to[i][2] =                     m14;
00373    }
00374    if (m14 == 0) {
00375       to_vec->size = 2;
00376       to_vec->flags |= VEC_SIZE_2;
00377    } else {
00378       to_vec->size = 3;
00379       to_vec->flags |= VEC_SIZE_3;
00380    }
00381    to_vec->count = from_vec->count;
00382 }
00383 
00384 
00385 static void _XFORMAPI
00386 TAG(transform_points2_perspective)( GLvector4f *to_vec,
00387                     const GLfloat m[16],
00388                     const GLvector4f *from_vec )
00389 {
00390    const GLuint stride = from_vec->stride;
00391    GLfloat *from = from_vec->start;
00392    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00393    GLuint count = from_vec->count;
00394    const GLfloat m0 = m[0], m5 = m[5], m14 = m[14];
00395    GLuint i;
00396    STRIDE_LOOP {
00397       const GLfloat ox = from[0], oy = from[1];
00398       to[i][0] = m0 * ox                ;
00399       to[i][1] =           m5 * oy      ;
00400       to[i][2] =                     m14;
00401       to[i][3] = 0;
00402    }
00403    to_vec->size = 4;
00404    to_vec->flags |= VEC_SIZE_4;
00405    to_vec->count = from_vec->count;
00406 }
00407 
00408 
00409 
00410 static void _XFORMAPI
00411 TAG(transform_points3_general)( GLvector4f *to_vec,
00412                 const GLfloat m[16],
00413                 const GLvector4f *from_vec )
00414 {
00415    const GLuint stride = from_vec->stride;
00416    GLfloat *from = from_vec->start;
00417    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00418    GLuint count = from_vec->count;
00419    const GLfloat m0 = m[0],  m4 = m[4],  m8 = m[8],  m12 = m[12];
00420    const GLfloat m1 = m[1],  m5 = m[5],  m9 = m[9],  m13 = m[13];
00421    const GLfloat m2 = m[2],  m6 = m[6],  m10 = m[10],  m14 = m[14];
00422    const GLfloat m3 = m[3],  m7 = m[7],  m11 = m[11],  m15 = m[15];
00423    GLuint i;
00424    STRIDE_LOOP {
00425       const GLfloat ox = from[0], oy = from[1], oz = from[2];
00426       to[i][0] = m0 * ox + m4 * oy + m8  * oz + m12;
00427       to[i][1] = m1 * ox + m5 * oy + m9  * oz + m13;
00428       to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14;
00429       to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15;
00430    }
00431    to_vec->size = 4;
00432    to_vec->flags |= VEC_SIZE_4;
00433    to_vec->count = from_vec->count;
00434 }
00435 
00436 static void _XFORMAPI
00437 TAG(transform_points3_identity)( GLvector4f *to_vec,
00438                  const GLfloat m[16],
00439                  const GLvector4f *from_vec )
00440 {
00441    const GLuint stride = from_vec->stride;
00442    GLfloat *from = from_vec->start;
00443    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00444    GLuint count = from_vec->count;
00445    GLuint i;
00446    (void) m;
00447    if (to_vec == from_vec) return;
00448    STRIDE_LOOP {
00449       to[i][0] = from[0];
00450       to[i][1] = from[1];
00451       to[i][2] = from[2];
00452    }
00453    to_vec->size = 3;
00454    to_vec->flags |= VEC_SIZE_3;
00455    to_vec->count = from_vec->count;
00456 }
00457 
00458 static void _XFORMAPI
00459 TAG(transform_points3_2d)( GLvector4f *to_vec,
00460                const GLfloat m[16],
00461                const GLvector4f *from_vec )
00462 {
00463    const GLuint stride = from_vec->stride;
00464    GLfloat *from = from_vec->start;
00465    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00466    GLuint count = from_vec->count;
00467    const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
00468    const GLfloat m12 = m[12], m13 = m[13];
00469    GLuint i;
00470    STRIDE_LOOP {
00471       const GLfloat ox = from[0], oy = from[1], oz = from[2];
00472       to[i][0] = m0 * ox + m4 * oy            + m12       ;
00473       to[i][1] = m1 * ox + m5 * oy            + m13       ;
00474       to[i][2] =                   +       oz             ;
00475    }
00476    to_vec->size = 3;
00477    to_vec->flags |= VEC_SIZE_3;
00478    to_vec->count = from_vec->count;
00479 }
00480 
00481 static void _XFORMAPI
00482 TAG(transform_points3_2d_no_rot)( GLvector4f *to_vec,
00483                   const GLfloat m[16],
00484                   const GLvector4f *from_vec )
00485 {
00486    const GLuint stride = from_vec->stride;
00487    GLfloat *from = from_vec->start;
00488    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00489    GLuint count = from_vec->count;
00490    const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
00491    GLuint i;
00492    STRIDE_LOOP {
00493       const GLfloat ox = from[0], oy = from[1], oz = from[2];
00494       to[i][0] = m0 * ox                      + m12       ;
00495       to[i][1] =           m5 * oy            + m13       ;
00496       to[i][2] =                   +       oz             ;
00497    }
00498    to_vec->size = 3;
00499    to_vec->flags |= VEC_SIZE_3;
00500    to_vec->count = from_vec->count;
00501 }
00502 
00503 static void _XFORMAPI
00504 TAG(transform_points3_3d)( GLvector4f *to_vec,
00505                const GLfloat m[16],
00506                const GLvector4f *from_vec )
00507 {
00508    const GLuint stride = from_vec->stride;
00509    GLfloat *from = from_vec->start;
00510    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00511    GLuint count = from_vec->count;
00512    const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
00513    const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10];
00514    const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
00515    GLuint i;
00516    STRIDE_LOOP {
00517       const GLfloat ox = from[0], oy = from[1], oz = from[2];
00518       to[i][0] = m0 * ox + m4 * oy +  m8 * oz + m12       ;
00519       to[i][1] = m1 * ox + m5 * oy +  m9 * oz + m13       ;
00520       to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14       ;
00521    }
00522    to_vec->size = 3;
00523    to_vec->flags |= VEC_SIZE_3;
00524    to_vec->count = from_vec->count;
00525 }
00526 
00527 /* previously known as ortho...
00528  */
00529 static void _XFORMAPI
00530 TAG(transform_points3_3d_no_rot)( GLvector4f *to_vec,
00531                   const GLfloat m[16],
00532                   const GLvector4f *from_vec )
00533 {
00534    const GLuint stride = from_vec->stride;
00535    GLfloat *from = from_vec->start;
00536    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00537    GLuint count = from_vec->count;
00538    const GLfloat m0 = m[0], m5 = m[5];
00539    const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14];
00540    GLuint i;
00541    STRIDE_LOOP {
00542       const GLfloat ox = from[0], oy = from[1], oz = from[2];
00543       to[i][0] = m0 * ox                      + m12       ;
00544       to[i][1] =           m5 * oy            + m13       ;
00545       to[i][2] =                     m10 * oz + m14       ;
00546    }
00547    to_vec->size = 3;
00548    to_vec->flags |= VEC_SIZE_3;
00549    to_vec->count = from_vec->count;
00550 }
00551 
00552 static void _XFORMAPI
00553 TAG(transform_points3_perspective)( GLvector4f *to_vec,
00554                     const GLfloat m[16],
00555                     const GLvector4f *from_vec )
00556 {
00557    const GLuint stride = from_vec->stride;
00558    GLfloat *from = from_vec->start;
00559    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00560    GLuint count = from_vec->count;
00561    const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9];
00562    const GLfloat m10 = m[10], m14 = m[14];
00563    GLuint i;
00564    STRIDE_LOOP {
00565       const GLfloat ox = from[0], oy = from[1], oz = from[2];
00566       to[i][0] = m0 * ox           + m8  * oz       ;
00567       to[i][1] =           m5 * oy + m9  * oz       ;
00568       to[i][2] =                     m10 * oz + m14 ;
00569       to[i][3] =                          -oz       ;
00570    }
00571    to_vec->size = 4;
00572    to_vec->flags |= VEC_SIZE_4;
00573    to_vec->count = from_vec->count;
00574 }
00575 
00576 
00577 
00578 static void _XFORMAPI
00579 TAG(transform_points4_general)( GLvector4f *to_vec,
00580                 const GLfloat m[16],
00581                 const GLvector4f *from_vec )
00582 {
00583    const GLuint stride = from_vec->stride;
00584    GLfloat *from = from_vec->start;
00585    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00586    GLuint count = from_vec->count;
00587    const GLfloat m0 = m[0],  m4 = m[4],  m8 = m[8],  m12 = m[12];
00588    const GLfloat m1 = m[1],  m5 = m[5],  m9 = m[9],  m13 = m[13];
00589    const GLfloat m2 = m[2],  m6 = m[6],  m10 = m[10],  m14 = m[14];
00590    const GLfloat m3 = m[3],  m7 = m[7],  m11 = m[11],  m15 = m[15];
00591    GLuint i;
00592    STRIDE_LOOP {
00593       const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
00594       to[i][0] = m0 * ox + m4 * oy + m8  * oz + m12 * ow;
00595       to[i][1] = m1 * ox + m5 * oy + m9  * oz + m13 * ow;
00596       to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow;
00597       to[i][3] = m3 * ox + m7 * oy + m11 * oz + m15 * ow;
00598    }
00599    to_vec->size = 4;
00600    to_vec->flags |= VEC_SIZE_4;
00601    to_vec->count = from_vec->count;
00602 }
00603 
00604 static void _XFORMAPI
00605 TAG(transform_points4_identity)( GLvector4f *to_vec,
00606                  const GLfloat m[16],
00607                  const GLvector4f *from_vec )
00608 {
00609    const GLuint stride = from_vec->stride;
00610    GLfloat *from = from_vec->start;
00611    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00612    GLuint count = from_vec->count;
00613    GLuint i;
00614    (void) m;
00615    if (to_vec == from_vec) return;
00616    STRIDE_LOOP {
00617       to[i][0] = from[0];
00618       to[i][1] = from[1];
00619       to[i][2] = from[2];
00620       to[i][3] = from[3];
00621    }
00622    to_vec->size = 4;
00623    to_vec->flags |= VEC_SIZE_4;
00624    to_vec->count = from_vec->count;
00625 }
00626 
00627 static void _XFORMAPI
00628 TAG(transform_points4_2d)( GLvector4f *to_vec,
00629                const GLfloat m[16],
00630                const GLvector4f *from_vec )
00631 {
00632    const GLuint stride = from_vec->stride;
00633    GLfloat *from = from_vec->start;
00634    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00635    GLuint count = from_vec->count;
00636    const GLfloat m0 = m[0], m1 = m[1], m4 = m[4], m5 = m[5];
00637    const GLfloat m12 = m[12], m13 = m[13];
00638    GLuint i;
00639    STRIDE_LOOP {
00640       const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
00641       to[i][0] = m0 * ox + m4 * oy            + m12 * ow;
00642       to[i][1] = m1 * ox + m5 * oy            + m13 * ow;
00643       to[i][2] =                   +       oz           ;
00644       to[i][3] =                                      ow;
00645    }
00646    to_vec->size = 4;
00647    to_vec->flags |= VEC_SIZE_4;
00648    to_vec->count = from_vec->count;
00649 }
00650 
00651 static void _XFORMAPI
00652 TAG(transform_points4_2d_no_rot)( GLvector4f *to_vec,
00653                   const GLfloat m[16],
00654                   const GLvector4f *from_vec )
00655 {
00656    const GLuint stride = from_vec->stride;
00657    GLfloat *from = from_vec->start;
00658    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00659    GLuint count = from_vec->count;
00660    const GLfloat m0 = m[0], m5 = m[5], m12 = m[12], m13 = m[13];
00661    GLuint i;
00662    STRIDE_LOOP {
00663       const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
00664       to[i][0] = m0 * ox                      + m12 * ow;
00665       to[i][1] =           m5 * oy            + m13 * ow;
00666       to[i][2] =                   +       oz           ;
00667       to[i][3] =                                      ow;
00668    }
00669    to_vec->size = 4;
00670    to_vec->flags |= VEC_SIZE_4;
00671    to_vec->count = from_vec->count;
00672 }
00673 
00674 static void _XFORMAPI
00675 TAG(transform_points4_3d)( GLvector4f *to_vec,
00676                const GLfloat m[16],
00677                const GLvector4f *from_vec )
00678 {
00679    const GLuint stride = from_vec->stride;
00680    GLfloat *from = from_vec->start;
00681    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00682    GLuint count = from_vec->count;
00683    const GLfloat m0 = m[0], m1 = m[1], m2 = m[2], m4 = m[4], m5 = m[5];
00684    const GLfloat m6 = m[6], m8 = m[8], m9 = m[9], m10 = m[10];
00685    const GLfloat m12 = m[12], m13 = m[13], m14 = m[14];
00686    GLuint i;
00687    STRIDE_LOOP {
00688       const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
00689       to[i][0] = m0 * ox + m4 * oy +  m8 * oz + m12 * ow;
00690       to[i][1] = m1 * ox + m5 * oy +  m9 * oz + m13 * ow;
00691       to[i][2] = m2 * ox + m6 * oy + m10 * oz + m14 * ow;
00692       to[i][3] =                                      ow;
00693    }
00694    to_vec->size = 4;
00695    to_vec->flags |= VEC_SIZE_4;
00696    to_vec->count = from_vec->count;
00697 }
00698 
00699 static void _XFORMAPI
00700 TAG(transform_points4_3d_no_rot)( GLvector4f *to_vec,
00701                   const GLfloat m[16],
00702                   const GLvector4f *from_vec )
00703 {
00704    const GLuint stride = from_vec->stride;
00705    GLfloat *from = from_vec->start;
00706    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00707    GLuint count = from_vec->count;
00708    const GLfloat m0 = m[0], m5 = m[5];
00709    const GLfloat m10 = m[10], m12 = m[12], m13 = m[13], m14 = m[14];
00710    GLuint i;
00711    STRIDE_LOOP {
00712       const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
00713       to[i][0] = m0 * ox                      + m12 * ow;
00714       to[i][1] =           m5 * oy            + m13 * ow;
00715       to[i][2] =                     m10 * oz + m14 * ow;
00716       to[i][3] =                                      ow;
00717    }
00718    to_vec->size = 4;
00719    to_vec->flags |= VEC_SIZE_4;
00720    to_vec->count = from_vec->count;
00721 }
00722 
00723 static void _XFORMAPI
00724 TAG(transform_points4_perspective)( GLvector4f *to_vec,
00725                     const GLfloat m[16],
00726                     const GLvector4f *from_vec )
00727 {
00728    const GLuint stride = from_vec->stride;
00729    GLfloat *from = from_vec->start;
00730    GLfloat (*to)[4] = (GLfloat (*)[4])to_vec->start;
00731    GLuint count = from_vec->count;
00732    const GLfloat m0 = m[0], m5 = m[5], m8 = m[8], m9 = m[9];
00733    const GLfloat m10 = m[10], m14 = m[14];
00734    GLuint i;
00735    STRIDE_LOOP {
00736       const GLfloat ox = from[0], oy = from[1], oz = from[2], ow = from[3];
00737       to[i][0] = m0 * ox           + m8  * oz            ;
00738       to[i][1] =           m5 * oy + m9  * oz            ;
00739       to[i][2] =                     m10 * oz + m14 * ow ;
00740       to[i][3] =                          -oz            ;
00741    }
00742    to_vec->size = 4;
00743    to_vec->flags |= VEC_SIZE_4;
00744    to_vec->count = from_vec->count;
00745 }
00746 
00747 static transform_func TAG(transform_tab_1)[7];
00748 static transform_func TAG(transform_tab_2)[7];
00749 static transform_func TAG(transform_tab_3)[7];
00750 static transform_func TAG(transform_tab_4)[7];
00751 
00752 /* Similar functions could be called several times, with more highly
00753  * optimized routines overwriting the arrays.  This only occurs during
00754  * startup.
00755  */
00756 static void _XFORMAPI TAG(init_c_transformations)( void )
00757 {
00758 #define TAG_TAB   _mesa_transform_tab
00759 #define TAG_TAB_1 TAG(transform_tab_1)
00760 #define TAG_TAB_2 TAG(transform_tab_2)
00761 #define TAG_TAB_3 TAG(transform_tab_3)
00762 #define TAG_TAB_4 TAG(transform_tab_4)
00763 
00764    TAG_TAB[1] = TAG_TAB_1;
00765    TAG_TAB[2] = TAG_TAB_2;
00766    TAG_TAB[3] = TAG_TAB_3;
00767    TAG_TAB[4] = TAG_TAB_4;
00768 
00769    /* 1-D points (ie texcoords) */
00770    TAG_TAB_1[MATRIX_GENERAL]     = TAG(transform_points1_general);
00771    TAG_TAB_1[MATRIX_IDENTITY]    = TAG(transform_points1_identity);
00772    TAG_TAB_1[MATRIX_3D_NO_ROT]   = TAG(transform_points1_3d_no_rot);
00773    TAG_TAB_1[MATRIX_PERSPECTIVE] = TAG(transform_points1_perspective);
00774    TAG_TAB_1[MATRIX_2D]          = TAG(transform_points1_2d);
00775    TAG_TAB_1[MATRIX_2D_NO_ROT]   = TAG(transform_points1_2d_no_rot);
00776    TAG_TAB_1[MATRIX_3D]          = TAG(transform_points1_3d);
00777 
00778    /* 2-D points */
00779    TAG_TAB_2[MATRIX_GENERAL]     = TAG(transform_points2_general);
00780    TAG_TAB_2[MATRIX_IDENTITY]    = TAG(transform_points2_identity);
00781    TAG_TAB_2[MATRIX_3D_NO_ROT]   = TAG(transform_points2_3d_no_rot);
00782    TAG_TAB_2[MATRIX_PERSPECTIVE] = TAG(transform_points2_perspective);
00783    TAG_TAB_2[MATRIX_2D]          = TAG(transform_points2_2d);
00784    TAG_TAB_2[MATRIX_2D_NO_ROT]   = TAG(transform_points2_2d_no_rot);
00785    TAG_TAB_2[MATRIX_3D]          = TAG(transform_points2_3d);
00786 
00787    /* 3-D points */
00788    TAG_TAB_3[MATRIX_GENERAL]     = TAG(transform_points3_general);
00789    TAG_TAB_3[MATRIX_IDENTITY]    = TAG(transform_points3_identity);
00790    TAG_TAB_3[MATRIX_3D_NO_ROT]   = TAG(transform_points3_3d_no_rot);
00791    TAG_TAB_3[MATRIX_PERSPECTIVE] = TAG(transform_points3_perspective);
00792    TAG_TAB_3[MATRIX_2D]          = TAG(transform_points3_2d);
00793    TAG_TAB_3[MATRIX_2D_NO_ROT]   = TAG(transform_points3_2d_no_rot);
00794    TAG_TAB_3[MATRIX_3D]          = TAG(transform_points3_3d);
00795 
00796    /* 4-D points */
00797    TAG_TAB_4[MATRIX_GENERAL]     = TAG(transform_points4_general);
00798    TAG_TAB_4[MATRIX_IDENTITY]    = TAG(transform_points4_identity);
00799    TAG_TAB_4[MATRIX_3D_NO_ROT]   = TAG(transform_points4_3d_no_rot);
00800    TAG_TAB_4[MATRIX_PERSPECTIVE] = TAG(transform_points4_perspective);
00801    TAG_TAB_4[MATRIX_2D]          = TAG(transform_points4_2d);
00802    TAG_TAB_4[MATRIX_2D_NO_ROT]   = TAG(transform_points4_2d_no_rot);
00803    TAG_TAB_4[MATRIX_3D]          = TAG(transform_points4_3d);
00804 
00805 #undef TAG_TAB
00806 #undef TAG_TAB_1
00807 #undef TAG_TAB_2
00808 #undef TAG_TAB_3
00809 #undef TAG_TAB_4
00810 }

Generated on Sun May 27 2012 04:20:33 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.