]> git.mxchange.org Git - flightgear.git/blob - Tri2obj/tri2obj.cxx
dfc374a00c55aa85b9520303d68d69b80345f464
[flightgear.git] / Tri2obj / tri2obj.cxx
1 /* tri2obj.c -- read in a .ele/.node file pair generated by the triangle 
2  *              program and output a simple Wavefront .obj file.
3  *
4  * Written by Curtis Olson, started October 1997.
5  *
6  * Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  * $Id$
23  * (Log is kept at end of this file)
24  */
25
26
27 #include <stdio.h>
28 #include <stdlib.h>   /* for atoi() */
29 #include <string.h>
30 #include <sys/stat.h> /* for stat() */
31 #include <unistd.h>   /* for stat() */
32
33 #include "tri2obj.hxx"
34
35 #include <Include/fg_constants.h>
36 #include <Include/fg_types.h>
37 #include <Bucket/bucketutils.h>
38
39 #include <Math/fg_geodesy.hxx>
40 #include <Math/mat3.h>
41 #include <Math/polar3d.hxx>
42
43
44 int nodecount, tricount;
45 int normalcount = 0;
46 static Point3D nodes[MAX_NODES];
47 static int tris[MAX_TRIS][3];
48
49 static double normals[MAX_NODES][3];
50
51 fgBUCKET my_index;
52 fgBUCKET ne_index, nw_index, sw_index, se_index;
53 fgBUCKET north_index, south_index, east_index, west_index;
54
55
56 /* given three points defining a triangle, calculate the normal */
57 void calc_normal(Point3D p1, Point3D p2, 
58                  Point3D p3, double normal[3])
59 {
60     double v1[3], v2[3];
61     double temp;
62
63     v1[0] = p2.x() - p1.x(); v1[1] = p2.y() - p1.y(); v1[2] = p2.z() - p1.z();
64     v2[0] = p3.x() - p1.x(); v2[1] = p3.y() - p1.y(); v2[2] = p3.z() - p1.z();
65
66     MAT3cross_product(normal, v1, v2);
67     MAT3_NORMALIZE_VEC(normal, temp);
68
69 /*  printf("  Normal = %.2f %.2f %.2f\n", normal[0], normal[1], normal[2]); */
70 }
71
72
73 /* return the index of all triangles containing the specified node */
74 void find_tris(int n, int *t1, int *t2, int *t3, int *t4, int *t5) {
75     int i;
76
77     *t1 = *t2 = *t3 = *t4 = *t5 = 0;
78
79     i = 1;
80     while ( i <= tricount ) {
81         if ( (n == tris[i][0]) || (n == tris[i][1]) || (n == tris[i][2]) ) {
82             if ( *t1 == 0 ) {
83                 *t1 = i;
84             } else if ( *t2 == 0 ) {
85                 *t2 = i;
86             } else if ( *t3 == 0 ) {
87                 *t3 = i;
88             } else if ( *t4 == 0 ) {
89                 *t4 = i;
90             } else {
91                 *t5 = i;
92             }
93         }
94         i++;
95     }
96 }
97
98
99 /* return the file base name ( foo/bar/file.ext = file.ext ) */
100 void extract_file(char *in, char *base) {
101     int len, i;
102
103     len = strlen(in);
104
105     i = len - 1;
106     while ( (i >= 0) && (in[i] != '/') ) {
107         i--;
108     }
109
110     in += (i + 1);
111     strcpy(base, in);
112 }
113
114
115 /* return the file path name ( foo/bar/file.ext = foo/bar ) */
116 void extract_path(char *in, char *base) {
117     int len, i;
118
119     len = strlen(in);
120     strcpy(base, in);
121
122     i = len - 1;
123     while ( (i >= 0) && (in[i] != '/') ) {
124         i--;
125     }
126
127     base[i] = '\0';
128 }
129
130
131 /* check if a file exists */
132 int file_exists(char *file) {
133     struct stat stat_buf;
134     int result;
135
136     printf("checking %s ... ", file);
137
138     result = stat(file, &stat_buf);
139
140     if ( result != 0 ) {
141         /* stat failed, no file */
142         printf("not found.\n");
143         return(0);
144     } else {
145         /* stat succeeded, file exists */
146         printf("exists.\n");
147         return(1);
148     }
149 }
150
151
152 /* check to see if a shared object exists */
153 int shared_object_exists(char *basepath, char *ext, char *file) {
154     char scene_path[256];
155     long int index;
156
157     if ( strcmp(ext, ".sw") == 0 ) {
158         fgBucketGenBasePath(&my_index, scene_path);
159         index = fgBucketGenIndex(&my_index);
160         sprintf(file, "%s/%s/%ld.1.sw", basepath, scene_path, index);
161         if ( file_exists(file) ) {
162             return(1);
163         }
164         fgBucketGenBasePath(&west_index, scene_path);
165         index = fgBucketGenIndex(&west_index);
166         sprintf(file, "%s/%s/%ld.1.se", basepath, scene_path, index);
167         if ( file_exists(file) ) {
168             return(1);
169         }
170         fgBucketGenBasePath(&sw_index, scene_path);
171         index = fgBucketGenIndex(&sw_index);
172         sprintf(file, "%s/%s/%ld.1.ne", basepath, scene_path, index);
173         if ( file_exists(file) ) {
174             return(1);
175         }
176         fgBucketGenBasePath(&south_index, scene_path);
177         index = fgBucketGenIndex(&south_index);
178         sprintf(file, "%s/%s/%ld.1.nw", basepath, scene_path, index);
179         if ( file_exists(file) ) {
180             return(1);
181         }
182     }
183
184     if ( strcmp(ext, ".se") == 0 ) {
185         fgBucketGenBasePath(&my_index, scene_path);
186         index = fgBucketGenIndex(&my_index);
187         sprintf(file, "%s/%s/%ld.1.se", basepath, scene_path, index);
188         if ( file_exists(file) ) {
189             return(1);
190         }
191         fgBucketGenBasePath(&east_index, scene_path);
192         index = fgBucketGenIndex(&east_index);
193         sprintf(file, "%s/%s/%ld.1.sw", basepath, scene_path, index);
194         if ( file_exists(file) ) {
195             return(1);
196         }
197         fgBucketGenBasePath(&se_index, scene_path);
198         index = fgBucketGenIndex(&se_index);
199         sprintf(file, "%s/%s/%ld.1.nw", basepath, scene_path, index);
200         if ( file_exists(file) ) {
201             return(1);
202         }
203         fgBucketGenBasePath(&south_index, scene_path);
204         index = fgBucketGenIndex(&south_index);
205         sprintf(file, "%s/%s/%ld.1.ne", basepath, scene_path, index);
206         if ( file_exists(file) ) {
207             return(1);
208         }
209     }
210
211     if ( strcmp(ext, ".ne") == 0 ) {
212         fgBucketGenBasePath(&my_index, scene_path);
213         index = fgBucketGenIndex(&my_index);
214         sprintf(file, "%s/%s/%ld.1.ne", basepath, scene_path, index);
215         if ( file_exists(file) ) {
216             return(1);
217         }
218         fgBucketGenBasePath(&east_index, scene_path);
219         index = fgBucketGenIndex(&east_index);
220         sprintf(file, "%s/%s/%ld.1.nw", basepath, scene_path, index);
221         if ( file_exists(file) ) {
222             return(1);
223         }
224         fgBucketGenBasePath(&ne_index, scene_path);
225         index = fgBucketGenIndex(&ne_index);
226         sprintf(file, "%s/%s/%ld.1.sw", basepath, scene_path, index);
227         if ( file_exists(file) ) {
228             return(1);
229         }
230         fgBucketGenBasePath(&north_index, scene_path);
231         index = fgBucketGenIndex(&north_index);
232         sprintf(file, "%s/%s/%ld.1.se", basepath, scene_path, index);
233         if ( file_exists(file) ) {
234             return(1);
235         }
236     }
237
238     if ( strcmp(ext, ".nw") == 0 ) {
239         fgBucketGenBasePath(&my_index, scene_path);
240         index = fgBucketGenIndex(&my_index);
241         sprintf(file, "%s/%s/%ld.1.nw", basepath, scene_path, index);
242         if ( file_exists(file) ) {
243             return(1);
244         }
245         fgBucketGenBasePath(&west_index, scene_path);
246         index = fgBucketGenIndex(&west_index);
247         sprintf(file, "%s/%s/%ld.1.ne", basepath, scene_path, index);
248         if ( file_exists(file) ) {
249             return(1);
250         }
251         fgBucketGenBasePath(&nw_index, scene_path);
252         index = fgBucketGenIndex(&nw_index);
253         sprintf(file, "%s/%s/%ld.1.se", basepath, scene_path, index);
254         if ( file_exists(file) ) {
255             return(1);
256         }
257         fgBucketGenBasePath(&north_index, scene_path);
258         index = fgBucketGenIndex(&north_index);
259         sprintf(file, "%s/%s/%ld.1.sw", basepath, scene_path, index);
260         if ( file_exists(file) ) {
261             return(1);
262         }
263     }
264
265     if ( strcmp(ext, ".south") == 0 ) {
266         fgBucketGenBasePath(&my_index, scene_path);
267         index = fgBucketGenIndex(&my_index);
268         sprintf(file, "%s/%s/%ld.1.south", basepath, scene_path, index);
269         if ( file_exists(file) ) {
270             return(1);
271         }
272         fgBucketGenBasePath(&south_index, scene_path);
273         index = fgBucketGenIndex(&south_index);
274         sprintf(file, "%s/%s/%ld.1.north", basepath, scene_path, index);
275         if ( file_exists(file) ) {
276             return(1);
277         }
278     }
279
280     if ( strcmp(ext, ".north") == 0 ) {
281         fgBucketGenBasePath(&my_index, scene_path);
282         index = fgBucketGenIndex(&my_index);
283         sprintf(file, "%s/%s/%ld.1.north", basepath, scene_path, index);
284         if ( file_exists(file) ) {
285             return(1);
286         }
287         fgBucketGenBasePath(&north_index, scene_path);
288         index = fgBucketGenIndex(&north_index);
289         sprintf(file, "%s/%s/%ld.1.south", basepath, scene_path, index);
290         if ( file_exists(file) ) {
291             return(1);
292         }
293     }
294
295     if ( strcmp(ext, ".west") == 0 ) {
296         fgBucketGenBasePath(&my_index, scene_path);
297         index = fgBucketGenIndex(&my_index);
298         sprintf(file, "%s/%s/%ld.1.west", basepath, scene_path, index);
299         if ( file_exists(file) ) {
300             return(1);
301         }
302         fgBucketGenBasePath(&west_index, scene_path);
303         index = fgBucketGenIndex(&west_index);
304         sprintf(file, "%s/%s/%ld.1.east", basepath, scene_path, index);
305         if ( file_exists(file) ) {
306             return(1);
307         }
308     }
309
310     if ( strcmp(ext, ".east") == 0 ) {
311         fgBucketGenBasePath(&my_index, scene_path);
312         index = fgBucketGenIndex(&my_index);
313         sprintf(file, "%s/%s/%ld.1.east", basepath, scene_path, index);
314         if ( file_exists(file) ) {
315             return(1);
316         }
317         fgBucketGenBasePath(&east_index, scene_path);
318         index = fgBucketGenIndex(&east_index);
319         sprintf(file, "%s/%s/%ld.1.west", basepath, scene_path, index);
320         if ( file_exists(file) ) {
321             return(1);
322         }
323     }
324
325     if ( strcmp(ext, ".body") == 0 ) {
326         fgBucketGenBasePath(&my_index, scene_path);
327         index = fgBucketGenIndex(&my_index);
328         sprintf(file, "%s/%s/%ld.1.body", basepath, scene_path, index);
329         if ( file_exists(file) ) {
330             return(1);
331         }
332     }
333
334     return(0);
335 }
336
337
338 /* given a file pointer, read all the vn (normals from it) */
339 void read_normals(FILE *fp) {
340     char line[256];
341
342     while ( fgets(line, 250, fp) != NULL ) {
343         if ( strncmp(line, "vn ", 3) == 0 ) {
344             sscanf( line, "vn %lf %lf %lf\n", 
345                     &normals[normalcount][0], 
346                     &normals[normalcount][1], 
347                     &normals[normalcount][2] );
348             /*
349             printf("read_normals(%d) %.2f %.2f %.2f %s", normalcount, 
350                    normals[normalcount][0], normals[normalcount][1], 
351                    normals[normalcount][2], line);
352                    */
353             normalcount++;
354         }
355     }
356 }
357
358
359 /* my custom file opening routine ... don't open if a shared edge or
360  * vertex alread exists */
361 FILE *my_open(char *basename, char *basepath, char *ext) {
362     FILE *fp;
363     char filename[256];
364
365     /* check if a shared object already exists */
366     if ( shared_object_exists(basepath, ext, filename) ) {
367         /* not an actual file open error, but we've already got the
368          * shared edge, so we don't want to create another one */
369         fp = fopen(filename, "r");
370         printf("Opening %s\n", filename);
371         return(fp);
372     } else {
373         /* open the file */
374         printf("not opening\n");
375         return(NULL);
376     }
377 }
378
379
380 /* Initialize a new mesh structure */
381 void triload(char *basename, char *basepath) {
382     char nodename[256], elename[256];
383     double n[3];
384     Point3D p;
385     FILE *ne, *nw, *se, *sw, *north, *south, *east, *west;
386     FILE *node, *ele;
387     int dim, junk1, junk2;
388     int i;
389
390     ne = my_open(basename, basepath, ".ne");
391     read_normals(ne);
392     fclose(ne);
393
394     nw = my_open(basename, basepath, ".nw");
395     read_normals(nw);
396     fclose(nw);
397
398     se = my_open(basename, basepath, ".se");
399     read_normals(se);
400     fclose(se);
401
402     sw = my_open(basename, basepath, ".sw");
403     read_normals(sw);
404     fclose(sw);
405
406     north = my_open(basename, basepath, ".north");
407     read_normals(north);
408     fclose(north);
409
410     south = my_open(basename, basepath, ".south");
411     read_normals(south);
412     fclose(south);
413
414     east = my_open(basename, basepath, ".east");
415     read_normals(east);
416     fclose(east);
417
418     west = my_open(basename, basepath, ".west");
419     read_normals(west);
420     fclose(west);
421
422     strcpy(nodename, basename);
423     strcat(nodename, ".node");
424     strcpy(elename, basename);
425     strcat(elename, ".ele");
426
427     printf("Loading node file:  %s ...\n", nodename);
428     if ( (node = fopen(nodename, "r")) == NULL ) {
429         printf("Cannot open file '%s'\n", nodename);
430         exit(-1);
431     }
432
433     fscanf(node, "%d %d %d %d", &nodecount, &dim, &junk1, &junk2);
434
435     if ( nodecount > MAX_NODES - 1 ) {
436         printf("Error, too many nodes, need to increase array size\n");
437         exit(-1);
438     } else {
439         printf("    Expecting %d nodes\n", nodecount);
440     }
441
442     for ( i = 1; i <= nodecount; i++ ) {
443         fscanf(node, "%d %lf %lf %lf %d\n", &junk1, 
444                &n[0], &n[1], &n[2], &junk2);
445         /* printf("%d %.2f %.2f %.2f\n", junk1, n[0], n[1], n[2]); */
446         p = Point3D(n[0], n[1], n[2]);
447         nodes[i] = fgGeodToCart(p);
448         /* printf("%d %.2f %.2f %.2f\n", 
449                junk1, nodes[i].x, nodes[i].y, nodes[i].z); */
450     }
451
452     fclose(node);
453
454     printf("Loading element file:  %s ...\n", elename);
455     if ( (ele = fopen(elename, "r")) == NULL ) {
456         printf("Cannot open file '%s'\n", elename);
457         exit(-1);
458     }
459
460     fscanf(ele, "%d %d %d", &tricount, &junk1, &junk2);
461
462     if ( tricount > MAX_TRIS - 1 ) {
463         printf("Error, too many elements, need to increase array size\n");
464         exit(-1);
465     } else {
466         printf("    Expecting %d elements\n", tricount);
467     }
468
469     for ( i = 1; i <= tricount; i++ ) {
470         fscanf(ele, "%d %d %d %d\n", &junk1, 
471                &tris[i][0], &tris[i][1], &tris[i][2]);
472         /* printf("%d %d %d %d\n", junk1, tris[i][0], tris[i][1], tris[i][2]);*/
473     }
474
475     fclose(ele);
476 }
477
478
479 /* dump in WaveFront .obj format */
480 void dump_obj(char *basename) {
481     char objname[256];
482     double n1[3], n2[3], n3[3], n4[3], n5[3], norm[3], temp;
483     FILE *obj;
484     int i, t1, t2, t3, t4, t5, count;
485     double x, y, z;
486
487     strcpy(objname, basename);
488     strcat(objname, ".obj");
489
490     printf("Dumping to file:  %s ...\n", objname);
491
492     obj = fopen(objname, "w");
493
494     /* dump vertices */
495     printf("  writing vertices\n");
496     for ( i = 1; i <= nodecount; i++ ) {
497         x = nodes[i].x();
498         y = nodes[i].y();
499         z = nodes[i].z();
500         fprintf(obj, "v %.6f %.6f %.6f\n", x, y, z);
501     }
502
503     printf("  calculating and writing normals\n");
504     printf("  First %d normals taken from shared files.\n", normalcount);
505                                                      
506     /* calculate and generate normals */
507     for ( i = 1; i <= nodecount; i++ ) {
508
509         if ( i <= normalcount ) {
510             /* use precalculated (shared) normal */
511             norm[0] = normals[i-1][0];
512             norm[1] = normals[i-1][1];
513             norm[2] = normals[i-1][2];
514         } else {
515             /* printf("Finding normal\n"); */
516
517             find_tris(i, &t1, &t2, &t3, &t4, &t5);
518
519             n1[0] = n1[1] = n1[2] = 0.0;
520             n2[0] = n2[1] = n2[2] = 0.0;
521             n3[0] = n3[1] = n3[2] = 0.0;
522             n4[0] = n4[1] = n4[2] = 0.0;
523             n5[0] = n5[1] = n5[2] = 0.0;
524
525             count = 1;
526             calc_normal(nodes[tris[t1][0]], nodes[tris[t1][1]], 
527                         nodes[tris[t1][2]], n1);
528
529             if ( t2 > 0 ) {
530                 calc_normal(nodes[tris[t2][0]], nodes[tris[t2][1]], 
531                             nodes[tris[t2][2]], n2);
532                 count = 2;
533             }
534
535             if ( t3 > 0 ) {
536                 calc_normal(nodes[tris[t3][0]], nodes[tris[t3][1]],
537                             nodes[tris[t3][2]], n3);
538                 count = 3;
539             }
540
541             if ( t4 > 0 ) {
542                 calc_normal(nodes[tris[t4][0]], nodes[tris[t4][1]],
543                             nodes[tris[t4][2]], n4);
544                 count = 4;
545             }
546
547             if ( t5 > 0 ) {
548                 calc_normal(nodes[tris[t5][0]], nodes[tris[t5][1]],
549                             nodes[tris[t5][2]], n5);
550                 count = 5;
551             }
552
553             /* printf("  norm[2] = %.2f %.2f %.2f\n", n1[2], n2[2], n3[2]); */
554
555             norm[0] = ( n1[0] + n2[0] + n3[0] + n4[0] + n5[0] ) / (double)count;
556             norm[1] = ( n1[1] + n2[1] + n3[1] + n4[1] + n5[1] ) / (double)count;
557             norm[2] = ( n1[2] + n2[2] + n3[2] + n4[2] + n5[2] ) / (double)count;
558         
559             /*  printf("  count = %d\n", count); */
560             /*  printf("  Ave. normal = %.4f %.4f %.4f\n", 
561                        norm[0], norm[1], norm[2]);*/
562             MAT3_NORMALIZE_VEC(norm, temp);
563             /*  printf("  Normalized ave. normal = %.4f %.4f %.4f\n",  */
564             /*         norm[0], norm[1], norm[2]); */
565         }
566         /* printf("%d vn %.4f %.4f %.4f\n", i, norm[0], norm[1], norm[2]); */
567         fprintf(obj, "vn %.4f %.4f %.4f\n", norm[0], norm[1], norm[2]);
568     }
569
570     /* dump faces */
571     printf("  writing faces\n");
572     for ( i = 1; i <= tricount; i++ ) {
573         fprintf(obj, "f %d %d %d\n", tris[i][0], tris[i][1], tris[i][2]);
574     }
575
576     fclose(obj);
577 }
578
579 int main(int argc, char **argv) {
580     char basename[256], basepath[256], temp[256];
581     long int tmp_index;
582     int len;
583
584     strcpy(basename, argv[1]);
585
586     /* find the base path of the file */
587     extract_path(basename, basepath);
588     extract_path(basepath, basepath);
589     extract_path(basepath, basepath);
590     printf("%s\n", basepath);
591
592     /* find the index of the current file */
593     extract_file(basename, temp);
594     len = strlen(temp);
595     if ( len >= 2 ) {
596         temp[len-2] = '\0';
597     }
598     tmp_index = atoi(temp);
599     printf("%ld\n", tmp_index);
600     fgBucketParseIndex(tmp_index, &my_index);
601
602     printf("bucket = %d %d %d %d\n", 
603            my_index.lon, my_index.lat, my_index.x, my_index.y);
604     /* generate the indexes of the neighbors */
605     fgBucketOffset(&my_index, &ne_index,  1,  1);
606     fgBucketOffset(&my_index, &nw_index, -1,  1);
607     fgBucketOffset(&my_index, &se_index,  1, -1);
608     fgBucketOffset(&my_index, &sw_index, -1, -1);
609
610     fgBucketOffset(&my_index, &north_index,  0,  1);
611     fgBucketOffset(&my_index, &south_index,  0, -1);
612     fgBucketOffset(&my_index, &east_index,  1,  0);
613     fgBucketOffset(&my_index, &west_index, -1,  0);
614
615     /* load the input data files */
616     triload(basename, basepath);
617
618     /* dump in WaveFront .obj format */
619     dump_obj(basename);
620
621     return(0);
622 }
623
624
625 /* $Log$
626 /* Revision 1.2  1998/10/18 01:17:29  curt
627 /* Point3D tweaks.
628 /*
629  * Revision 1.1  1998/07/08 14:54:53  curt
630  * renamed *.[ch] to *.[ch]xx
631  *
632  * Revision 1.17  1998/07/04 00:56:40  curt
633  * typedef'd struct fgBUCKET.
634  *
635  * Revision 1.16  1998/05/23 15:20:41  curt
636  * Output more digits after the decimal place.
637  *
638  * Revision 1.15  1998/05/02 01:54:39  curt
639  * Converting to polar3d.h routines.
640  *
641  * Revision 1.14  1998/04/18 04:01:32  curt
642  * Now use libMath rather than having local copies of math routines.
643  *
644  * Revision 1.13  1998/04/14 02:26:11  curt
645  * Code reorganizations.  Added a Lib/ directory for more general libraries.
646  *
647  * Revision 1.12  1998/04/08 23:22:18  curt
648  * Adopted Gnu automake/autoconf system.
649  *
650  * Revision 1.11  1998/03/03 16:01:00  curt
651  * More c++ compile tweaks.
652  *
653  * Revision 1.10  1998/01/31 00:41:27  curt
654  * Made a few changes converting floats to doubles.
655  *
656  * Revision 1.9  1998/01/27 18:37:04  curt
657  * Lots of updates to get back in sync with changes made over in .../Src/
658  *
659  * Revision 1.8  1998/01/17 01:25:39  curt
660  * Added support for shared normals.
661  *
662  * Revision 1.7  1998/01/12 02:42:00  curt
663  * Average up to five triangles per vertex instead of three.
664  *
665  * Revision 1.6  1998/01/09 23:03:15  curt
666  * Restructured to split 1deg x 1deg dem's into 64 subsections.
667  *
668  * Revision 1.5  1997/12/08 19:17:50  curt
669  * Fixed a type in the normal generation code.
670  *
671  * Revision 1.4  1997/12/02 13:13:32  curt
672  * Fixed problem with averaged vertex normals.
673  *
674  * Revision 1.3  1997/11/15 18:05:05  curt
675  * minor tweaks ...
676  *
677  * Revision 1.2  1997/11/14 00:29:13  curt
678  * Transform scenery coordinates at this point in pipeline when scenery is
679  * being translated to .obj format, not when it is being loaded into the end
680  * renderer.  Precalculate normals for each node as average of the normals
681  * of each containing polygon so Garoude shading is now supportable.
682  *
683  * Revision 1.1  1997/10/29 23:05:15  curt
684  * Initial revision.
685  *
686  */