GRASS Programmer's Manual  6.4.2(2012)
gsd_wire.c
Go to the documentation of this file.
00001 
00019 #include <grass/gis.h>
00020 #include <grass/gstypes.h>
00021 
00022 #include "gsget.h"
00023 #include "rowcol.h"
00024 
00025 
00026 #define DO_ARROWS
00027 
00028 /************************************************************************/
00029 /* Notes on exageration:
00030    vertical exageration is of two forms: 
00031    1) global exageration (from geoview struct) 
00032    2) vertical exageration for each surface - not implemented
00033  */
00034 
00035 /************************************************************************/
00036 /* may need to add more parameters to tell it which window or off_screen
00037  * pixmap to draw into. nah - just have one current (OpenGL limitation)
00038  */
00039 
00047 int gsd_wire_surf(geosurf * surf)
00048 {
00049     int desc, ret;
00050 
00051     G_debug(3, "gsd_wire_surf(): id=%d", surf->gsurf_id);
00052 
00053     desc = ATT_TOPO;
00054 
00055     switch (gs_get_att_src(surf, desc)) {
00056     case NOTSET_ATT:
00057         ret = (-1);
00058 
00059         break;
00060 
00061     case MAP_ATT:
00062         if (surf->draw_mode & DM_GRID_WIRE)
00063             ret = (gsd_wire_surf_map(surf));    /* draw mesh */
00064         else
00065             ret = (gsd_coarse_surf_map(surf));  /* draw coarse surf */
00066 
00067 #ifdef DO_ARROWS
00068         /*
00069            gsd_wire_arrows(surf);
00070          */
00071 #endif
00072 
00073         break;
00074 
00075     case CONST_ATT:
00076         ret = (gsd_wire_surf_const(surf, surf->att[desc].constant));
00077         break;
00078 
00079     case FUNC_ATT:
00080         ret = (gsd_wire_surf_func(surf, surf->att[desc].user_func));
00081 
00082         break;
00083 
00084     default:
00085         ret = (-1);
00086 
00087         break;
00088     }
00089 
00090     return (ret);
00091 }
00092 
00100 int gsd_wire_surf_map(geosurf * surf)
00101 {
00102     int check_mask, check_color;
00103     typbuff *buff, *cobuff;
00104     int xmod, ymod, row, col, cnt, xcnt, ycnt, x1off;
00105     long offset, y1off;
00106     float pt[4], xres, yres, ymax, zexag;
00107     int col_src, curcolor;
00108     gsurf_att *coloratt;
00109 
00110     G_debug(3, "gsd_wire_surf_map");
00111 
00112     buff = gs_get_att_typbuff(surf, ATT_TOPO, 0);
00113     cobuff = gs_get_att_typbuff(surf, ATT_COLOR, 0);
00114 
00115     gs_update_curmask(surf);
00116     check_mask = surf->curmask ? 1 : 0;
00117 
00118     /*
00119        checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
00120        combine it/them with any current mask, put in typbuff:
00121        if(surf->att[ATT_TOPO].constant)
00122      */
00123 
00124     xmod = surf->x_modw;
00125     ymod = surf->y_modw;
00126     xres = xmod * surf->xres;
00127     yres = ymod * surf->yres;
00128     ymax = (surf->rows - 1) * surf->yres;
00129     xcnt = 1 + (surf->cols - 1) / xmod;
00130     ycnt = 1 + (surf->rows - 1) / ymod;
00131 
00132     gsd_pushmatrix();
00133     gsd_do_scale(1);
00134     gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
00135 
00136     zexag = surf->z_exag;
00137 
00138     gsd_colormode(CM_COLOR);
00139 
00140     /* will need to check for color source of FUNC_ATT & NOTSET_ATT, 
00141        or else use more general and inefficient gets */
00142 
00143     check_color = (surf->wire_color == WC_COLOR_ATT);
00144 
00145     if (check_color) {
00146         coloratt = &(surf->att[ATT_COLOR]);
00147         col_src = surf->att[ATT_COLOR].att_src;
00148 
00149         if (col_src != MAP_ATT) {
00150             if (col_src == CONST_ATT) {
00151                 gsd_color_func((int)surf->att[ATT_COLOR].constant);
00152             }
00153             else {
00154                 gsd_color_func(surf->wire_color);
00155             }
00156 
00157             check_color = 0;
00158         }
00159     }
00160     else {
00161         gsd_color_func(surf->wire_color);
00162     }
00163 
00164     /* would also be good to check if colormap == surfmap, to increase speed */
00165     for (row = 0; row < ycnt; row++) {
00166         pt[Y] = ymax - row * yres;
00167         y1off = row * ymod * surf->cols;
00168 
00169         gsd_bgnline();
00170         cnt = 0;
00171 
00172         for (col = 0; col < xcnt; col++) {
00173             pt[X] = col * xres;
00174             x1off = col * xmod;
00175             offset = x1off + y1off;
00176 
00177             if (check_mask) {
00178                 if (BM_get(surf->curmask, col * xmod, row * ymod)) {
00179                     gsd_endline();
00180                     gsd_bgnline();
00181                     cnt = 0;
00182                     continue;
00183                 }
00184             }
00185 
00186             GET_MAPATT(buff, offset, pt[Z]);
00187 
00188             if (check_color) {
00189                 curcolor = gs_mapcolor(cobuff, coloratt, offset);
00190                 gsd_color_func(curcolor);
00191                 /* could use this & skip the GET if colordata == elevdata
00192                    gsd_color_func(gs_fastmapcolor(cobuff, coloratt, offset,
00193                    (int)pt[Z]));
00194                  */
00195             }
00196 
00197             pt[Z] = pt[Z] * zexag;
00198 
00199             gsd_vert_func(pt);
00200 
00201             if (cnt == 255) {
00202                 gsd_endline();
00203                 gsd_bgnline();
00204                 cnt = 0;
00205                 gsd_vert_func(pt);
00206             }
00207 
00208             cnt++;
00209         }
00210 
00211         gsd_endline();
00212     }
00213 
00214     for (col = 0; col < xcnt; col++) {
00215         pt[X] = col * xres;
00216         x1off = col * xmod;
00217 
00218         gsd_bgnline();
00219         cnt = 0;
00220 
00221         for (row = 0; row < ycnt; row++) {
00222             pt[Y] = ymax - row * yres;
00223             y1off = row * ymod * surf->cols;
00224             offset = x1off + y1off;
00225 
00226             if (check_mask) {
00227                 if (BM_get(surf->curmask, col * xmod, row * ymod)) {
00228                     gsd_endline();
00229                     gsd_bgnline();
00230                     cnt = 0;
00231                     continue;
00232                 }
00233             }
00234 
00235             GET_MAPATT(buff, offset, pt[Z]);
00236 
00237             if (check_color) {
00238                 curcolor = gs_mapcolor(cobuff, coloratt, offset);
00239                 gsd_color_func(curcolor);
00240                 /* could use this & skip the GET if colordata == elevdata
00241                    gsd_color_func(gs_fastmapcolor(coloratt, offset, (int)pt[Z]));
00242                  */
00243             }
00244 
00245             pt[Z] = pt[Z] * zexag;
00246 
00247             gsd_vert_func(pt);
00248 
00249             if (cnt == 255) {
00250                 gsd_endline();
00251                 gsd_bgnline();
00252                 cnt = 0;
00253                 gsd_vert_func(pt);
00254             }
00255 
00256             cnt++;
00257         }
00258 
00259         gsd_endline();
00260     }
00261 
00262     gsd_popmatrix();
00263     gsd_colormode(CM_DIFFUSE);
00264 
00265     return (1);
00266 }
00267 
00276 int gsd_wire_surf_const(geosurf * surf, float k)
00277 {
00278     int do_diff, check_mask, check_color;
00279     int xmod, ymod, row, col, cnt, xcnt, ycnt, x1off;
00280     long offset, y1off;
00281     float pt[4], xres, yres, ymax, zexag;
00282     int col_src;
00283     gsurf_att *coloratt;
00284     typbuff *cobuff;
00285 
00286     G_debug(3, "gsd_wire_surf_const");
00287 
00288     cobuff = gs_get_att_typbuff(surf, ATT_COLOR, 0);
00289 
00290     gs_update_curmask(surf);
00291     check_mask = surf->curmask ? 1 : 0;
00292 
00293     do_diff = (NULL != gsdiff_get_SDref());
00294 
00295     xmod = surf->x_modw;
00296     ymod = surf->y_modw;
00297     xres = xmod * surf->xres;
00298     yres = ymod * surf->yres;
00299 
00300     xcnt = 1 + (surf->cols - 1) / xmod;
00301     ycnt = 1 + (surf->rows - 1) / ymod;
00302     ymax = (surf->rows - 1) * surf->yres;
00303 
00304     gsd_pushmatrix();
00305     gsd_do_scale(1);
00306     gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
00307 
00308     zexag = surf->z_exag;
00309 
00310     gsd_colormode(CM_COLOR);
00311 
00312     /* will need to check for color source of FUNC_ATT & NOTSET_ATT, 
00313        or else use more general and inefficient gets */
00314 
00315     check_color = (surf->wire_color == WC_COLOR_ATT);
00316 
00317     if (check_color) {
00318         coloratt = &(surf->att[ATT_COLOR]);
00319         col_src = surf->att[ATT_COLOR].att_src;
00320 
00321         if (col_src != MAP_ATT) {
00322             if (col_src == CONST_ATT) {
00323                 gsd_color_func((int)surf->att[ATT_COLOR].constant);
00324             }
00325             else {
00326                 gsd_color_func(surf->wire_color);
00327             }
00328 
00329             check_color = 0;
00330         }
00331     }
00332     else {
00333         gsd_color_func(surf->wire_color);
00334     }
00335 
00336     pt[Z] = k * zexag;
00337 
00338     for (row = 0; row < ycnt; row++) {
00339         pt[Y] = ymax - row * yres;
00340         y1off = row * ymod * surf->cols;
00341 
00342         gsd_bgnline();
00343         cnt = 0;
00344 
00345         for (col = 0; col < xcnt; col++) {
00346             pt[X] = col * xres;
00347             x1off = col * xmod;
00348             offset = x1off + y1off;
00349 
00350             if (check_mask) {
00351                 if (BM_get(surf->curmask, col * xmod, row * ymod)) {
00352                     gsd_endline();
00353                     gsd_bgnline();
00354                     cnt = 0;
00355                     continue;
00356                 }
00357             }
00358 
00359             if (check_color) {
00360                 gsd_color_func(gs_mapcolor(cobuff, coloratt, offset));
00361             }
00362 
00363             if (do_diff) {
00364                 pt[Z] = gsdiff_do_SD(k * zexag, offset);
00365             }
00366 
00367             gsd_vert_func(pt);
00368 
00369             if (cnt == 255) {
00370                 gsd_endline();
00371                 gsd_bgnline();
00372                 cnt = 0;
00373                 gsd_vert_func(pt);
00374             }
00375 
00376             cnt++;
00377         }
00378 
00379         gsd_endline();
00380     }
00381 
00382     for (col = 0; col < xcnt; col++) {
00383         pt[X] = col * xres;
00384         x1off = col * xmod;
00385 
00386         gsd_bgnline();
00387         cnt = 0;
00388 
00389         for (row = 0; row < ycnt; row++) {
00390             pt[Y] = ymax - row * yres;
00391             y1off = row * ymod * surf->cols;
00392             offset = x1off + y1off;
00393 
00394             if (check_mask) {
00395                 if (BM_get(surf->curmask, col * xmod, row * ymod)) {
00396                     gsd_endline();
00397                     gsd_bgnline();
00398                     cnt = 0;
00399                     continue;
00400                 }
00401             }
00402 
00403             if (check_color) {
00404                 gsd_color_func(gs_mapcolor(cobuff, coloratt, offset));
00405             }
00406 
00407             if (do_diff) {
00408                 pt[Z] = gsdiff_do_SD(k * zexag, offset);
00409             }
00410 
00411             gsd_vert_func(pt);
00412 
00413             if (cnt == 255) {
00414                 gsd_endline();
00415                 gsd_bgnline();
00416                 cnt = 0;
00417                 gsd_vert_func(pt);
00418             }
00419 
00420             cnt++;
00421         }
00422 
00423         gsd_endline();
00424     }
00425 
00426     gsd_popmatrix();
00427     gsd_colormode(CM_DIFFUSE);
00428 
00429     return (1);
00430 }
00431 
00442 int gsd_wire_surf_func(geosurf * gs, int (*user_func) ())
00443 {
00444     return (1);
00445 }
00446 
00457 int gsd_wire_arrows(geosurf * surf)
00458 {
00459     typbuff *buff, *cobuff;
00460     int check_mask, check_color;
00461     int xmod, ymod, row, col, xcnt, ycnt;
00462     long offset, y1off;
00463     float tx, ty, tz, sz;
00464     float n[3], pt[4], xres, yres, ymax, zexag;
00465     int col_src, curcolor;
00466     gsurf_att *coloratt;
00467 
00468     G_debug(3, "gsd_norm_arrows");
00469 
00470     /* avoid scaling by zero */
00471     GS_get_scale(&tx, &ty, &tz, 1);
00472 
00473     if (tz == 0.0) {
00474         return (0);
00475     }
00476 
00477     sz = GS_global_exag();
00478 
00479     gs_update_curmask(surf);
00480     check_mask = surf->curmask ? 1 : 0;
00481 
00482     /*
00483        checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
00484        combine it/them with any current mask, put in surf->curmask:
00485      */
00486 
00487     check_color = 1;
00488     coloratt = &(surf->att[ATT_COLOR]);
00489     col_src = surf->att[ATT_COLOR].att_src;
00490 
00491     if (col_src != MAP_ATT) {
00492         if (col_src == CONST_ATT) {
00493             curcolor = (int)surf->att[ATT_COLOR].constant;
00494         }
00495         else {
00496             curcolor = surf->wire_color;
00497         }
00498 
00499         check_color = 0;
00500     }
00501 
00502     buff = gs_get_att_typbuff(surf, ATT_TOPO, 0);
00503     cobuff = gs_get_att_typbuff(surf, ATT_COLOR, 0);
00504 
00505     xmod = surf->x_modw;
00506     ymod = surf->y_modw;
00507     xres = xmod * surf->xres;
00508     yres = ymod * surf->yres;
00509     ymax = (surf->rows - 1) * surf->yres;
00510     xcnt = 1 + (surf->cols - 1) / xmod;
00511     ycnt = 1 + (surf->rows - 1) / ymod;
00512 
00513     gsd_pushmatrix();
00514     gsd_do_scale(1);
00515     gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
00516 
00517     zexag = surf->z_exag;
00518     /* CURRENTLY ALWAYS 1.0 */
00519 
00520     gsd_colormode(CM_COLOR);
00521 
00522     for (row = 0; row < ycnt; row++) {
00523         pt[Y] = ymax - row * yres;
00524         y1off = row * ymod * surf->cols;
00525 
00526         for (col = 0; col < xcnt; col++) {
00527             pt[X] = col * xres;
00528             offset = col * xmod + y1off;
00529 
00530             if (check_mask) {
00531                 if (BM_get(surf->curmask, col * xmod, row * ymod)) {
00532                     continue;
00533                 }
00534             }
00535 
00536             FNORM(surf->norms[offset], n);
00537             GET_MAPATT(buff, offset, pt[Z]);
00538             pt[Z] *= zexag;
00539 
00540             if (check_color) {
00541                 curcolor = gs_mapcolor(cobuff, coloratt, offset);
00542             }
00543 
00544             gsd_arrow(pt, curcolor, xres * 2, n, sz, surf);
00545         }                       /* ea col */
00546     }                           /* ea row */
00547 
00548     gsd_popmatrix();
00549     gsd_colormode(CM_DIFFUSE);
00550 
00551     return (1);
00552 }
00553 
00571 int gsd_coarse_surf_map(geosurf * surf)
00572 {
00573     int check_mask, check_color, check_transp;
00574     int check_material, check_emis, check_shin;
00575     typbuff *buff, *cobuff, *trbuff, *embuff, *shbuff;
00576     int xmod, ymod;
00577     int row, col, xcnt, ycnt;
00578     long y1off, y2off, y3off;
00579     long offset2[10];
00580     float pt2[10][2];
00581     int ii;
00582     float x1, x2, x3, y1, y2, y3, tx, ty, tz, ttr;
00583     float n[3], pt[4], xres, yres, ymax, zexag;
00584     int em_src, sh_src, trans_src, col_src, curcolor;
00585     gsurf_att *ematt, *shatt, *tratt, *coloratt;
00586 
00587 
00588     int datarow1, datacol1, datarow2, datacol2, datarow3, datacol3;
00589 
00590     float kem, ksh, pkem, pksh;
00591     unsigned int ktrans;
00592 
00593     int step_val = 2 * surf->x_modw;    /* should always be factor of 2 for fan */
00594     int start_val = surf->x_modw;
00595 
00596     /* ensure normals are correct */
00597     gs_calc_normals(surf);
00598 
00599     /* avoid scaling by zero */
00600     GS_get_scale(&tx, &ty, &tz, 1);
00601 
00602     if (tz == 0.0) {
00603         return (gsd_surf_const(surf, 0.0));
00604     }
00605     /* else if (surf->z_exag  == 0.0)
00606        {
00607        return(gsd_surf_const(surf, surf->z_min));
00608        }
00609        NOT YET IMPLEMENTED */
00610 
00611     buff = gs_get_att_typbuff(surf, ATT_TOPO, 0);
00612     cobuff = gs_get_att_typbuff(surf, ATT_COLOR, 0);
00613 
00614     gs_update_curmask(surf);
00615     check_mask = surf->curmask ? 1 : 0;
00616 
00617     /*
00618        checks ATT_TOPO & ATT_COLOR no_zero flags, make a mask from each,
00619        combine it/them with any current mask, put in surf->curmask:
00620      */
00621     xmod = surf->x_mod;
00622     ymod = surf->y_mod;
00623     xres = xmod * surf->xres;
00624     yres = ymod * surf->yres;
00625     ymax = (surf->rows - 1) * surf->yres;
00626 
00627     xcnt = VCOLS(surf);
00628     ycnt = VROWS(surf);
00629 
00630     gsd_pushmatrix();
00631     gsd_do_scale(1);
00632     gsd_translate(surf->x_trans, surf->y_trans, surf->z_trans);
00633     zexag = surf->z_exag;
00634 
00635     gsd_colormode(CM_DIFFUSE);
00636 
00637 
00638     /* CURRENTLY ALWAYS 1.0 */
00639 #ifdef CALC_AREA
00640     sz = GS_global_exag();
00641 #endif
00642 
00643     /* TODO: get rid of (define) these magic numbers scaling the attribute vals */
00644     check_transp = 0;
00645     tratt = &(surf->att[ATT_TRANSP]);
00646     ktrans = (255 << 24);
00647     trans_src = surf->att[ATT_TRANSP].att_src;
00648 
00649     if (CONST_ATT == trans_src && surf->att[ATT_TRANSP].constant != 0.0) {
00650         ktrans = (255 - (int)surf->att[ATT_TRANSP].constant) << 24;
00651         gsd_blend(1);
00652         gsd_zwritemask(0x0);
00653     }
00654     else if (MAP_ATT == trans_src) {
00655         trbuff = gs_get_att_typbuff(surf, ATT_TRANSP, 0);
00656         check_transp = trbuff ? 1 : 0;
00657         gsd_blend(1);
00658         gsd_zwritemask(0x0);
00659     }
00660 
00661     check_emis = 0;
00662     ematt = &(surf->att[ATT_EMIT]);
00663     kem = 0.0;
00664     pkem = 1.0;
00665     em_src = surf->att[ATT_EMIT].att_src;
00666 
00667     if (CONST_ATT == em_src) {
00668         kem = surf->att[ATT_EMIT].constant / 255.;
00669     }
00670     else if (MAP_ATT == em_src) {
00671         embuff = gs_get_att_typbuff(surf, ATT_EMIT, 0);
00672         check_emis = embuff ? 1 : 0;
00673     }
00674 
00675     check_shin = 0;
00676     shatt = &(surf->att[ATT_SHINE]);
00677     ksh = 0.0;
00678     pksh = 1.0;
00679     sh_src = surf->att[ATT_SHINE].att_src;
00680 
00681     if (CONST_ATT == sh_src) {
00682         ksh = surf->att[ATT_SHINE].constant / 255.;
00683         gsd_set_material(1, 0, ksh, kem, 0x0);
00684     }
00685     else if (MAP_ATT == sh_src) {
00686         shbuff = gs_get_att_typbuff(surf, ATT_SHINE, 0);
00687         check_shin = shbuff ? 1 : 0;
00688     }
00689 
00690     /* will need to check for color source of FUNC_ATT & NOTSET_ATT, 
00691        or else use more general and inefficient gets */
00692     check_color = 1;
00693     coloratt = &(surf->att[ATT_COLOR]);
00694     col_src = surf->att[ATT_COLOR].att_src;
00695 
00696     if (col_src != MAP_ATT) {
00697         if (col_src == CONST_ATT) {
00698             curcolor = (int)surf->att[ATT_COLOR].constant;
00699         }
00700         else {
00701             curcolor = surf->wire_color;
00702         }
00703 
00704         check_color = 0;
00705     }
00706 
00707     check_material = (check_shin || check_emis || (kem && check_color));
00708 
00709     /* would also be good to check if colormap == surfmap, to increase speed */
00710     /* will also need to set check_transp, check_shine, etc & fix material */
00711     for (row = start_val; row <= ycnt - start_val; row += step_val) {
00712 
00713         datarow1 = row * ymod;
00714         datarow2 = (row - (step_val / 2)) * ymod;
00715         datarow3 = (row + (step_val / 2)) * ymod;
00716 
00717 
00718         y1 = ymax - row * yres;
00719         y2 = ymax - (row - (step_val / 2)) * yres;
00720         y3 = ymax - (row + (step_val / 2)) * yres;
00721 
00722         y1off = row * ymod * surf->cols;
00723         y2off = (row - (step_val / 2)) * ymod * surf->cols;
00724         y3off = (row + (step_val / 2)) * ymod * surf->cols;
00725 
00726         for (col = start_val; col <= xcnt - start_val; col += step_val) {
00727 
00728             datacol1 = col * xmod;
00729             datacol2 = (col - (step_val / 2)) * xmod;
00730             datacol3 = (col + (step_val / 2)) * xmod;
00731 
00732             x1 = col * xres;
00733             x2 = (col - (step_val / 2)) * xres;
00734             x3 = (col + (step_val / 2)) * xres;
00735 
00736 
00737             /* Do not need BM_get because GET_MAPATT calls
00738              * same and returns zero if masked
00739              */
00740             offset2[0] = y1off + datacol1;      /* fan center */
00741             pt2[0][X] = x1;
00742             pt2[0][Y] = y1;     /* fan center */
00743             pt[X] = pt2[0][X];
00744             pt[Y] = pt2[0][Y];
00745             if (!GET_MAPATT(buff, offset2[0], pt[Z]))
00746                 continue;       /* masked */
00747             pt[Z] *= zexag;
00748 
00749             offset2[1] = y2off + datacol2;
00750             offset2[2] = y2off + datacol1;
00751             offset2[3] = y2off + datacol3;
00752             offset2[4] = y1off + datacol3;
00753             offset2[5] = y3off + datacol3;
00754             offset2[6] = y3off + datacol1;
00755             offset2[7] = y3off + datacol2;
00756             offset2[8] = y1off + datacol2;
00757             offset2[9] = y2off + datacol2;      /* repeat 1st corner to close */
00758 
00759             pt2[1][X] = x2;
00760             pt2[1][Y] = y2;
00761             pt2[2][X] = x1;
00762             pt2[2][Y] = y2;
00763             pt2[3][X] = x3;
00764             pt2[3][Y] = y2;
00765             pt2[4][X] = x3;
00766             pt2[4][Y] = y1;
00767             pt2[5][X] = x3;
00768             pt2[5][Y] = y3;
00769             pt2[6][X] = x1;
00770             pt2[6][Y] = y3;
00771             pt2[7][X] = x2;
00772             pt2[7][Y] = y3;
00773             pt2[8][X] = x2;
00774             pt2[8][Y] = y1;
00775             pt2[9][X] = x2;
00776             pt2[9][Y] = y2;     /* repeat 1st corner to close */
00777 
00778             /* Run through triangle fan */
00779             gsd_bgntfan();
00780             for (ii = 0; ii < 10; ii++) {
00781 
00782 
00783                 if (ii > 0) {
00784                     pt[X] = pt2[ii][X];
00785                     pt[Y] = pt2[ii][Y];
00786                     if (!GET_MAPATT(buff, offset2[ii], pt[Z]))
00787                         continue;
00788                     pt[Z] *= zexag;
00789                 }
00790 
00791                 FNORM(surf->norms[offset2[ii]], n);
00792 
00793                 if (check_color)
00794                     curcolor = gs_mapcolor(cobuff, coloratt, offset2[ii]);
00795 
00796                 if (check_transp) {
00797                     GET_MAPATT(trbuff, offset2[ii], ttr);
00798                     ktrans = (char)SCALE_ATT(tratt, ttr, 0, 255);
00799                     ktrans = (char)(255 - ktrans) << 24;
00800                 }
00801 
00802 
00803                 if (check_material) {
00804                     if (check_emis) {
00805                         GET_MAPATT(embuff, offset2[ii], kem);
00806                         kem = SCALE_ATT(ematt, kem, 0., 1.);
00807                     }
00808 
00809                     if (check_shin) {
00810                         GET_MAPATT(shbuff, offset2[ii], ksh);
00811                         ksh = SCALE_ATT(shatt, ksh, 0., 1.);
00812                     }
00813 
00814                     if (pksh != ksh || pkem != kem || (kem && check_color)) {
00815                         pksh = ksh;
00816                         pkem = kem;
00817                         gsd_set_material(check_shin, check_emis,
00818                                          ksh, kem, curcolor);
00819                     }
00820                 }
00821 
00822 
00823                 gsd_litvert_func(n, ktrans | curcolor, pt);
00824 
00825 
00826             }                   /* close ii loop */
00827             gsd_endtfan();
00828 
00829         }                       /* end col */
00830 
00831     }                           /* end row */
00832 
00833     gsd_popmatrix();
00834     /*
00835        gsd_colormode(CM_DIFFUSE);
00836      */
00837     gsd_blend(0);
00838     gsd_zwritemask(0xffffffff);
00839 
00840     return (0);
00841 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines