101 int check_mask, check_color;
102 typbuff *buff, *cobuff;
103 int xmod, ymod, row, col, cnt, xcnt, ycnt, x1off;
105 float pt[4], xres, yres, ymax, zexag;
106 int col_src, curcolor;
109 G_debug(3,
"gsd_wire_surf_map");
115 check_mask = surf->curmask ? 1 : 0;
125 xres = xmod * surf->xres;
126 yres = ymod * surf->yres;
127 ymax = (surf->rows - 1) * surf->yres;
128 xcnt = 1 + (surf->cols - 1) / xmod;
129 ycnt = 1 + (surf->rows - 1) / ymod;
135 zexag = surf->z_exag;
142 check_color = (surf->wire_color == WC_COLOR_ATT);
145 coloratt = &(surf->att[ATT_COLOR]);
146 col_src = surf->att[ATT_COLOR].att_src;
148 if (col_src != MAP_ATT) {
149 if (col_src == CONST_ATT) {
164 for (row = 0; row < ycnt; row++) {
165 pt[
Y] = ymax - row * yres;
166 y1off = row * ymod * surf->cols;
171 for (col = 0; col < xcnt; col++) {
174 offset = x1off + y1off;
177 if (
BM_get(surf->curmask, col * xmod, row * ymod)) {
196 pt[Z] = pt[Z] * zexag;
213 for (col = 0; col < xcnt; col++) {
220 for (row = 0; row < ycnt; row++) {
221 pt[
Y] = ymax - row * yres;
222 y1off = row * ymod * surf->cols;
223 offset = x1off + y1off;
226 if (
BM_get(surf->curmask, col * xmod, row * ymod)) {
245 pt[Z] = pt[Z] * zexag;
278 int do_diff, check_mask, check_color;
279 int xmod, ymod, row, col, cnt, xcnt, ycnt, x1off;
281 float pt[4], xres, yres, ymax, zexag;
286 G_debug(3,
"gsd_wire_surf_const");
291 check_mask = surf->curmask ? 1 : 0;
297 xres = xmod * surf->xres;
298 yres = ymod * surf->yres;
300 xcnt = 1 + (surf->cols - 1) / xmod;
301 ycnt = 1 + (surf->rows - 1) / ymod;
302 ymax = (surf->rows - 1) * surf->yres;
308 zexag = surf->z_exag;
315 check_color = (surf->wire_color == WC_COLOR_ATT);
318 coloratt = &(surf->att[ATT_COLOR]);
319 col_src = surf->att[ATT_COLOR].att_src;
321 if (col_src != MAP_ATT) {
322 if (col_src == CONST_ATT) {
338 for (row = 0; row < ycnt; row++) {
339 pt[
Y] = ymax - row * yres;
340 y1off = row * ymod * surf->cols;
345 for (col = 0; col < xcnt; col++) {
348 offset = x1off + y1off;
351 if (
BM_get(surf->curmask, col * xmod, row * ymod)) {
382 for (col = 0; col < xcnt; col++) {
389 for (row = 0; row < ycnt; row++) {
390 pt[
Y] = ymax - row * yres;
391 y1off = row * ymod * surf->cols;
392 offset = x1off + y1off;
395 if (
BM_get(surf->curmask, col * xmod, row * ymod)) {
459 typbuff *buff, *cobuff;
460 int check_mask, check_color;
461 int xmod, ymod, row, col, xcnt, ycnt;
463 float tx, ty, tz, sz;
464 float n[3], pt[4], xres, yres, ymax, zexag;
465 int col_src, curcolor;
480 check_mask = surf->curmask ? 1 : 0;
489 coloratt = &(surf->att[ATT_COLOR]);
490 col_src = surf->att[ATT_COLOR].att_src;
492 if (col_src != MAP_ATT) {
493 if (col_src == CONST_ATT) {
494 curcolor = (int)surf->att[ATT_COLOR].constant;
497 curcolor = surf->wire_color;
508 xres = xmod * surf->xres;
509 yres = ymod * surf->yres;
510 ymax = (surf->rows - 1) * surf->yres;
511 xcnt = 1 + (surf->cols - 1) / xmod;
512 ycnt = 1 + (surf->rows - 1) / ymod;
518 zexag = surf->z_exag;
523 for (row = 0; row < ycnt; row++) {
524 pt[
Y] = ymax - row * yres;
525 y1off = row * ymod * surf->cols;
527 for (col = 0; col < xcnt; col++) {
529 offset = col * xmod + y1off;
532 if (
BM_get(surf->curmask, col * xmod, row * ymod)) {
537 FNORM(surf->norms[offset], n);
545 gsd_arrow(pt, curcolor, xres * 2, n, sz, surf);
574 int check_color, check_transp;
575 int check_material, check_emis, check_shin;
576 typbuff *buff, *cobuff, *trbuff, *embuff, *shbuff;
578 int row, col, xcnt, ycnt;
579 long y1off, y2off, y3off;
583 float x1, x2, x3, y1, y2, y3, tx, ty, tz, ttr;
584 float n[3], pt[4], xres, yres, ymax, zexag;
585 int em_src, sh_src, trans_src, col_src, curcolor;
586 gsurf_att *ematt, *shatt, *tratt, *coloratt;
588 int datacol1, datacol2, datacol3;
592 float kem, ksh, pkem, pksh;
595 int step_val = 2 * surf->x_modw;
596 int start_val = surf->x_modw;
625 xres = xmod * surf->xres;
626 yres = ymod * surf->yres;
627 ymax = (surf->rows - 1) * surf->yres;
635 zexag = surf->z_exag;
647 tratt = &(surf->att[ATT_TRANSP]);
648 ktrans = (255 << 24);
649 trans_src = surf->att[ATT_TRANSP].att_src;
651 if (CONST_ATT == trans_src && surf->att[ATT_TRANSP].constant != 0.0) {
652 ktrans = (255 - (int)surf->att[ATT_TRANSP].constant) << 24;
656 else if (MAP_ATT == trans_src) {
658 check_transp = trbuff ? 1 : 0;
664 ematt = &(surf->att[ATT_EMIT]);
667 em_src = surf->att[ATT_EMIT].att_src;
669 if (CONST_ATT == em_src) {
670 kem = surf->att[ATT_EMIT].constant / 255.;
672 else if (MAP_ATT == em_src) {
674 check_emis = embuff ? 1 : 0;
678 shatt = &(surf->att[ATT_SHINE]);
681 sh_src = surf->att[ATT_SHINE].att_src;
683 if (CONST_ATT == sh_src) {
684 ksh = surf->att[ATT_SHINE].constant / 255.;
687 else if (MAP_ATT == sh_src) {
689 check_shin = shbuff ? 1 : 0;
696 coloratt = &(surf->att[ATT_COLOR]);
697 col_src = surf->att[ATT_COLOR].att_src;
699 if (col_src != MAP_ATT) {
700 if (col_src == CONST_ATT) {
701 curcolor = (int)surf->att[ATT_COLOR].constant;
704 curcolor = surf->wire_color;
710 check_material = (check_shin || check_emis || (kem && check_color));
714 for (row = start_val; row <= ycnt - start_val; row += step_val) {
722 y1 = ymax - row * yres;
723 y2 = ymax - (row - (step_val / 2)) * yres;
724 y3 = ymax - (row + (step_val / 2)) * yres;
726 y1off = row * ymod * surf->cols;
727 y2off = (row - (step_val / 2)) * ymod * surf->cols;
728 y3off = (row + (step_val / 2)) * ymod * surf->cols;
730 for (col = start_val; col <= xcnt - start_val; col += step_val) {
732 datacol1 = col * xmod;
733 datacol2 = (col - (step_val / 2)) * xmod;
734 datacol3 = (col + (step_val / 2)) * xmod;
737 x2 = (col - (step_val / 2)) * xres;
738 x3 = (col + (step_val / 2)) * xres;
743 offset2[0] = y1off + datacol1;
752 offset2[1] = y2off + datacol2;
753 offset2[2] = y2off + datacol1;
754 offset2[3] = y2off + datacol3;
755 offset2[4] = y1off + datacol3;
756 offset2[5] = y3off + datacol3;
757 offset2[6] = y3off + datacol1;
758 offset2[7] = y3off + datacol2;
759 offset2[8] = y1off + datacol2;
760 offset2[9] = y2off + datacol2;
783 for (ii = 0; ii < 10; ii++) {
793 FNORM(surf->norms[offset2[ii]], n);
796 curcolor =
gs_mapcolor(cobuff, coloratt, offset2[ii]);
800 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
801 ktrans = (char)(255 - ktrans) << 24;
804 if (check_material) {
815 if (pksh != ksh || pkem != kem || (kem && check_color)) {