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

t_dd_imm_capi.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  * Authors:
00026  *    Gareth Hughes <gareth@valinux.com>
00027  */
00028 
00029 /* Template for immediate mode color functions.
00030  *
00031  * FIXME: Floating-point color versions of these...
00032  */
00033 
00034 
00035 static void TAG(Color3f)( GLfloat r, GLfloat g, GLfloat b )
00036 {
00037    GET_CURRENT;
00038 #ifdef COLOR_IS_FLOAT
00039    CURRENT_COLOR( RCOMP ) = CLAMP(r, 0.0f, 1.0f);
00040    CURRENT_COLOR( GCOMP ) = CLAMP(g, 0.0f, 1.0f);
00041    CURRENT_COLOR( BCOMP ) = CLAMP(b, 0.0f, 1.0f);
00042    CURRENT_COLOR( ACOMP ) = 1.0f;
00043 #else
00044    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( RCOMP ), r );
00045    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( GCOMP ), g );
00046    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( BCOMP ), b );
00047    CURRENT_COLOR( ACOMP ) = 255;
00048 #endif
00049 }
00050 
00051 static void TAG(Color3fv)( const GLfloat *v )
00052 {
00053    GET_CURRENT;
00054 #ifdef COLOR_IS_FLOAT
00055    CURRENT_COLOR( RCOMP ) = CLAMP(v[0], 0.0f, 1.0f);
00056    CURRENT_COLOR( GCOMP ) = CLAMP(v[1], 0.0f, 1.0f);
00057    CURRENT_COLOR( BCOMP ) = CLAMP(v[2], 0.0f, 1.0f);
00058    CURRENT_COLOR( ACOMP ) = 1.0f;
00059 #else
00060    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( RCOMP ), v[0] );
00061    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( GCOMP ), v[1] );
00062    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( BCOMP ), v[2] );
00063    CURRENT_COLOR( ACOMP ) = 255;
00064 #endif
00065 }
00066 
00067 static void TAG(Color3ub)( GLubyte r, GLubyte g, GLubyte b )
00068 {
00069    GET_CURRENT;
00070 #ifdef COLOR_IS_FLOAT
00071    CURRENT_COLOR( RCOMP ) = UBYTE_TO_FLOAT( r );
00072    CURRENT_COLOR( GCOMP ) = UBYTE_TO_FLOAT( g );
00073    CURRENT_COLOR( BCOMP ) = UBYTE_TO_FLOAT( b );
00074    CURRENT_COLOR( ACOMP ) = 1.0f;
00075 #else
00076    CURRENT_COLOR( RCOMP ) = r;
00077    CURRENT_COLOR( GCOMP ) = g;
00078    CURRENT_COLOR( BCOMP ) = b;
00079    CURRENT_COLOR( ACOMP ) = 255;
00080 #endif
00081 }
00082 
00083 static void TAG(Color3ubv)( const GLubyte *v )
00084 {
00085    GET_CURRENT;
00086 #ifdef COLOR_IS_FLOAT
00087    CURRENT_COLOR( RCOMP ) = UBYTE_TO_FLOAT( v[0] );
00088    CURRENT_COLOR( GCOMP ) = UBYTE_TO_FLOAT( v[1] );
00089    CURRENT_COLOR( BCOMP ) = UBYTE_TO_FLOAT( v[2] );
00090    CURRENT_COLOR( ACOMP ) = 1.0f;
00091 #else
00092    CURRENT_COLOR( RCOMP ) = v[0];
00093    CURRENT_COLOR( GCOMP ) = v[1];
00094    CURRENT_COLOR( BCOMP ) = v[2];
00095    CURRENT_COLOR( ACOMP ) = 255;
00096 #endif
00097 }
00098 
00099 static void TAG(Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
00100 {
00101    GET_CURRENT;
00102 #ifdef COLOR_IS_FLOAT
00103    CURRENT_COLOR( RCOMP ) = CLAMP(r, 0.0f, 1.0f);
00104    CURRENT_COLOR( GCOMP ) = CLAMP(g, 0.0f, 1.0f);
00105    CURRENT_COLOR( BCOMP ) = CLAMP(b, 0.0f, 1.0f);
00106    CURRENT_COLOR( ACOMP ) = CLAMP(a, 0.0f, 1.0f);
00107 #else
00108    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( RCOMP ), r );
00109    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( GCOMP ), g );
00110    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( BCOMP ), b );
00111    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( ACOMP ), a );
00112 #endif
00113 }
00114 
00115 static void TAG(Color4fv)( const GLfloat *v )
00116 {
00117    GET_CURRENT;
00118 #ifdef COLOR_IS_FLOAT
00119    CURRENT_COLOR( RCOMP ) = CLAMP(v[0], 0.0f, 1.0f);
00120    CURRENT_COLOR( GCOMP ) = CLAMP(v[1], 0.0f, 1.0f);
00121    CURRENT_COLOR( BCOMP ) = CLAMP(v[2], 0.0f, 1.0f);
00122    CURRENT_COLOR( ACOMP ) = CLAMP(v[3], 0.0f, 1.0f);
00123 #else
00124    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( RCOMP ), v[0] );
00125    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( GCOMP ), v[1] );
00126    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( BCOMP ), v[2] );
00127    UNCLAMPED_FLOAT_TO_UBYTE( CURRENT_COLOR( ACOMP ), v[3] );
00128 #endif
00129 }
00130 
00131 static void TAG(Color4ub)( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
00132 {
00133    GET_CURRENT;
00134 #ifdef COLOR_IS_FLOAT
00135    CURRENT_COLOR( RCOMP ) = UBYTE_TO_FLOAT( r );
00136    CURRENT_COLOR( GCOMP ) = UBYTE_TO_FLOAT( g );
00137    CURRENT_COLOR( BCOMP ) = UBYTE_TO_FLOAT( b );
00138    CURRENT_COLOR( ACOMP ) = UBYTE_TO_FLOAT( a );
00139 #else
00140    CURRENT_COLOR( RCOMP ) = r;
00141    CURRENT_COLOR( GCOMP ) = g;
00142    CURRENT_COLOR( BCOMP ) = b;
00143    CURRENT_COLOR( ACOMP ) = a;
00144 #endif
00145 }
00146 
00147 static void TAG(Color4ubv)( const GLubyte *v )
00148 {
00149    GET_CURRENT;
00150 #ifdef COLOR_IS_FLOAT
00151    CURRENT_COLOR( RCOMP ) = UBYTE_TO_FLOAT( v[0] );
00152    CURRENT_COLOR( GCOMP ) = UBYTE_TO_FLOAT( v[1] );
00153    CURRENT_COLOR( BCOMP ) = UBYTE_TO_FLOAT( v[2] );
00154    CURRENT_COLOR( ACOMP ) = UBYTE_TO_FLOAT( v[3] );
00155 #else
00156    CURRENT_COLOR( RCOMP ) = v[0];
00157    CURRENT_COLOR( GCOMP ) = v[1];
00158    CURRENT_COLOR( BCOMP ) = v[2];
00159    CURRENT_COLOR( ACOMP ) = v[3];
00160 #endif
00161 }
00162 
00163 
00164 static void TAG(ColorMaterial3f)( GLfloat r, GLfloat g, GLfloat b )
00165 {
00166    GET_CURRENT_CONTEXT(ctx);
00167    GLfloat *color = ctx->Current.Color;
00168 
00169    color[0] = r;
00170    color[1] = g;
00171    color[2] = b;
00172    color[3] = 1.0;
00173 
00174    _mesa_update_color_material( ctx, color );
00175    RECALC_BASE_COLOR( ctx );
00176 }
00177 
00178 static void TAG(ColorMaterial3fv)( const GLfloat *v )
00179 {
00180    GET_CURRENT_CONTEXT(ctx);
00181    GLfloat *color = ctx->Current.Color;
00182 
00183    color[0] = v[0];
00184    color[1] = v[1];
00185    color[2] = v[2];
00186    color[3] = 1.0;
00187 
00188    _mesa_update_color_material( ctx, color );
00189    RECALC_BASE_COLOR( ctx );
00190 }
00191 
00192 static void TAG(ColorMaterial3ub)( GLubyte r, GLubyte g, GLubyte b )
00193 {
00194    GET_CURRENT_CONTEXT(ctx);
00195    GLfloat *color = ctx->Current.Color;
00196 
00197    color[0] = UBYTE_TO_FLOAT( r );
00198    color[1] = UBYTE_TO_FLOAT( g );
00199    color[2] = UBYTE_TO_FLOAT( b );
00200    color[3] = 1.0;
00201 
00202    _mesa_update_color_material( ctx, color );
00203    RECALC_BASE_COLOR( ctx );
00204 }
00205 
00206 static void TAG(ColorMaterial3ubv)( const GLubyte *v )
00207 {
00208    GET_CURRENT_CONTEXT(ctx);
00209    GLfloat *color = ctx->Current.Color;
00210 
00211    color[0] = UBYTE_TO_FLOAT( v[0] );
00212    color[1] = UBYTE_TO_FLOAT( v[1] );
00213    color[2] = UBYTE_TO_FLOAT( v[2] );
00214    color[3] = 1.0;
00215 
00216    _mesa_update_color_material( ctx, color );
00217    RECALC_BASE_COLOR( ctx );
00218 }
00219 
00220 static void TAG(ColorMaterial4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
00221 {
00222    GET_CURRENT_CONTEXT(ctx);
00223    GLfloat *color = ctx->Current.Color;
00224 
00225    color[0] = r;
00226    color[1] = g;
00227    color[2] = b;
00228    color[3] = a;
00229 
00230    _mesa_update_color_material( ctx, color );
00231    RECALC_BASE_COLOR( ctx );
00232 }
00233 
00234 static void TAG(ColorMaterial4fv)( const GLfloat *v )
00235 {
00236    GET_CURRENT_CONTEXT(ctx);
00237    GLfloat *color = ctx->Current.Color;
00238 
00239    color[0] = v[0];
00240    color[1] = v[1];
00241    color[2] = v[2];
00242    color[3] = v[3];
00243 
00244    _mesa_update_color_material( ctx, color );
00245    RECALC_BASE_COLOR( ctx );
00246 }
00247 
00248 static void TAG(ColorMaterial4ub)( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
00249 {
00250    GET_CURRENT_CONTEXT(ctx);
00251    GLfloat *color = ctx->Current.Color;
00252 
00253    color[0] = UBYTE_TO_FLOAT( r );
00254    color[1] = UBYTE_TO_FLOAT( g );
00255    color[2] = UBYTE_TO_FLOAT( b );
00256    color[3] = UBYTE_TO_FLOAT( a );
00257 
00258    _mesa_update_color_material( ctx, color );
00259    RECALC_BASE_COLOR( ctx );
00260 }
00261 
00262 static void TAG(ColorMaterial4ubv)( const GLubyte *v )
00263 {
00264    GET_CURRENT_CONTEXT(ctx);
00265    GLfloat *color = ctx->Current.Color;
00266 
00267    color[0] = UBYTE_TO_FLOAT( v[0] );
00268    color[1] = UBYTE_TO_FLOAT( v[1] );
00269    color[2] = UBYTE_TO_FLOAT( v[2] );
00270    color[3] = UBYTE_TO_FLOAT( v[3] );
00271 
00272    _mesa_update_color_material( ctx, color );
00273    RECALC_BASE_COLOR( ctx );
00274 }
00275 
00276 
00277 
00278 
00279 
00280 /* =============================================================
00281  * Color chooser functions:
00282  */
00283 
00284 static void TAG(choose_Color3f)( GLfloat r, GLfloat g, GLfloat b )
00285 {
00286    GET_CURRENT_CONTEXT(ctx);
00287 
00288    if ( ctx->Light.Enabled ) {
00289       if ( ctx->Light.ColorMaterialEnabled ) {
00290      SET_Color3f(ctx->Exec, TAG(ColorMaterial3f));
00291       } else {
00292      SET_Color3f(ctx->Exec, _mesa_noop_Color3f);
00293       }
00294    } else {
00295       SET_Color3f(ctx->Exec, TAG(Color3f));
00296    }
00297    glColor3f( r, g, b );
00298 }
00299 
00300 static void TAG(choose_Color3fv)( const GLfloat *v )
00301 {
00302    GET_CURRENT_CONTEXT(ctx);
00303 
00304    if ( ctx->Light.Enabled ) {
00305       if ( ctx->Light.ColorMaterialEnabled ) {
00306      SET_Color3fv(ctx->Exec, TAG(ColorMaterial3fv));
00307       } else {
00308      SET_Color3fv(ctx->Exec, _mesa_noop_Color3fv);
00309       }
00310    } else {
00311       SET_Color3fv(ctx->Exec, TAG(Color3fv));
00312    }
00313    glColor3fv( v );
00314 }
00315 
00316 static void TAG(choose_Color3ub)( GLubyte r, GLubyte g, GLubyte b )
00317 {
00318    GET_CURRENT_CONTEXT(ctx);
00319 
00320    if ( ctx->Light.Enabled ) {
00321       if ( ctx->Light.ColorMaterialEnabled ) {
00322      SET_Color3ub(ctx->Exec, TAG(ColorMaterial3ub));
00323       } else {
00324      SET_Color3ub(ctx->Exec, _mesa_noop_Color3ub);
00325       }
00326    } else {
00327       SET_Color3ub(ctx->Exec, TAG(Color3ub));
00328    }
00329    glColor3ub( r, g, b );
00330 }
00331 
00332 static void TAG(choose_Color3ubv)( const GLubyte *v )
00333 {
00334    GET_CURRENT_CONTEXT(ctx);
00335 
00336    if ( ctx->Light.Enabled ) {
00337       if ( ctx->Light.ColorMaterialEnabled ) {
00338      SET_Color3ubv(ctx->Exec, TAG(ColorMaterial3ubv));
00339       } else {
00340      SET_Color3ubv(ctx->Exec, _mesa_noop_Color3ubv);
00341       }
00342    } else {
00343       SET_Color3ubv(ctx->Exec, TAG(Color3ubv));
00344    }
00345    glColor3ubv( v );
00346 }
00347 
00348 static void TAG(choose_Color4f)( GLfloat r, GLfloat g, GLfloat b, GLfloat a )
00349 {
00350    GET_CURRENT_CONTEXT(ctx);
00351 
00352    if ( ctx->Light.Enabled ) {
00353       if ( ctx->Light.ColorMaterialEnabled ) {
00354      SET_Color4f(ctx->Exec, TAG(ColorMaterial4f));
00355       } else {
00356      SET_Color4f(ctx->Exec, _mesa_noop_Color4f);
00357       }
00358    } else {
00359       SET_Color4f(ctx->Exec, TAG(Color4f));
00360    }
00361    glColor4f( r, g, b, a );
00362 }
00363 
00364 static void TAG(choose_Color4fv)( const GLfloat *v )
00365 {
00366    GET_CURRENT_CONTEXT(ctx);
00367 
00368    if ( ctx->Light.Enabled ) {
00369       if ( ctx->Light.ColorMaterialEnabled ) {
00370      SET_Color4fv(ctx->Exec, TAG(ColorMaterial4fv));
00371       } else {
00372      SET_Color4fv(ctx->Exec, _mesa_noop_Color4fv);
00373       }
00374    } else {
00375       SET_Color4fv(ctx->Exec, TAG(Color4fv));
00376    }
00377    glColor4fv( v );
00378 }
00379 
00380 static void TAG(choose_Color4ub)( GLubyte r, GLubyte g, GLubyte b, GLubyte a )
00381 {
00382    GET_CURRENT_CONTEXT(ctx);
00383 
00384    if ( ctx->Light.Enabled ) {
00385       if ( ctx->Light.ColorMaterialEnabled ) {
00386      SET_Color4ub(ctx->Exec, TAG(ColorMaterial4ub));
00387       } else {
00388      SET_Color4ub(ctx->Exec, _mesa_noop_Color4ub);
00389       }
00390    } else {
00391       SET_Color4ub(ctx->Exec, TAG(Color4ub));
00392    }
00393    glColor4ub( r, g, b, a );
00394 }
00395 
00396 static void TAG(choose_Color4ubv)( const GLubyte *v )
00397 {
00398    GET_CURRENT_CONTEXT(ctx);
00399 
00400    if ( ctx->Light.Enabled ) {
00401       if ( ctx->Light.ColorMaterialEnabled ) {
00402      SET_Color4ubv(ctx->Exec, TAG(ColorMaterial4ubv));
00403       } else {
00404      SET_Color4ubv(ctx->Exec, _mesa_noop_Color4ubv);
00405       }
00406    } else {
00407       SET_Color4ubv(ctx->Exec, TAG(Color4ubv));
00408    }
00409    glColor4ubv( v );
00410 }
00411 
00412 
00413 
00414 #undef GET_CURRENT
00415 #undef CURRENT_COLOR
00416 #undef CURRENT_SPECULAR
00417 #undef COLOR_IS_FLOAT
00418 #undef RECALC_BASE_COLOR
00419 #undef TAG

Generated on Sat May 26 2012 04:19:36 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.