Página principal | Jerarquía de la clase | Lista alfabética | Lista de componentes | Lista de archivos | Miembros de las clases | Archivos de los miembros | Páginas relacionadas

calidad_v.C

Ir a la documentación de este archivo.
00001 //===========================================================================
00002 //= calidad_v.cc                                              Julio de 1998 =
00003 //=-------------------------------------------------------------------------=
00004 //= Definiciones de la clase CALIDAD_VISUAL                                 =
00005 //=-------------------------------------------------------------------------=
00006 //= ADVERTENCIA: ESTE SOFTWARE NO ESTA CONCEBIDO NI DISENNADO PARA EL USO   =
00007 //= EN EQUIPO DE CONTROL EN LINEA EN ENTORNOS PELIGROSOS QUE REQUIERAN UN   =
00008 //= DESEMPENNO LIBRE DE FALLAS, COMO LA OPERACION DE PLANTAS NUCLEARES,     = 
00009 //= SISTEMAS DE NAVEGACION O COMUNICACION EN AVIONES, TRAFICO AEREO,        =
00010 //= EQUIPO MEDICO DEL CUAL DEPENDAN VIDAS HUMANAS O SISTEMAS DE ARMAMENTO,  =
00011 //= EN LOS CUALES UNA FALLA EN EL SOFTWARE PUEDA IMPLICAR DIRECTAMENTE LA   =
00012 //= MUERTE, DANNOS PERSONALES O DANNOS FISICOS Y/O AMBIENTALES GRAVES       =
00013 //= ("ACTIVIDADES DE ALGO RIESGO").                                         =
00014 //=-------------------------------------------------------------------------=
00015 //= Autor original: Oscar J. Chavarro G.  A.K.A. JEDILINK. Copyright (c),   =
00016 //= 1997 - 2003, oscarchavarro@hotmail.com                                  =
00017 //= AQUYNZA es software libre, y se rige bajo los terminos de la licencia   =
00018 //= LGPL de GNU (http://www.gnu.org). Para mayor informacion respecto a la  =
00019 //= licencia de uso, consulte el archivo ./doc/LICENCIA en la distribucion. =
00020 //===========================================================================
00021 
00022 #include "toolkits/entorno/calidad_v.h"
00023 
00024 #include <string.h>
00025 
00026 //===========================================================================
00027 //= VARIABLES GLOBALES Y MACROS                                             =
00028 //===========================================================================
00029 
00030 #define ESPERO(tipo, msg) \
00031     if ( tipo_token != (tipo) ) { \
00032       fprintf(stderr, "<CALIDAD_VISUAL> ERROR: Esperaba %s y recibi [%s].\n", \
00033         (msg), cad); fflush(stderr);  return FALSE; \
00034     }
00035 
00036 #ifndef GL_ENABLED
00037     #define GL_NEAREST_MIPMAP_NEAREST 0x2700
00038     #define GL_NEAREST_MIPMAP_LINEAR  0x2702
00039     #define GL_LINEAR_MIPMAP_NEAREST  0x2701
00040     #define GL_LINEAR_MIPMAP_LINEAR   0x2703
00041     #define GL_OBJECT_LINEAR          0x2401
00042     #define GL_OBJECT_PLANE           0x2501
00043     #define GL_EYE_LINEAR             0x2400
00044     #define GL_EYE_PLANE              0x2502
00045     #define GL_SPHERE_MAP             0x2402
00046     #define GL_DECAL                  0x2101
00047     #define GL_MODULATE               0x2100
00048     #define GL_NEAREST                0x2600
00049     #define GL_LINEAR                 0x2601
00050     #define GL_EXP                    0x0800
00051     #define GL_EXP2                   0x0801
00052     #define GL_REPLACE                0x1E01
00053     #define GL_BLEND                  0x0BE2
00054     #define GL_BLEND_SRC              0x0BE1
00055     #define GL_BLEND_DST              0x0BE0
00056 #endif
00057 
00058 //===========================================================================
00059 //= CLASE CALIDAD_VISUAL                                                    =
00060 //===========================================================================
00061 
00062 CALIDAD_VISUAL::CALIDAD_VISUAL()
00063 {
00064     con_caras = TRUE;
00065     con_bordes = FALSE;
00066     con_textura = TRUE;
00067     con_entorno = FALSE;
00068     con_caustics = FALSE;
00069     con_cajas = FALSE;
00070     con_normales = FALSE;
00071     calidad_caras = CVC_SHADE;
00072     interpolacion_mintex = GL_LINEAR; //GL_LINEAR_MIPMAP_NEAREST;
00073     interpolacion_magtex = GL_LINEAR; //GL_LINEAR_MIPMAP_NEAREST;
00074     funcion_combinacion_textura = GL_MODULATE;
00075 
00076     control_textura = 1;
00077     //con_transparencias = FALSE;
00078     //factor_longitud_normales = 1.0;
00079     //ancho_de_lineas = 1.0;
00080 }
00081 
00082 int
00083 CALIDAD_VISUAL::operator == (const CALIDAD_VISUAL &otra)
00084 {
00085     if (
00086         con_caras     != otra.con_caras    ||
00087         con_bordes    != otra.con_bordes   ||
00088         con_textura   != otra.con_textura  ||
00089         con_cajas     != otra.con_cajas    ||
00090         con_normales  != otra.con_normales ||
00091         calidad_caras != otra.calidad_caras
00092     ) {
00093         return 0;
00094     }
00095 
00096     return 1;
00097 }
00098 
00099 #define CAMBIAR_CALIDAD_TEXTURA()                               \
00100         printf("[%d/24] ", control_textura+1);                  \
00101         switch( control_textura ) {                             \
00102           case 0:                                               \
00103             interpolacion_mintex = GL_NEAREST;                  \
00104             printf("Calidad MIN: GL_NEAREST ");                 \
00105             interpolacion_magtex = GL_NEAREST;                  \
00106             printf("MAG: GL_NEAREST ");                         \
00107             funcion_combinacion_textura = GL_MODULATE;          \
00108             printf("Combinacion: GL_MODULATE\n");               \
00109             fflush(stdout);                                     \
00110             break;                                              \
00111           case 1:                                               \
00112             interpolacion_mintex = GL_LINEAR;                   \
00113             printf("Calidad MIN: GL_LINEAR ");                  \
00114             interpolacion_magtex = GL_LINEAR;                   \
00115             printf("MAG: GL_LINEAR ");                          \
00116             funcion_combinacion_textura = GL_MODULATE;          \
00117             printf("Combinacion: GL_MODULATE\n");               \
00118             fflush(stdout);                                     \
00119             break;                                              \
00120           case 2:                                               \
00121             interpolacion_mintex = GL_NEAREST_MIPMAP_NEAREST;   \
00122             printf("Calidad MIN: GL_NEAREST_MIPMAP_NEAREST ");  \
00123             interpolacion_magtex = GL_NEAREST;              ;   \
00124             printf("MAG: GL_NEAREST_MIPMAP_NEAREST ");          \
00125             funcion_combinacion_textura = GL_MODULATE;          \
00126             printf("Combinacion: GL_MODULATE\n");               \
00127             fflush(stdout);                                     \
00128             break;                                              \
00129           case 3:                                               \
00130             interpolacion_mintex = GL_LINEAR_MIPMAP_NEAREST;    \
00131             printf("Calidad MIN: GL_LINEAR_MIPMAP_NEAREST ");   \
00132             interpolacion_magtex = GL_LINEAR;                   \
00133             printf("MAG: GL_LINEAR_MIPMAP_NEAREST ");           \
00134             funcion_combinacion_textura = GL_MODULATE;          \
00135             printf("Combinacion: GL_MODULATE\n");               \
00136             fflush(stdout);                                     \
00137             break;                                              \
00138           case 4:                                               \
00139             interpolacion_mintex = GL_NEAREST_MIPMAP_LINEAR;    \
00140             printf("Calidad MIN: GL_NEAREST_MIPMAP_LINEAR ");   \
00141             interpolacion_magtex = GL_LINEAR;                   \
00142             printf("MAG: GL_LINEAR_MIPMAP_LINEAR ");            \
00143             funcion_combinacion_textura = GL_MODULATE;          \
00144             printf("Combinacion: GL_MODULATE\n");               \
00145             fflush(stdout);                                     \
00146             break;                                              \
00147           case 5:                                               \
00148             interpolacion_mintex = GL_NEAREST_MIPMAP_LINEAR;    \
00149             printf("Calidad MIN: GL_NEAREST_MIPMAP_LINEAR ");   \
00150             interpolacion_magtex = GL_LINEAR;                   \
00151             printf("MAG: GL_LINEAR_MIPMAP_LINEAR ");            \
00152             funcion_combinacion_textura = GL_MODULATE;          \
00153             printf("Combinacion: GL_MODULATE\n");               \
00154             fflush(stdout);                                     \
00155             break;                                              \
00156           case 6:                                               \
00157             interpolacion_mintex = GL_NEAREST;                  \
00158             printf("Calidad MIN: GL_NEAREST ");                 \
00159             interpolacion_magtex = GL_NEAREST;                  \
00160             printf("MAG: GL_NEAREST ");                         \
00161             funcion_combinacion_textura = GL_DECAL;             \
00162             printf("Combinacion: GL_DECAL\n");                  \
00163             fflush(stdout);                                     \
00164             break;                                              \
00165           case 7:                                               \
00166             interpolacion_mintex = GL_LINEAR;                   \
00167             printf("Calidad MIN: GL_LINEAR ");                  \
00168             interpolacion_magtex = GL_LINEAR;                   \
00169             printf("MAG: GL_LINEAR ");                          \
00170             funcion_combinacion_textura = GL_DECAL;             \
00171             printf("Combinacion: GL_DECAL\n");                  \
00172             fflush(stdout);                                     \
00173             break;                                              \
00174           case 8:                                               \
00175             interpolacion_mintex = GL_NEAREST_MIPMAP_NEAREST;   \
00176             printf("Calidad MIN: GL_NEAREST_MIPMAP_NEAREST ");  \
00177             interpolacion_magtex = GL_NEAREST;                  \
00178             printf("MAG: GL_NEAREST_MIPMAP_NEAREST ");          \
00179             funcion_combinacion_textura = GL_DECAL;             \
00180             printf("Combinacion: GL_DECAL\n");                  \
00181             fflush(stdout);                                     \
00182             break;                                              \
00183           case 9:                                               \
00184             interpolacion_mintex = GL_LINEAR_MIPMAP_NEAREST;    \
00185             printf("Calidad MIN: GL_LINEAR_MIPMAP_NEAREST ");   \
00186             interpolacion_magtex = GL_LINEAR;                   \
00187             printf("MAG: GL_LINEAR_MIPMAP_NEAREST ");           \
00188             funcion_combinacion_textura = GL_DECAL;             \
00189             printf("Combinacion: GL_DECAL\n");                  \
00190             fflush(stdout);                                     \
00191             break;                                              \
00192           case 10:                                              \
00193             interpolacion_mintex = GL_NEAREST_MIPMAP_LINEAR;    \
00194             printf("Calidad MIN: GL_NEAREST_MIPMAP_LINEAR ");   \
00195             interpolacion_magtex = GL_LINEAR;                   \
00196             printf("MAG: GL_LINEAR_MIPMAP_LINEAR ");            \
00197             funcion_combinacion_textura = GL_DECAL;             \
00198             printf("Combinacion: GL_DECAL\n");                  \
00199             fflush(stdout);                                     \
00200             break;                                              \
00201           case 11:                                              \
00202             interpolacion_mintex = GL_NEAREST_MIPMAP_LINEAR;    \
00203             printf("Calidad MIN: GL_NEAREST_MIPMAP_LINEAR ");   \
00204             interpolacion_magtex = GL_LINEAR;                   \
00205             printf("MAG: GL_LINEAR_MIPMAP_LINEAR ");            \
00206             funcion_combinacion_textura = GL_DECAL;             \
00207             printf("Combinacion: GL_DECAL\n");                  \
00208             fflush(stdout);                                     \
00209             break;                                              \
00210           case 12:                                              \
00211             interpolacion_mintex = GL_NEAREST;                  \
00212             printf("Calidad MIN: GL_NEAREST ");                 \
00213             interpolacion_magtex = GL_NEAREST;                  \
00214             printf("MAG: GL_NEAREST ");                         \
00215             funcion_combinacion_textura = GL_REPLACE;           \
00216             printf("Combinacion: GL_REPLACE\n");                \
00217             fflush(stdout);                                     \
00218             break;                                              \
00219           case 13:                                              \
00220             interpolacion_mintex = GL_LINEAR;                   \
00221             printf("Calidad MIN: GL_LINEAR ");                  \
00222             interpolacion_magtex = GL_LINEAR;                   \
00223             printf("MAG: GL_LINEAR ");                          \
00224             funcion_combinacion_textura = GL_REPLACE;           \
00225             printf("Combinacion: GL_REPLACE\n");                \
00226             fflush(stdout);                                     \
00227             break;                                              \
00228           case 14:                                              \
00229             interpolacion_mintex = GL_NEAREST_MIPMAP_NEAREST;   \
00230             printf("Calidad MIN: GL_NEAREST_MIPMAP_NEAREST ");  \
00231             interpolacion_magtex = GL_NEAREST;                  \
00232             printf("MAG: GL_NEAREST_MIPMAP_NEAREST ");          \
00233             funcion_combinacion_textura = GL_REPLACE;           \
00234             printf("Combinacion: GL_REPLACE\n");                \
00235             fflush(stdout);                                     \
00236             break;                                              \
00237           case 15:                                              \
00238             interpolacion_mintex = GL_LINEAR_MIPMAP_NEAREST;    \
00239             printf("Calidad MIN: GL_LINEAR_MIPMAP_NEAREST ");   \
00240             interpolacion_magtex = GL_LINEAR;                   \
00241             printf("MAG: GL_LINEAR_MIPMAP_NEAREST ");           \
00242             funcion_combinacion_textura = GL_REPLACE;           \
00243             printf("Combinacion: GL_REPLACE\n");                \
00244             fflush(stdout);                                     \
00245             break;                                              \
00246           case 16:                                              \
00247             interpolacion_mintex = GL_NEAREST_MIPMAP_LINEAR;    \
00248             printf("Calidad MIN: GL_NEAREST_MIPMAP_LINEAR ");   \
00249             interpolacion_magtex = GL_LINEAR;                   \
00250             printf("MAG: GL_LINEAR_MIPMAP_LINEAR ");            \
00251             funcion_combinacion_textura = GL_REPLACE;           \
00252             printf("Combinacion: GL_REPLACE\n");                \
00253             fflush(stdout);                                     \
00254             break;                                              \
00255           case 17:                                              \
00256             interpolacion_mintex = GL_NEAREST_MIPMAP_LINEAR;    \
00257             printf("Calidad MIN: GL_NEAREST_MIPMAP_LINEAR ");   \
00258             interpolacion_magtex = GL_LINEAR;                   \
00259             printf("MAG: GL_LINEAR_MIPMAP_LINEAR ");            \
00260             funcion_combinacion_textura = GL_REPLACE;           \
00261             printf("Combinacion: GL_REPLACE\n");                \
00262             fflush(stdout);                                     \
00263             break;                                              \
00264           case 18:                                              \
00265             interpolacion_mintex = GL_NEAREST;                  \
00266             printf("Calidad MIN: GL_NEAREST ");                 \
00267             interpolacion_magtex = GL_NEAREST;                  \
00268             printf("MAG: GL_NEAREST ");                         \
00269             funcion_combinacion_textura = GL_BLEND;             \
00270             printf("Combinacion: GL_BLEND\n");                  \
00271             fflush(stdout);                                     \
00272             break;                                              \
00273           case 19:                                              \
00274             interpolacion_mintex = GL_LINEAR;                   \
00275             printf("Calidad MIN: GL_LINEAR ");                  \
00276             interpolacion_magtex = GL_LINEAR;                   \
00277             printf("MAG: GL_LINEAR ");                          \
00278             funcion_combinacion_textura = GL_BLEND;             \
00279             printf("Combinacion: GL_BLEND\n");                  \
00280             fflush(stdout);                                     \
00281             break;                                              \
00282           case 20:                                              \
00283             interpolacion_mintex = GL_NEAREST_MIPMAP_NEAREST;   \
00284             printf("Calidad MIN: GL_NEAREST_MIPMAP_NEAREST ");  \
00285             interpolacion_magtex = GL_NEAREST;                  \
00286             printf("MAG: GL_NEAREST_MIPMAP_NEAREST ");          \
00287             funcion_combinacion_textura = GL_BLEND;             \
00288             printf("Combinacion: GL_BLEND\n");                  \
00289             fflush(stdout);                                     \
00290             break;                                              \
00291           case 21:                                              \
00292             interpolacion_mintex = GL_LINEAR_MIPMAP_NEAREST;    \
00293             printf("Calidad MIN: GL_LINEAR_MIPMAP_NEAREST ");   \
00294             interpolacion_magtex = GL_LINEAR;                   \
00295             printf("MAG: GL_LINEAR_MIPMAP_NEAREST ");           \
00296             funcion_combinacion_textura = GL_BLEND;             \
00297             printf("Combinacion: GL_BLEND\n");                  \
00298             fflush(stdout);                                     \
00299             break;                                              \
00300           case 22:                                              \
00301             interpolacion_mintex = GL_NEAREST_MIPMAP_LINEAR;    \
00302             printf("Calidad MIN: GL_NEAREST_MIPMAP_LINEAR ");   \
00303             interpolacion_magtex = GL_LINEAR;                   \
00304             printf("MAG: GL_LINEAR_MIPMAP_LINEAR ");            \
00305             funcion_combinacion_textura = GL_BLEND;             \
00306             printf("Combinacion: GL_BLEND\n");                  \
00307             fflush(stdout);                                     \
00308             break;                                              \
00309           case 23:                                              \
00310             interpolacion_mintex = GL_NEAREST_MIPMAP_LINEAR;    \
00311             printf("Calidad MIN: GL_NEAREST_MIPMAP_LINEAR ");   \
00312             interpolacion_magtex = GL_LINEAR;                   \
00313             printf("MAG: GL_LINEAR_MIPMAP_LINEAR ");            \
00314             funcion_combinacion_textura = GL_BLEND;             \
00315             printf("Combinacion: GL_BLEND\n");                  \
00316             fflush(stdout);                                     \
00317             break;                                              \
00318           default: break;                                       \
00319         }
00320 
00321 BOOLEAN
00322 CALIDAD_VISUAL::procesar_teclado(EVENTO_GUI *e)
00323 {
00324     switch( e->key_code ) {
00325       case JK_C:
00326         if ( con_caras ) con_caras = FALSE; else con_caras = TRUE;
00327         break;
00328       case JK_b:
00329         if ( con_bordes ) con_bordes = FALSE; else con_bordes = TRUE;
00330         break;
00331       case JK_t:
00332         if ( con_textura ) con_textura = FALSE; else con_textura = TRUE;
00333         break;
00334       case JK_E:
00335         if ( con_entorno ) con_entorno = FALSE; else con_entorno = TRUE;
00336         break;
00337       case JK_T:
00338         control_textura++;
00339         if ( control_textura > 23 ) control_textura = 0;
00340         clrscr();
00341         CAMBIAR_CALIDAD_TEXTURA();
00342         break;
00343       case JK_R:
00344         control_textura--;
00345         if ( control_textura < 0 ) control_textura = 23;
00346         clrscr();
00347         CAMBIAR_CALIDAD_TEXTURA();
00348         break;
00349       case JK_M:
00350         if ( con_cajas ) con_cajas = FALSE; else con_cajas = TRUE;
00351         break;
00352       case JK_c:
00353         switch ( calidad_caras ) {
00354           case CVC_CONSTANTE: calidad_caras = CVC_FLAT; break;
00355           case CVC_FLAT: calidad_caras = CVC_SHADE; break;
00356           case CVC_SHADE: calidad_caras = CVC_CONSTANTE; break;
00357           default: calidad_caras = CVC_FLAT; break;
00358         }
00359         break;
00360       default:  return FALSE;
00361     }
00362     return TRUE;
00363 }
00364 
00365 //= SERVICIOS DE PERSISTENCIA ===============================================
00366 
00367 BOOLEAN
00368 CALIDAD_VISUAL::leer(TOKENIZADOR *Sabiondo)
00369 {
00370     char cad[1000];
00371     int tipo_token = TK_DESCONOCIDO, pos;
00372 
00373     //- Ejecute el parser especifico de la COSA_RIGIDA -----------------
00374     pos = 2;
00375     while ( tipo_token != TK_CERRAR) {
00376         tipo_token = Sabiondo->siguiente_token(cad);
00377         switch ( pos ) {
00378         /*
00379             case 1:
00380               ESPERO(TK_CADENA, "una cadena");
00381               if ( strlen(cad) > MAX_CAD-1 ) cad[MAX_CAD-1] = '\0'; 
00382               des_comille(cad);
00383               set_nombre(cad);
00384               pos++;
00385               break;*/
00386             case 2:  ESPERO(TK_ABRIR, "\"{\"");  pos++; break;
00387             default:
00388               if ( tipo_token == TK_CERRAR ) break;
00389               ESPERO(TK_IDENTIFICADOR, "un identificador (3)");
00390               if ( strcmp(cad, "con_caras") == 0 ) {
00391                     tipo_token = Sabiondo->siguiente_token(cad);
00392                     ESPERO(TK_IDENTIFICADOR, "TRUE o FALSE");
00393                     if ( strcmp(cad, "TRUE") == 0 ) con_caras = TRUE;
00394                     else con_caras = FALSE;
00395                 }
00396                 else if ( strcmp(cad, "con_bordes") == 0 ) {
00397                     tipo_token = Sabiondo->siguiente_token(cad);
00398                     ESPERO(TK_IDENTIFICADOR, "TRUE o FALSE");
00399                     if ( strcmp(cad, "TRUE") == 0 ) con_bordes = TRUE;
00400                     else con_bordes = FALSE;
00401                 }
00402                 else if ( strcmp(cad, "con_textura") == 0 ) {
00403                     tipo_token = Sabiondo->siguiente_token(cad);
00404                     ESPERO(TK_IDENTIFICADOR, "TRUE o FALSE");
00405                     if ( strcmp(cad, "TRUE") == 0 ) con_textura = TRUE;
00406                     else con_textura = FALSE;
00407                 }
00408                 else if ( strcmp(cad, "con_cajas") == 0 ) {
00409                     tipo_token = Sabiondo->siguiente_token(cad);
00410                     ESPERO(TK_IDENTIFICADOR, "TRUE o FALSE");
00411                     if ( strcmp(cad, "TRUE") == 0 ) con_cajas = TRUE;
00412                     else con_cajas = FALSE;
00413                 }
00414                 else if ( strcmp(cad, "con_normales") == 0 ) {
00415                     tipo_token = Sabiondo->siguiente_token(cad);
00416                     ESPERO(TK_IDENTIFICADOR, "TRUE o FALSE");
00417                     if ( strcmp(cad, "TRUE") == 0 ) con_normales = TRUE;
00418                     else con_normales = FALSE;
00419                 }
00420                 else if ( strcmp(cad, "calidades_caras") == 0 ) {
00421                     tipo_token = Sabiondo->siguiente_token(cad);
00422                     ESPERO(TK_IDENTIFICADOR, "una calidad de caras");
00423                     if ( strcmp(cad, "CONSTANTE") == 0 ) {
00424                         calidad_caras = CVC_CONSTANTE;
00425                       }
00426                       else if ( strcmp(cad, "FLAT") == 0 ) {
00427                         calidad_caras = CVC_FLAT;
00428                       }
00429                       else if ( strcmp(cad, "SHADE") == 0 ) {
00430                         calidad_caras = CVC_SHADE;
00431                       }
00432                     ;
00433                 }
00434               ;
00435               break;
00436         }
00437     }
00438 
00439     return TRUE;
00440 }
00441 
00442 #ifdef GL_ENABLED
00443 
00444 void
00445 CALIDAD_VISUAL::activar_bordes_gl(COLOR cb, MATERIAL *Material)
00446 {
00447     //- Modifique el estado -------------------------------------------------
00448     glDisable(GL_BLEND);
00449     glDisable(GL_LIGHTING);
00450     glDisable(GL_TEXTURE_2D);
00451     if ( !con_caras ) cb = Material->difusa();
00452     glShadeModel(GL_FLAT);
00453     glColor3f(cb.r, cb.g, cb.b);
00454 }
00455 
00456 void
00457 CALIDAD_VISUAL::activar_caras_gl(COLOR c, MATERIAL *Material)
00458 {
00459     switch ( calidad_caras ) {
00460       case CVC_CONSTANTE:
00461         if ( !con_bordes ) c = Material->difusa();
00462         glColor3f(c.r, c.g, c.b);
00463         glDisable(GL_LIGHTING);
00464         glShadeModel(GL_FLAT); // OJO!
00465         break;
00466       case CVC_SHADE:
00467         glEnable(GL_LIGHTING);
00468         glShadeModel(GL_SMOOTH);
00469         break;
00470       case CVC_FLAT: default:
00471         glEnable(GL_LIGHTING);
00472         glShadeModel(GL_FLAT);
00473         break;
00474     }
00475 }
00476 
00477 void
00478 CALIDAD_VISUAL::activar_textura_gl(void)
00479 {
00480     if ( con_caustics ) {
00481         glEnable(GL_TEXTURE_2D);
00482         glDepthMask(GL_FALSE);
00483         glDepthFunc(GL_EQUAL);
00484         glBlendFunc(GL_ZERO, GL_SRC_COLOR);
00485         glEnable(GL_BLEND);
00486         return;
00487     }
00488 
00489     //-----------------------------------------------------------------------
00490     // OJO: Se supone que no se usan bordes de textura... pero por si acaso,
00491     //      se verian rojos!
00492     static GLfloat c[4] = {1, 0, 0, 1};
00493     static GLfloat modo_repetir[] = {GL_REPEAT};
00494     //static GLfloat modo_repetir[] = {GL_CLAMP};
00495 
00496     glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, modo_repetir);
00497     glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, modo_repetir);
00498     glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, c);
00499 
00500     //-----------------------------------------------------------------------
00501     if ( con_entorno ) {
00502         glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
00503         glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
00504         glEnable(GL_TEXTURE_GEN_S);
00505         glEnable(GL_TEXTURE_GEN_T);
00506       }
00507       else {
00508         glDisable(GL_TEXTURE_GEN_S);
00509         glDisable(GL_TEXTURE_GEN_T);
00510     }
00511 
00512     //-----------------------------------------------------------------------
00513     glTexParameterfv(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,
00514         &interpolacion_magtex);
00515     glTexParameterfv(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,
00516         &interpolacion_mintex);
00517     glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,
00518         &funcion_combinacion_textura);
00519 }
00520 #endif
00521 
00522 //===========================================================================
00523 //= EOF                                                                     =
00524 //===========================================================================
00525 

Este archivo HTML ha sido generado automáticamente a partir del código fuente AQUYNZA. NO LO EDITE. Para mayor información contacte al autor.