1 // obj.cxx -- routines to handle "sorta" WaveFront .obj format files.
3 // Written by Curtis Olson, started October 1997.
5 // Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 // (Log is kept at end of this file)
38 #if defined ( __sun__ )
39 extern "C" void *memmove(void *, const void *, size_t);
40 extern "C" void *memset(void *, int, size_t);
43 #include <string> // Standard C++ library
45 #include <ctype.h> // isdigit()
47 #ifdef NEEDNAMESPACESTD
51 #include <Debug/fg_debug.h>
52 #include <Include/fg_constants.h>
53 #include <Include/fg_zlib.h>
54 #include <Main/options.hxx>
55 #include <Math/mat3.h>
56 #include <Math/fg_random.h>
57 #include <Math/point3d.hxx>
58 #include <Math/polar3d.hxx>
59 #include <Misc/stopwatch.hxx>
60 #include <Misc/fgstream.hxx>
61 #include <Scenery/tile.hxx>
63 #include "material.hxx"
67 static double normals[MAX_NODES][3];
70 // given three points defining a triangle, calculate the normal
71 static void calc_normal(double p1[3], double p2[3],
72 double p3[3], double normal[3])
77 v1[0] = p2[0] - p1[0]; v1[1] = p2[1] - p1[1]; v1[2] = p2[2] - p1[2];
78 v2[0] = p3[0] - p1[0]; v2[1] = p3[1] - p1[1]; v2[2] = p3[2] - p1[2];
80 MAT3cross_product(normal, v1, v2);
81 MAT3_NORMALIZE_VEC(normal,temp);
83 // fgPrintf( FG_TERRAIN, FG_DEBUG, " Normal = %.2f %.2f %.2f\n",
84 // normal[0], normal[1], normal[2]);
88 #define FG_TEX_CONSTANT 8.0
91 // Calculate texture coordinates for a given point.
92 static Point3D calc_tex_coords(double *node, const Point3D& ref) {
96 cp = Point3D( node[0] + ref.x(),
100 pp = fgCartToPolar3d(cp);
104 pp.setx( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.x(), 1.0) );
105 pp.sety( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.y(), 1.0) );
107 if ( pp.x() < 0.0 ) {
108 pp.setx( pp.x() + 1.0 );
111 if ( pp.y() < 0.0 ) {
112 pp.sety( pp.y() + 1.0 );
119 // Load a .obj file and build the GL fragment list
120 int fgObjLoad( const string& path, fgTILE *t) {
123 double approx_normal[3], normal[3], scale;
124 // double x, y, z, xmax, xmin, ymax, ymin, zmax, zmin;
125 // GLfloat sgenparams[] = { 1.0, 0.0, 0.0, 0.0 };
128 int in_fragment, in_faces, vncount, n1, n2, n3, n4;
129 int last1, last2, odd;
133 // printf("loading %s\n", path.c_str() );
135 // Attempt to open "path.gz" or "path"
136 fg_gzifstream in( path );
139 // Attempt to open "path.obj" or "path.obj.gz"
140 in.open( path + ".obj" );
143 fgPrintf( FG_TERRAIN, FG_ALERT,
144 "Cannot open file: %s\n", path.c_str() );
149 shading = current_options.get_shading();
154 t->bounding_radius = 0.0;
161 // ignore initial comments and blank lines. (priming the pump)
168 in.stream() >> token;
170 // printf("token = %s\n", token.c_str() );
172 if ( token == "gbs" )
174 // reference point (center offset)
175 in.stream() >> t->center >> t->bounding_radius;
177 else if ( token == "bs" )
179 // reference point (center offset)
181 in.stream() >> fragment.center.x
185 in.stream() >> fragment.center;
186 in.stream() >> fragment.bounding_radius;
188 else if ( token == "vn" )
191 if ( vncount < MAX_NODES ) {
192 in.stream() >> normals[vncount][0]
193 >> normals[vncount][1]
194 >> normals[vncount][2];
197 fgPrintf( FG_TERRAIN, FG_EXIT,
198 "Read too many vertex normals ... dying :-(\n");
201 else if ( token[0] == 'v' )
204 if ( t->ncount < MAX_NODES ) {
205 in.stream() >> t->nodes[t->ncount][0]
206 >> t->nodes[t->ncount][1]
207 >> t->nodes[t->ncount][2];
210 fgPrintf( FG_TERRAIN, FG_EXIT,
211 "Read too many nodes ... dying :-(\n");
214 else if ( token == "usemtl" )
216 // material property specification
218 // this also signals the start of a new fragment
220 // close out the previous structure and start the next
223 // printf("xglEnd(); xglEndList();\n");
226 fragment.display_list = display_list;
228 // push this fragment onto the tile's object list
229 t->fragment_list.push_back(fragment);
234 // printf("start of fragment (usemtl)\n");
236 display_list = xglGenLists(1);
237 xglNewList(display_list, GL_COMPILE);
238 // printf("xglGenLists(); xglNewList();\n");
241 // reset the existing face list
242 // printf("cleaning a fragment with %d faces\n",
243 // fragment.faces.size());
246 // scan the material line
248 in.stream() >> material;
249 fragment.tile_ptr = t;
251 // find this material in the properties list
252 if ( ! material_mgr.find( material, fragment.material_ptr )) {
253 fgPrintf( FG_TERRAIN, FG_ALERT,
254 "Ack! unknown usemtl name = %s in %s\n",
255 material.c_str(), path.c_str() );
258 // initialize the fragment transformation matrix
260 for ( i = 0; i < 16; i++ ) {
261 fragment.matrix[i] = 0.0;
263 fragment.matrix[0] = fragment.matrix[5] =
264 fragment.matrix[10] = fragment.matrix[15] = 1.0;
266 } else if ( token[0] == 't' ) {
267 // start a new triangle strip
269 n1 = n2 = n3 = n4 = 0;
271 // fgPrintf( FG_TERRAIN, FG_DEBUG, " new tri strip = %s", line);
272 in.stream() >> n1 >> n2 >> n3;
273 fragment.add_face(n1, n2, n3);
275 // fgPrintf( FG_TERRAIN, FG_DEBUG, "(t) = ");
277 xglBegin(GL_TRIANGLE_STRIP);
278 // printf("xglBegin(tristrip) %d %d %d\n", n1, n2, n3);
284 // Shading model is "GL_SMOOTH" so use precalculated
285 // (averaged) normals
286 MAT3_SCALE_VEC(normal, normals[n1], scale);
287 xglNormal3dv(normal);
288 pp = calc_tex_coords(nodes[n1], center);
289 xglTexCoord2f(pp.lon(), pp.lat());
290 // xglVertex3d(t->nodes[n1][0],t->nodes[n1][1],t->nodes[n1][2]);
291 xglVertex3dv(nodes[n1]);
293 MAT3_SCALE_VEC(normal, normals[n2], scale);
294 xglNormal3dv(normal);
295 pp = calc_tex_coords(nodes[n2], center);
296 xglTexCoord2f(pp.lon(), pp.lat());
297 //xglVertex3d(t->nodes[n2][0],t->nodes[n2][1],t->nodes[n2][2]);
298 xglVertex3dv(nodes[n2]);
300 MAT3_SCALE_VEC(normal, normals[n3], scale);
301 xglNormal3dv(normal);
302 pp = calc_tex_coords(nodes[n3], center);
303 xglTexCoord2f(pp.lon(), pp.lat());
304 // xglVertex3d(t->nodes[n3][0],t->nodes[n3][1],t->nodes[n3][2]);
305 xglVertex3dv(nodes[n3]);
307 // Shading model is "GL_FLAT" so calculate per face
308 // normals on the fly.
310 calc_normal(nodes[n1], nodes[n2],
311 nodes[n3], approx_normal);
313 calc_normal(nodes[n2], nodes[n1],
314 nodes[n3], approx_normal);
316 MAT3_SCALE_VEC(normal, approx_normal, scale);
317 xglNormal3dv(normal);
319 pp = calc_tex_coords(nodes[n1], center);
320 xglTexCoord2f(pp.lon(), pp.lat());
321 // xglVertex3d(t->nodes[n1][0],t->nodes[n1][1],t->nodes[n1][2]);
322 xglVertex3dv(nodes[n1]);
324 pp = calc_tex_coords(nodes[n2], center);
325 xglTexCoord2f(pp.lon(), pp.lat());
326 // xglVertex3d(t->nodes[n2][0],t->nodes[n2][1],t->nodes[n2][2]);
327 xglVertex3dv(nodes[n2]);
329 pp = calc_tex_coords(nodes[n3], center);
330 xglTexCoord2f(pp.lon(), pp.lat());
331 // xglVertex3d(t->nodes[n3][0],t->nodes[n3][1],t->nodes[n3][2]);
332 xglVertex3dv(nodes[n3]);
334 // printf("some normals, texcoords, and vertices\n");
340 // There can be three or four values
345 break; // only the one
356 fragment.add_face(n3, n2, n4);
359 // Shading model is "GL_SMOOTH"
360 MAT3_SCALE_VEC(normal, normals[n4], scale);
362 // Shading model is "GL_FLAT"
363 calc_normal(nodes[n3], nodes[n2], nodes[n4],
365 MAT3_SCALE_VEC(normal, approx_normal, scale);
367 xglNormal3dv(normal);
368 pp = calc_tex_coords(nodes[n4], center);
369 xglTexCoord2f(pp.lon(), pp.lat());
370 // xglVertex3d(t->nodes[n4][0],t->nodes[n4][1],t->nodes[n4][2]);
371 xglVertex3dv(nodes[n4]);
376 // printf("a normal, texcoord, and vertex (4th)\n");
378 } else if ( token[0] == 'f' ) {
382 xglBegin(GL_TRIANGLES);
383 // printf("xglBegin(triangles)\n");
387 // fgPrintf( FG_TERRAIN, FG_DEBUG, "new triangle = %s", line);*/
388 in.stream() >> n1 >> n2 >> n3;
389 fragment.add_face(n1, n2, n3);
391 // xglNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]);
392 xglNormal3dv(normals[n1]);
393 pp = calc_tex_coords(nodes[n1], center);
394 xglTexCoord2f(pp.lon(), pp.lat());
395 // xglVertex3d(t->nodes[n1][0], t->nodes[n1][1], t->nodes[n1][2]);
396 xglVertex3dv(nodes[n1]);
398 // xglNormal3d(normals[n2][0], normals[n2][1], normals[n2][2]);
399 xglNormal3dv(normals[n2]);
400 pp = calc_tex_coords(nodes[n2], center);
401 xglTexCoord2f(pp.lon(), pp.lat());
402 // xglVertex3d(t->nodes[n2][0], t->nodes[n2][1], t->nodes[n2][2]);
403 xglVertex3dv(nodes[n2]);
405 // xglNormal3d(normals[n3][0], normals[n3][1], normals[n3][2]);
406 xglNormal3dv(normals[n3]);
407 pp = calc_tex_coords(nodes[n3], center);
408 xglTexCoord2f(pp.lon(), pp.lat());
409 // xglVertex3d(t->nodes[n3][0], t->nodes[n3][1], t->nodes[n3][2]);
410 xglVertex3dv(nodes[n3]);
411 // printf("some normals, texcoords, and vertices (tris)\n");
412 } else if ( token[0] == 'q' ) {
413 // continue a triangle strip
416 // fgPrintf( FG_TERRAIN, FG_DEBUG, "continued tri strip = %s ",
420 // There can be one or two values
425 break; // only the one
434 // fgPrintf( FG_TERRAIN, FG_DEBUG, "read %d %d\n", n1, n2);
437 fragment.add_face(last1, last2, n1);
439 fragment.add_face(last2, last1, n1);
443 // Shading model is "GL_SMOOTH"
444 MAT3_SCALE_VEC(normal, normals[n1], scale);
446 // Shading model is "GL_FLAT"
448 calc_normal(nodes[last1], nodes[last2], nodes[n1],
451 calc_normal(nodes[last2], nodes[last1], nodes[n1],
454 MAT3_SCALE_VEC(normal, approx_normal, scale);
456 xglNormal3dv(normal);
458 pp = calc_tex_coords(nodes[n1], center);
459 xglTexCoord2f(pp.lon(), pp.lat());
460 // xglVertex3d(t->nodes[n1][0], t->nodes[n1][1], t->nodes[n1][2]);
461 xglVertex3dv(nodes[n1]);
462 // printf("a normal, texcoord, and vertex (4th)\n");
469 // fgPrintf( FG_TERRAIN, FG_DEBUG, " (cont)\n");
472 fragment.add_face(last1, last2, n2);
474 fragment.add_face(last2, last1, n2);
478 // Shading model is "GL_SMOOTH"
479 MAT3_SCALE_VEC(normal, normals[n2], scale);
481 // Shading model is "GL_FLAT"
483 calc_normal(nodes[last1], nodes[last2],
484 nodes[n2], approx_normal);
486 calc_normal(nodes[last2], nodes[last1],
487 nodes[n2], approx_normal);
489 MAT3_SCALE_VEC(normal, approx_normal, scale);
491 xglNormal3dv(normal);
493 pp = calc_tex_coords(nodes[n2], center);
494 xglTexCoord2f(pp.lon(), pp.lat());
495 // xglVertex3d(t->nodes[n2][0],t->nodes[n2][1],t->nodes[n2][2]);
496 xglVertex3dv(nodes[n2]);
497 // printf("a normal, texcoord, and vertex (4th)\n");
504 fgPrintf( FG_TERRAIN, FG_WARN, "Unknown token in %s = %s\n",
505 path.c_str(), token.c_str() );
508 // eat comments and blank lines before start of while loop so
509 // if we are done with useful input it is noticed before hand.
514 // close out the previous structure and start the next
517 // printf("xglEnd(); xglEndList();\n");
520 fragment.display_list = display_list;
522 // push this fragment onto the tile's object list
523 t->fragment_list.push_back(fragment);
526 // Draw normal vectors (for visually verifying normals)
529 xglColor3f(0.0, 0.0, 0.0);
530 for ( i = 0; i < t->ncount; i++ ) {
531 xglVertex3d(t->nodes[i][0],
534 xglVertex3d(t->nodes[i][0] + 500*normals[i][0],
535 t->nodes[i][1] + 500*normals[i][1],
536 t->nodes[i][2] + 500*normals[i][2]);
542 fgPrintf( FG_TERRAIN, FG_INFO, "Loaded %s in %f seconds\n",
543 path.c_str(), stopwatch.elapsedSeconds() );
545 // printf("end of tile\n");
552 // Revision 1.6 1998/10/18 01:17:21 curt
555 // Revision 1.5 1998/10/16 00:54:39 curt
556 // Converted to Point3D class.
558 // Revision 1.4 1998/09/15 01:35:07 curt
559 // cleaned up my fragment.num_faces hack :-) to use the STL (no need in
560 // duplicating work.)
561 // Tweaked fgTileMgrRender() do not calc tile matrix unless necessary.
562 // removed some unneeded stuff from fgTileMgrCurElev()
564 // Revision 1.3 1998/09/03 21:27:03 curt
565 // Fixed a serious bug caused by not-quite-correct comment/white space eating
566 // which resulted in mismatched glBegin() glEnd() pairs, incorrect display lists,
567 // and ugly display artifacts.
569 // Revision 1.2 1998/09/01 19:03:09 curt
570 // Changes contributed by Bernie Bright <bbright@c031.aone.net.au>
571 // - The new classes in libmisc.tgz define a stream interface into zlib.
572 // I've put these in a new directory, Lib/Misc. Feel free to rename it
573 // to something more appropriate. However you'll have to change the
574 // include directives in all the other files. Additionally you'll have
575 // add the library to Lib/Makefile.am and Simulator/Main/Makefile.am.
577 // The StopWatch class in Lib/Misc requires a HAVE_GETRUSAGE autoconf
578 // test so I've included the required changes in config.tgz.
580 // There are a fair few changes to Simulator/Objects as I've moved
581 // things around. Loading tiles is quicker but thats not where the delay
582 // is. Tile loading takes a few tenths of a second per file on a P200
583 // but it seems to be the post-processing that leads to a noticeable
584 // blip in framerate. I suppose its time to start profiling to see where
587 // I've included a brief description of each archives contents.
592 // C++ stream interface into zlib.
593 // Taken from zlib-1.1.3/contrib/iostream/.
594 // Minor mods for STL compatibility.
595 // There's no copyright associated with these so I assume they're
596 // covered by zlib's.
600 // FlightGear input stream using gz_ifstream. Tries to open the
601 // given filename. If that fails then filename is examined and a
602 // ".gz" suffix is removed or appended and that file is opened.
605 // A simple timer for benchmarking. Not used in production code.
606 // Taken from the Blitz++ project. Covered by GPL.
610 // Some simple string manipulation routines.
612 // Simulator/Airports/
613 // Load airports database using fgstream.
614 // Changed fgAIRPORTS to use set<> instead of map<>.
615 // Added bool fgAIRPORTS::search() as a neater way doing the lookup.
616 // Returns true if found.
619 // Modified fgStarsInit() to load stars database using fgstream.
621 // Simulator/Objects/
622 // Modified fgObjLoad() to use fgstream.
623 // Modified fgMATERIAL_MGR::load_lib() to use fgstream.
624 // Many changes to fgMATERIAL.
625 // Some changes to fgFRAGMENT but I forget what!
627 // Revision 1.1 1998/08/25 16:51:25 curt
628 // Moved from ../Scenery
630 // Revision 1.23 1998/08/20 15:16:43 curt
631 // obj.cxx: use more explicit parenthases.
632 // texload.[ch]: use const in function definitions where appropriate.
634 // Revision 1.22 1998/08/20 15:12:03 curt
635 // Used a forward declaration of classes fgTILE and fgMATERIAL to eliminate
636 // the need for "void" pointers and casts.
637 // Quick hack to count the number of scenery polygons that are being drawn.
639 // Revision 1.21 1998/08/12 21:13:04 curt
640 // material.cxx: don't load textures if they are disabled
641 // obj.cxx: optimizations from Norman Vine
642 // tile.cxx: minor tweaks
643 // tile.hxx: addition of num_faces
644 // tilemgr.cxx: minor tweaks
646 // Revision 1.20 1998/07/24 21:42:07 curt
647 // material.cxx: whups, double method declaration with no definition.
648 // obj.cxx: tweaks to avoid errors in SGI's CC.
649 // tile.cxx: optimizations by Norman Vine.
650 // tilemgr.cxx: optimizations by Norman Vine.
652 // Revision 1.19 1998/07/13 21:01:58 curt
653 // Wrote access functions for current fgOPTIONS.
655 // Revision 1.18 1998/07/12 03:18:27 curt
656 // Added ground collision detection. This involved:
657 // - saving the entire vertex list for each tile with the tile records.
658 // - saving the face list for each fragment with the fragment records.
659 // - code to intersect the current vertical line with the proper face in
660 // an efficient manner as possible.
661 // Fixed a bug where the tiles weren't being shifted to "near" (0,0,0)
663 // Revision 1.17 1998/07/08 14:47:21 curt
664 // Fix GL_MODULATE vs. GL_DECAL problem introduced by splash screen.
665 // polare3d.h renamed to polar3d.hxx
666 // fg{Cartesian,Polar}Point3d consolodated.
667 // Added some initial support for calculating local current ground elevation.
669 // Revision 1.16 1998/07/06 21:34:33 curt
670 // Added using namespace std for compilers that support this.
672 // Revision 1.15 1998/07/04 00:54:28 curt
673 // Added automatic mipmap generation.
675 // When rendering fragments, use saved model view matrix from associated tile
676 // rather than recalculating it with push() translate() pop().
678 // Revision 1.14 1998/06/17 21:36:40 curt
679 // Load and manage multiple textures defined in the Materials library.
680 // Boost max material fagments for each material property to 800.
681 // Multiple texture support when rendering.
683 // Revision 1.13 1998/06/12 00:58:05 curt
684 // Build only static libraries.
685 // Declare memmove/memset for Sloaris.
687 // Revision 1.12 1998/06/08 17:57:54 curt
688 // Working first pass at material proporty sorting.
690 // Revision 1.11 1998/06/06 01:09:31 curt
691 // I goofed on the log message in the last commit ... now fixed.
693 // Revision 1.10 1998/06/06 01:07:17 curt
694 // Increased per material fragment list size from 100 to 400.
695 // Now correctly draw viewable fragments in per material order.
697 // Revision 1.9 1998/06/05 22:39:54 curt
698 // Working on sorting by, and rendering by material properties.
700 // Revision 1.8 1998/06/05 18:19:18 curt
701 // Recognize file, file.gz, and file.obj as scenery object files.
703 // Revision 1.7 1998/05/24 02:49:09 curt
704 // Implimented fragment level view frustum culling.
706 // Revision 1.6 1998/05/23 14:09:20 curt
707 // Added tile.cxx and tile.hxx.
708 // Working on rewriting the tile management system so a tile is just a list
709 // fragments, and the fragment record contains the display list for that
712 // Revision 1.5 1998/05/20 20:53:53 curt
713 // Moved global ref point and radius (bounding sphere info, and offset) to
714 // data file rather than calculating it on the fly.
715 // Fixed polygon winding problem in scenery generation stage rather than
716 // compensating for it on the fly.
717 // Made a fgTILECACHE class.
719 // Revision 1.4 1998/05/16 13:09:57 curt
720 // Beginning to add support for view frustum culling.
721 // Added some temporary code to calculate bouding radius, until the
722 // scenery generation tools and scenery can be updated.
724 // Revision 1.3 1998/05/03 00:48:01 curt
725 // Updated texture coordinate fmod() parameter.
727 // Revision 1.2 1998/05/02 01:52:14 curt
728 // Playing around with texture coordinates.
730 // Revision 1.1 1998/04/30 12:35:28 curt
731 // Added a command line rendering option specify smooth/flat shading.
733 // Revision 1.35 1998/04/28 21:43:26 curt
734 // Wrapped zlib calls up so we can conditionally comment out zlib support.
736 // Revision 1.34 1998/04/28 01:21:42 curt
737 // Tweaked texture parameter calculations to keep the number smaller. This
738 // avoids the "swimming" problem.
739 // Type-ified fgTIME and fgVIEW.
741 // Revision 1.33 1998/04/27 15:58:15 curt
742 // Screwing around with texture coordinate generation ... still needs work.
744 // Revision 1.32 1998/04/27 03:30:13 curt
745 // Minor transformation adjustments to try to keep scenery tiles closer to
746 // (0, 0, 0) GLfloats run out of precision at the distances we need to model
747 // the earth, but we can do a bunch of pre-transformations using double math
748 // and then cast to GLfloat once everything is close in where we have less
749 // precision problems.
751 // Revision 1.31 1998/04/25 15:09:57 curt
752 // Changed "r" to "rb" in gzopen() options. This fixes bad behavior in win32.
754 // Revision 1.30 1998/04/24 14:21:08 curt
755 // Added "file.obj.gz" support.
757 // Revision 1.29 1998/04/24 00:51:07 curt
758 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
759 // Tweaked the scenery file extentions to be "file.obj" (uncompressed)
760 // or "file.obz" (compressed.)
762 // Revision 1.28 1998/04/22 13:22:44 curt
763 // C++ - ifing the code a bit.
765 // Revision 1.27 1998/04/18 04:13:17 curt
766 // Added zlib on the fly decompression support for loading scenery objects.
768 // Revision 1.26 1998/04/03 22:11:36 curt
769 // Converting to Gnu autoconf system.
771 // Revision 1.25 1998/03/14 00:30:50 curt
772 // Beginning initial terrain texturing experiments.
774 // Revision 1.24 1998/02/09 21:30:18 curt
775 // Fixed a nagging problem with terrain tiles not "quite" matching up perfectly.
777 // Revision 1.23 1998/02/09 15:07:52 curt
780 // Revision 1.22 1998/02/01 03:39:54 curt
783 // Revision 1.21 1998/01/31 00:43:25 curt
784 // Added MetroWorks patches from Carmen Volpe.
786 // Revision 1.20 1998/01/29 00:51:39 curt
787 // First pass at tile cache, dynamic tile loading and tile unloading now works.
789 // Revision 1.19 1998/01/27 03:26:42 curt
790 // Playing with new fgPrintf command.
792 // Revision 1.18 1998/01/19 19:27:16 curt
793 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
794 // This should simplify things tremendously.
796 // Revision 1.17 1998/01/13 00:23:10 curt
797 // Initial changes to support loading and management of scenery tiles. Note,
798 // there's still a fair amount of work left to be done.
800 // Revision 1.16 1997/12/30 23:09:40 curt
801 // Worked on winding problem without luck, so back to calling glFrontFace()
802 // 3 times for each scenery area.
804 // Revision 1.15 1997/12/30 20:47:51 curt
805 // Integrated new event manager with subsystem initializations.
807 // Revision 1.14 1997/12/30 01:38:46 curt
808 // Switched back to per vertex normals and smooth shading for terrain.
810 // Revision 1.13 1997/12/18 23:32:36 curt
811 // First stab at sky dome actually starting to look reasonable. :-)
813 // Revision 1.12 1997/12/17 23:13:47 curt
814 // Began working on rendering the sky.
816 // Revision 1.11 1997/12/15 23:55:01 curt
817 // Add xgl wrappers for debugging.
818 // Generate terrain normals on the fly.
820 // Revision 1.10 1997/12/12 21:41:28 curt
821 // More light/material property tweaking ... still a ways off.
823 // Revision 1.9 1997/12/12 19:52:57 curt
824 // Working on lightling and material properties.
826 // Revision 1.8 1997/12/10 01:19:51 curt
827 // Tweaks for verion 0.15 release.
829 // Revision 1.7 1997/12/08 22:51:17 curt
830 // Enhanced to handle ccw and cw tri-stripe winding. This is a temporary
831 // admission of defeat. I will eventually go back and get all the stripes
832 // wound the same way (ccw).
834 // Revision 1.6 1997/11/25 19:25:35 curt
835 // Changes to integrate Durk's moon/sun code updates + clean up.
837 // Revision 1.5 1997/11/15 18:16:39 curt
840 // Revision 1.4 1997/11/14 00:26:49 curt
841 // Transform scenery coordinates earlier in pipeline when scenery is being
842 // created, not when it is being loaded. Precalculate normals for each node
843 // as average of the normals of each containing polygon so Garoude shading is
846 // Revision 1.3 1997/10/31 04:49:12 curt
847 // Tweaking vertex orders.
849 // Revision 1.2 1997/10/30 12:38:45 curt
850 // Working on new scenery subsystem.
852 // Revision 1.1 1997/10/28 21:14:54 curt