41 #define DEBUG_ARROW (0) 46 #define SET_SCOLOR(sf) \ 49 tx = points[sf][i][X] - gsurfs[sf]->x_trans; \ 50 ty = points[sf][i][Y] - gsurfs[sf]->y_trans; \ 51 offset = XY2OFF(gsurfs[sf], tx, ty); \ 52 colors[sf] = gs_mapcolor(cobuf[sf], coloratt[sf], offset); \ 56 static int get_point_below(
Point3 **,
geosurf **,
int,
int,
int,
int *);
142 int check_mask, check_color, check_transp;
143 int check_material, check_emis, check_shin;
144 typbuff *buff, *cobuff, *trbuff, *embuff, *shbuff;
145 int xmod, ymod, row, col, cnt, xcnt, ycnt;
146 long offset, y1off, y2off;
147 float x1, x2, y1, y2, tx, ty, tz, ttr;
148 float n[3], pt[4], xres, yres, ymax, zexag;
149 int em_src, sh_src, trans_src, col_src, curcolor;
150 gsurf_att *ematt, *shatt, *tratt, *coloratt;
154 GLdouble modelMatrix[16], projMatrix[16];
159 float sz, mag, tedge1[3], tedge2[3], crossp[3], triv[3][3];
160 double asurf = 0.0, axsurf = 0.0;
163 int zeros, dr1, dr2, dr3, dr4;
164 int datarow1, datacol1, datarow2, datacol2;
166 float kem, ksh, pkem, pksh;
169 G_debug(3,
"gsd_surf_map_old");
187 check_mask = surf->
curmask ? 1 : 0;
195 xres = xmod * surf->
xres;
196 yres = ymod * surf->
yres;
197 ymax = (surf->
rows - 1) * surf->
yres;
205 window[0] += (int)(yres * 2);
206 window[1] -= (int)(yres * 2);
207 window[2] -= (int)(xres * 2);
208 window[3] += (int)(xres * 2);
231 ktrans = (255 << 24);
239 else if (
MAP_ATT == trans_src) {
241 check_transp = trbuff ? 1 : 0;
257 check_emis = embuff ? 1 : 0;
272 check_shin = shbuff ? 1 : 0;
292 check_material = (check_shin || check_emis || (kem && check_color));
298 for (row = 0; row < ycnt; row++) {
307 datarow1 = row * ymod;
308 datarow2 = (row + 1) * ymod;
310 y1 = ymax - row * yres;
311 y2 = ymax - (row + 1) * yres;
312 y1off = row * ymod * surf->
cols;
313 y2off = (row + 1) * ymod * surf->
cols;
318 dr1 = dr2 = dr3 = dr4 = 1;
346 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
347 ktrans = (char)(255 - ktrans) << 24;
371 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
372 ktrans = (char)(255 - ktrans) << 24;
375 if (check_material) {
386 if (pksh != ksh || pkem != kem || (kem && check_color)) {
404 for (col = 0; col < xcnt; col++) {
405 datacol1 = col * xmod;
406 datacol2 = (col + 1) * xmod;
409 x2 = (col + 1) * xres;
412 dr1 = dr2 = dr3 = dr4 = 1;
435 if ((zeros > 1) && cnt) {
450 offset = y1off + datacol1;
458 (pt, window, viewport, modelMatrix, projMatrix)) {
471 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
472 ktrans = (char)(255 - ktrans) << 24;
475 if (check_material) {
486 if (pksh != ksh || pkem != kem
487 || (kem && check_color)) {
505 offset = y2off + datacol1;
513 (pt, window, viewport, modelMatrix, projMatrix)) {
526 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
527 ktrans = (char)(255 - ktrans) << 24;
530 if (check_material) {
541 if (pksh != ksh || pkem != kem
542 || (kem && check_color)) {
561 offset = y1off + datacol2;
569 (pt, window, viewport, modelMatrix, projMatrix)) {
582 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
583 ktrans = (char)(255 - ktrans) << 24;
586 if (check_material) {
597 if (pksh != ksh || pkem != kem || (kem && check_color)) {
630 offset = y2off + datacol2;
638 (pt, window, viewport, modelMatrix, projMatrix)) {
651 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
652 ktrans = (char)(255 - ktrans) << 24;
655 if (check_material) {
666 if (pksh != ksh || pkem != kem || (kem && check_color)) {
709 G_debug(5,
" Surface Area: %.12lf", asurf);
710 G_debug(5,
" Exaggerated Surface Area: %.12lf", axsurf);
731 int do_diff, check_mask, check_color;
733 int xmod, ymod, row, col, cnt, xcnt, ycnt;
734 long offset, y1off, y2off;
735 float x1, x2, y1, y2, tx, ty, tz;
736 float n[3], pt[4], xres, yres, ymax, zexag;
737 int col_src, curcolor;
741 GLdouble modelMatrix[16], projMatrix[16];
745 int zeros, dr1, dr2, dr3, dr4;
746 int datarow1, datacol1, datarow2, datacol2;
748 unsigned int ktrans = 255;
759 check_mask = surf->
curmask ? 1 : 0;
768 xres = xmod * surf->
xres;
769 yres = ymod * surf->
yres;
773 ymax = (surf->
rows - 1) * surf->
yres;
778 window[0] += (int)(yres * 2);
779 window[1] -= (int)(yres * 2);
780 window[2] -= (int)(xres * 2);
781 window[3] += (int)(xres * 2);
807 ktrans = (ktrans << 24);
834 if (!check_color && !check_mask && !do_diff) {
859 for (row = 0; row < ycnt; row++) {
868 datarow1 = row * ymod;
869 datarow2 = (row + 1) * ymod;
871 y1 = ymax - row * yres;
872 y2 = ymax - (row + 1) * yres;
873 y1off = row * ymod * surf->
cols;
874 y2off = (row + 1) * ymod * surf->
cols;
879 dr1 = dr2 = dr3 = dr4 = 1;
925 for (col = 0; col < xcnt; col++) {
926 datacol1 = col * xmod;
927 datacol2 = (col + 1) * xmod;
930 x2 = (col + 1) * xres;
933 dr1 = dr2 = dr3 = dr4 = 1;
956 if ((zeros > 1) && cnt) {
971 offset = y1off + datacol1;
976 (pt, window, viewport, modelMatrix, projMatrix)) {
996 offset = y2off + datacol1;
1001 (pt, window, viewport, modelMatrix, projMatrix)) {
1022 offset = y1off + datacol2;
1027 (pt, window, viewport, modelMatrix, projMatrix)) {
1047 offset = y2off + datacol2;
1052 (pt, window, viewport, modelMatrix, projMatrix)) {
1115 int i, i1, i2, nlong, offset, col_src;
1116 int check_color1, check_color2, color1, color2;
1120 check_color1 = check_color2 = 1;
1159 for (nlong = (npts1 > npts2 ? npts1 : npts2), i = 0; i < nlong; i++) {
1160 i1 = i * npts1 / nlong;
1161 i2 = i * npts2 / nlong;
1162 offset =
XY2OFF(surf1, points1[i1][
X], points1[i1][
Y]);
1168 offset =
XY2OFF(surf1, points2[i2][X], points2[i2][Y]);
1175 if (npts1 > npts2) {
1233 static int transpoint_is_masked(
geosurf * surf,
Point3 point)
1258 static int get_point_below(
Point3 ** points,
geosurf ** gsurfs,
int ptn,
1259 int cursurf,
int numsurfs,
int *belowsurf)
1262 float nearz = 0.0, diff;
1264 if (gsurfs[cursurf]->curmask) {
1265 if (transpoint_is_masked(gsurfs[cursurf], points[cursurf][ptn])) {
1270 for (n = 0; n < numsurfs; ++n) {
1271 diff = points[cursurf][ptn][
Z] - points[n][ptn][
Z];
1274 if (!nearz || diff < nearz) {
1275 if (gsurfs[n]->curmask) {
1276 if (transpoint_is_masked(gsurfs[n], points[n][ptn])) {
1330 int n, i, offset, col_src, check_color[
MAX_SURFS];
1335 nocolor = FCmode ==
FC_GREY ? 1 : 0;
1338 for (n = 0; n < ns; ++n) {
1345 colors[n] = (int)gsurfs[n]->att[
ATT_COLOR].constant;
1384 int bn, bnl, ctop, cbot, ctopl, cbotl, bsret;
1388 ctop = cbot = ctopl = cbotl = color;
1391 for (n = 0; n < ns; ++n) {
1392 for (i = 0; i < np; i++) {
1395 get_point_below(points, gsurfs, i, n, ns, &bn))) {
1403 ctop = cbot = colors[n];
1406 ctop = cbot = colors[bn];
1416 if (!transpoint_is_masked(gsurfs[n], points[n][i - 1])
1417 && !transpoint_is_masked(gsurfs[bn],
1418 points[bn][i - 1])) {
1421 points[n][i][
Z], 0.0,
1422 points[bn][i - 1][Z], 1.0,
1423 points[bn][i][Z], &tx, &ty)) {
1425 xing[
Y] = points[n][i - 1][
Y] + tx *
1426 (points[n][i][
Y] - points[n][i - 1][
Y]);
1427 xing[
X] = points[n][i - 1][
X] + tx *
1428 (points[n][i][
X] - points[n][i - 1][
X]);
1430 xing[
Z] = points[bn][i - 1][
Z] + tx *
1431 (points[bn][i][
Z] - points[bn][i - 1][
Z]);
1443 while (i < np && 0 < (bsret =
1444 get_point_below(points, gsurfs, i,
1463 ctop = cbot = colors[n];
1466 ctop = cbot = colors[bn];
1495 if (bnl >= 0 && bnl != bn) {
1500 if (!transpoint_is_masked(gsurfs[n],
1501 points[n][i - 1]) &&
1502 !transpoint_is_masked(gsurfs[bnl],
1503 points[bnl][i - 1]) &&
1504 !transpoint_is_masked(gsurfs[bn],
1505 points[bn][i - 1])) {
1508 points[n][i - 1][
Z],
1509 1.0, points[n][i][
Z],
1511 points[bn][i - 1][Z],
1512 1.0, points[bn][i][Z],
1517 "crossing going up at surf %d no. %d",
1522 xing[
Y] = points[n][i - 1][
Y] + tx *
1524 points[n][i - 1][
Y]);
1526 points[n][i - 1][
X] +
1527 tx * (points[n][i][
X] -
1528 points[n][i - 1][
X]);
1531 xing[
Z] = points[bnl][i - 1][
Z] + tx *
1532 (points[bnl][i][
Z] -
1533 points[bnl][i - 1][
Z]);
1554 "crossing going down at surf %d no. %d",
1559 xing[
Y] = points[n][i - 1][
Y] + tx *
1561 points[n][i - 1][
Y]);
1563 points[n][i - 1][
X] +
1564 tx * (points[n][i][
X] -
1565 points[n][i - 1][
X]);
1568 xing[
Z] = points[bnl][i - 1][
Z] + tx *
1569 (points[bnl][i][
Z] -
1570 points[bnl][i - 1][
Z]);
1576 xing[
Z] = points[bn][i - 1][
Z] + tx *
1578 points[bn][i - 1][
Z]);
1584 !transpoint_is_masked(gsurfs[bn],
1585 points[bn][i - 1]) &&
1586 !transpoint_is_masked(gsurfs[bnl],
1587 points[bnl][i - 1])) {
1590 points[bn][i - 1][
Z],
1591 1.0, points[bn][i][
Z],
1593 points[bnl][i - 1][Z],
1603 "lower crossing at surf %d no. %d between surfs %d & %d",
1607 xing[
Y] = points[bn][i - 1][
Y] + tx *
1609 points[bn][i - 1][
Y]);
1610 xing[
X] = points[bn][i - 1][
X] + tx *
1612 points[bn][i - 1][
X]);
1614 z1 = xing[
Z] = points[n][i - 1][
Z] + tx *
1616 points[n][i - 1][
Z]);
1631 if (!upper && !lower) {
1633 "Crossing NOT found or masked:");
1635 " current surf: %d [ %.2f %.2f %.2f -> %.2f %.2f %f",
1636 n, points[n][i - 1][
X],
1637 points[n][i - 1][
Y],
1638 points[n][i - 1][
Z],
1639 points[n][i][
X], points[n][i][
Y],
1642 " below surf: %d [ %.2f %.2f %.2f -> %.2f %.2f %f\n",
1643 bn, points[bn][i - 1][X],
1644 points[bn][i - 1][Y],
1645 points[bn][i - 1][Z],
1650 " last below surf: %d [ %.2f %.2f %.2f -> %.2f %.2f %f\n",
1651 bnl, points[bnl][i - 1][X],
1652 points[bnl][i - 1][Y],
1653 points[bnl][i - 1][Z],
1670 if (!transpoint_is_masked(gsurfs[n], points[n][i - 1])
1671 && !transpoint_is_masked(gsurfs[bn],
1672 points[bn][i - 1])) {
1675 points[n][i][
Z], 0.0,
1676 points[bn][i - 1][Z], 1.0,
1677 points[bn][i][Z], &tx, &ty)) {
1679 xing[
Y] = points[n][i - 1][
Y] + tx *
1680 (points[n][i][
Y] - points[n][i - 1][
Y]);
1681 xing[
X] = points[n][i - 1][
X] + tx *
1682 (points[n][i][
X] - points[n][i - 1][
X]);
1719 int nsurfs, ret, npts, npts1, n, i,
err = 0;
1720 float bgn1[2], end1[2];
1722 if (norm[
Z] > 0.0001 || norm[
Z] < -.0001) {
1732 for (n = 0; n < nsurfs; n++) {
1741 if (npts != npts1) {
1742 G_warning(
_(
"Cut-plane points mis-match between surfaces. " 1743 "Check resolution(s)."));
1753 if (n == nsurfs - 1) {
1757 for (i = 0; i < npts1; i++) {
1759 points[n][i][
X] += gsurfs[n]->
x_trans;
1760 points[n][i][
Y] += gsurfs[n]->
y_trans;
1761 points[n][i][
Z] += gsurfs[n]->
z_trans;
1770 for (i = 0; i < npts1; i++) {
1771 GS_v3eq(points[n][i], tmp[i]);
1774 points[n][i][
X] += gsurfs[n]->
x_trans;
1775 points[n][i][
Y] += gsurfs[n]->
y_trans;
1776 points[n][i][
Z] += gsurfs[n]->
z_trans;
1781 for (n = 0; n < nsurfs; n++) {
1792 for (n = 0; n < nsurfs - 1; n++) {
1813 int check_mask, check_color;
1814 int xmod, ymod, row, col, cnt, xcnt, ycnt;
1815 long offset, y1off, y2off;
1816 float x1, x2, y1, y2, tx, ty, tz, sz;
1817 float n[3], pt[4], xres, yres, ymax, zexag;
1818 int col_src, curcolor;
1821 int zeros, dr1, dr2, dr3, dr4;
1822 int datarow1, datacol1, datarow2, datacol2;
1824 G_debug(3,
"gsd_norm_arrows");
1840 check_mask = surf->
curmask ? 1 : 0;
1862 xres = xmod * surf->
xres;
1863 yres = ymod * surf->
yres;
1864 ymax = (surf->
rows - 1) * surf->
yres;
1876 #ifdef DO_ARROW_SOLID 1884 for (row = 0; row < ycnt; row++) {
1891 datarow1 = row * ymod;
1892 datarow2 = (row + 1) * ymod;
1894 y1 = ymax - row * yres;
1895 y2 = ymax - (row + 1) * yres;
1896 y1off = row * ymod * surf->
cols;
1897 y2off = (row + 1) * ymod * surf->
cols;
1900 dr1 = dr2 = dr3 = dr4 = 1;
1926 #ifdef DO_ARROW_SOLID 1927 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
1930 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
1947 #ifdef DO_ARROW_SOLID 1948 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
1951 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
1958 for (col = 0; col < xcnt; col++) {
1959 datacol1 = col * xmod;
1960 datacol2 = (col + 1) * xmod;
1963 x2 = (col + 1) * xres;
1966 dr1 = dr2 = dr3 = dr4 = 1;
1989 if ((zeros > 1) && cnt) {
1997 offset = y1off + datacol2;
2008 #ifdef DO_ARROW_SOLID 2009 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
2012 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
2020 offset = y2off + datacol2;
2031 #ifdef DO_ARROW_SOLID 2032 gsd_3darrow(pt, curcolor, xres * 2, xres / 2, n, sz);
2035 gsd_arrow(pt, 0x000000, xres * 2, n, sz, surf);
2064 int check_mask, check_color, check_transp;
2065 int check_material, check_emis, check_shin;
2066 typbuff *buff, *cobuff, *trbuff, *embuff, *shbuff;
2068 int row, col, cnt, xcnt, ycnt;
2069 long y1off, y2off, y3off;
2073 float x1, x2, x3, y1, y2, y3, tx, ty, tz, ttr;
2074 float n[3], pt[4], xres, yres, ymax, zexag;
2075 int em_src, sh_src, trans_src, col_src, curcolor;
2076 gsurf_att *ematt, *shatt, *tratt, *coloratt;
2080 GLdouble modelMatrix[16], projMatrix[16];
2083 int cnt1 = 0, cnt2 = 0;
2085 int datarow1, datacol1, datarow2, datacol2, datarow3, datacol3;
2087 float kem, ksh, pkem, pksh;
2088 unsigned int ktrans;
2109 check_mask = surf->
curmask ? 1 : 0;
2117 xres = xmod * surf->
xres;
2118 yres = ymod * surf->
yres;
2119 ymax = (surf->
rows - 1) * surf->
yres;
2135 window[0] += (int)(yres * 4 * zexag);
2136 window[1] -= (int)(yres * 4 * zexag);
2137 window[2] -= (int)(xres * 4 * zexag);
2138 window[3] += (int)(xres * 4 * zexag);
2148 ktrans = (255 << 24);
2156 else if (
MAP_ATT == trans_src) {
2158 check_transp = trbuff ? 1 : 0;
2174 check_emis = embuff ? 1 : 0;
2189 check_shin = shbuff ? 1 : 0;
2209 check_material = (check_shin || check_emis || (kem && check_color));
2215 for (row = start_val; row < ycnt; row += step_val) {
2236 datarow1 = row * ymod;
2237 datarow2 = (row - (step_val / 2)) * ymod;
2238 datarow3 = (row + (step_val / 2)) * ymod;
2241 y1 = ymax - row * yres;
2242 y2 = ymax - (row - (step_val / 2)) * yres;
2243 y3 = ymax - (row + (step_val / 2)) * yres;
2245 y1off = row * ymod * surf->
cols;
2246 y2off = (row - (step_val / 2)) * ymod * surf->
cols;
2247 y3off = (row + (step_val / 2)) * ymod * surf->
cols;
2250 for (col = start_val; col < xcnt; col += step_val) {
2251 datacol1 = col * xmod;
2252 datacol2 = (col - (step_val / 2)) * xmod;
2253 datacol3 = (col + (step_val / 2)) * xmod;
2256 x2 = (col - (step_val / 2)) * xres;
2257 x3 = (col + (step_val / 2)) * xres;
2273 offset2[0] = y1off + datacol1;
2283 (pt, window, viewport, modelMatrix, projMatrix))
2288 offset2[1] = y2off + datacol2;
2289 offset2[2] = y2off + datacol1;
2290 offset2[3] = y2off + datacol3;
2291 offset2[4] = y1off + datacol3;
2292 offset2[5] = y3off + datacol3;
2293 offset2[6] = y3off + datacol1;
2294 offset2[7] = y3off + datacol2;
2295 offset2[8] = y1off + datacol2;
2296 offset2[9] = y2off + datacol2;
2320 for (ii = 0; ii < 10; ii++) {
2333 curcolor =
gs_mapcolor(cobuff, coloratt, offset2[ii]);
2337 ktrans = (char)
SCALE_ATT(tratt, ttr, 0, 255);
2338 ktrans = (char)(255 - ktrans) << 24;
2341 if (check_material) {
2352 if (pksh != ksh || pkem != kem || (kem && check_color)) {
2356 ksh, kem, curcolor);
int gs_mapcolor(typbuff *, gsurf_att *, int)
Call this one when you already know att_src is MAP_ATT.
void gsd_endtfan(void)
ADD.
void gsd_blend(int)
Specify pixel arithmetic.
int gs_getall_surfaces(geosurf **)
Get array of geosurf structs.
void GS_v3sub(float *, float *)
Subtract vectors.
int gsd_arrow(float *, unsigned long, float, float *, float, geosurf *)
ADD.
void gsd_bgnpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
#define SET_SCOLOR(sf)
MACROS for use in gsd_ortho_wall ONLY !!!
void gsd_popmatrix(void)
Pop the current matrix stack.
int gs_get_att_src(geosurf *, int)
Get attribute source.
int segs_intersect(float, float, float, float, float, float, float, float, float *, float *)
Line intersect.
void gsd_endpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
int gsd_surf_const(geosurf *surf, float k)
Using tmesh - not confident with qstrips portability.
#define XY2OFF(gs, px, py)
void G_free(void *)
Free allocated memory.
Point3 * gsdrape_get_allsegments(geosurf *, float *, float *, int *)
Get all segments.
int gsd_surf_map(geosurf *surf)
Draw surface using triangle fan instead of strip.
int gsd_wall(float *bgn, float *end, float *norm)
ADD.
void GS_v3cross(float *, float *, float *)
Get the cross product v3 = v1 cross v2.
int gsd_surf_map_old(geosurf *surf)
ADD.
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)
int gsd_ortho_wall(int np, int ns, geosurf **gsurfs, Point3 **points, float *norm)
ADD.
int gsd_norm_arrows(geosurf *surf)
ADD.
void show_colormode(void)
Print color mode to stderr.
void gsd_colormode(int)
Set color mode.
int gsd_surf(geosurf *surf)
ADD.
float gsdiff_do_SD(float, int)
ADD.
int gsd_checkpoint(float *, int *, int *, double *, double *)
int gs_update_curmask(geosurf *)
Update current maps.
void gsd_translate(float, float, float)
Multiply the current matrix by a translation matrix.
void gsd_bgntfan(void)
ADD.
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
void gsd_3darrow(float *, unsigned long, float, float, float *, float)
Draw 3d north arrow.
int gsd_surf_func(geosurf *gs, int(*user_func)())
Define user function.
float GS_global_exag(void)
Get global z-exag value.
void gsd_zwritemask(unsigned long)
Write out z-mask.
void gsd_setfc(int mode)
ADD.
typbuff * gs_get_att_typbuff(geosurf *, int, int)
Get attribute data buffer.
void GS_v3eq(float *, float *)
Copy vector values.
int gs_point_is_masked(geosurf *, float *)
Check if point is masked.
void gsd_getwindow(int *, int *, double *, double *)
Get viewport.
int gsd_triangulated_wall(int npts1, int npts2, geosurf *surf1, geosurf *surf2, Point3 *points1, Point3 *points2, float *norm)
ADD.
void G_warning(const char *,...) __attribute__((format(printf
void gsd_litvert_func(float *, unsigned long, float *)
Set the current normal vector & specify vertex.
void GS_v3mag(float *, float *)
Magnitude of vector.
geosurf * gsdiff_get_SDref(void)
ADD.
int GS_check_cancel(void)
Check for cancel.
void gsd_pushmatrix(void)
Push the current matrix stack.
void GS_get_scale(float *, float *, float *, int)
Get axis scale.
#define SCALE_ATT(att, val, low, high)
void gsd_bgntmesh(void)
ADD.
void gsd_endtmesh(void)
ADD.
void gsd_set_material(int, int, float, float, int)
Set material.
void GS_set_draw(int)
Sets which buffer to draw to.
void gsd_do_scale(int)
Set current scale.
int G_debug(int, const char *,...) __attribute__((format(printf
int gs_calc_normals(geosurf *)
Calculate normals.
#define GET_MAPATT(buff, offset, att)