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.
28 #ifdef FG_MATH_EXCEPTION_CLASH
35 // #if defined ( __sun__ )
36 // extern "C" void *memmove(void *, const void *, size_t);
37 // extern "C" void *memset(void *, int, size_t);
40 #include <Include/compiler.h>
44 #include <vector> // STL
45 #include <ctype.h> // isdigit()
47 #include <Debug/logstream.hxx>
48 #include <Misc/fgstream.hxx>
49 #include <Include/fg_constants.h>
50 #include <Main/options.hxx>
51 #include <Math/mat3.h>
52 #include <Math/fg_geodesy.hxx>
53 #include <Math/fg_random.h>
54 #include <Math/point3d.hxx>
55 #include <Math/polar3d.hxx>
56 #include <Misc/stopwatch.hxx>
57 #include <Scenery/tileentry.hxx>
59 #include "materialmgr.hxx"
66 typedef vector < int > int_list;
67 typedef int_list::iterator int_list_iterator;
68 typedef int_list::const_iterator int_point_list_iterator;
71 static double normals[FG_MAX_NODES][3];
72 static double tex_coords[FG_MAX_NODES*3][3];
75 // given three points defining a triangle, calculate the normal
76 static void calc_normal(Point3D p1, Point3D p2,
77 Point3D p3, double normal[3])
82 v1[0] = p2[0] - p1[0]; v1[1] = p2[1] - p1[1]; v1[2] = p2[2] - p1[2];
83 v2[0] = p3[0] - p1[0]; v2[1] = p3[1] - p1[1]; v2[2] = p3[2] - p1[2];
85 MAT3cross_product(normal, v1, v2);
86 MAT3_NORMALIZE_VEC(normal,temp);
88 // fgPrintf( FG_TERRAIN, FG_DEBUG, " Normal = %.2f %.2f %.2f\n",
89 // normal[0], normal[1], normal[2]);
93 #define FG_TEX_CONSTANT 69.0
96 // Calculate texture coordinates for a given point.
97 static Point3D calc_tex_coords(const Point3D& node, const Point3D& ref) {
100 // double tmplon, tmplat;
102 // cout << "-> " << node[0] << " " << node[1] << " " << node[2] << endl;
103 // cout << "-> " << ref.x() << " " << ref.y() << " " << ref.z() << endl;
105 cp = Point3D( node[0] + ref.x(),
109 pp = fgCartToPolar3d(cp);
111 // tmplon = pp.lon() * RAD_TO_DEG;
112 // tmplat = pp.lat() * RAD_TO_DEG;
113 // cout << tmplon << " " << tmplat << endl;
115 pp.setx( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.x(), 11.0) );
116 pp.sety( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.y(), 11.0) );
118 if ( pp.x() < 0.0 ) {
119 pp.setx( pp.x() + 11.0 );
122 if ( pp.y() < 0.0 ) {
123 pp.sety( pp.y() + 11.0 );
126 // cout << pp << endl;
132 // Generate a generic ocean tile on the fly
133 ssgBranch *fgGenTile( const string& path, FGTileEntry *t) {
136 fragment.tile_ptr = t;
138 ssgSimpleState *state = NULL;
140 ssgBranch *tile = new ssgBranch () ;
141 tile -> setName ( (char *)path.c_str() ) ;
143 // find Ocean material in the properties list
144 if ( ! material_mgr.find( "Ocean", fragment.material_ptr )) {
145 FG_LOG( FG_TERRAIN, FG_ALERT,
146 "Ack! unknown usemtl name = " << "Ocean"
150 // set the texture width and height values for this
152 FGMaterial m = fragment.material_ptr->get_m();
153 // double tex_width = m.get_xsize();
154 // double tex_height = m.get_ysize();
157 state = fragment.material_ptr->get_state();
159 // Calculate center point
160 FGBucket b = t->tile_bucket;
161 double clon = b.get_center_lon();
162 double clat = b.get_center_lat();
163 double height = b.get_height();
164 double width = b.get_width();
166 Point3D center = fgGeodToCart(Point3D(clon*DEG_TO_RAD,clat*DEG_TO_RAD,0.0));
168 fragment.center = center;
169 // cout << "center = " << center << endl;;
171 // Caculate corner vertices
173 geod[0] = Point3D( clon - width/2.0, clat - height/2.0, 0.0 );
174 geod[1] = Point3D( clon + width/2.0, clat - height/2.0, 0.0 );
175 geod[2] = Point3D( clon + width/2.0, clat + height/2.0, 0.0 );
176 geod[3] = Point3D( clon - width/2.0, clat + height/2.0, 0.0 );
180 for ( i = 0; i < 4; ++i ) {
181 rad[i] = Point3D( geod[i].x() * DEG_TO_RAD, geod[i].y() * DEG_TO_RAD,
185 Point3D cart[4], rel[4];
187 for ( i = 0; i < 4; ++i ) {
188 cart[i] = fgGeodToCart(rad[i]);
189 rel[i] = cart[i] - center;
190 t->nodes.push_back( rel[i] );
191 // cout << "corner " << i << " = " << cart[i] << endl;
196 // Calculate bounding radius
197 t->bounding_radius = center.distance3D( cart[0] );
198 fragment.bounding_radius = t->bounding_radius;
199 // cout << "bounding radius = " << t->bounding_radius << endl;
203 for ( i = 0; i < 4; ++i ) {
204 normals[i] = cart[i];
205 double length = normals[i].distance3D( Point3D(0.0) );
206 normals[i] /= length;
207 // cout << "normal = " << normals[i] << endl;
210 // Calculate texture coordinates
212 for ( i = 0; i < 4; ++i ) {
213 texs[i] = calc_tex_coords( rel[i], center );
214 // cout << "texture coordinate = " << texs[i] << endl;
217 // Build flight gear structure
218 fragment.add_face(0, 1, 2);
219 fragment.add_face(0, 2, 3);
220 t->fragment_list.push_back(fragment);
222 // Build ssg structure
223 t->vtlist = new sgVec3 [ 4 ];
224 t->vnlist = new sgVec3 [ 4 ];
225 t->tclist = new sgVec2 [ 4 ];
227 for ( i = 0; i < 4; ++i ) {
228 sgSetVec3( t->vtlist[i],
229 rel[i].x(), rel[i].y(), rel[i].z() );
230 sgSetVec3( t->vnlist[i],
231 normals[i].x(), normals[i].y(), normals[i].z() );
232 sgSetVec2( t->tclist[i], texs[i].x(), texs[i].y() );
235 unsigned short *vindex = new unsigned short [ 4 ];
236 unsigned short *tindex = new unsigned short [ 4 ];
237 for ( i = 0; i < 4; ++i ) {
243 new ssgVTable ( GL_TRIANGLE_FAN,
244 4, vindex, t->vtlist,
245 4, vindex, t->vnlist,
246 4, tindex, t->tclist,
248 leaf->setState( state );
250 tile->addKid( leaf );
256 // Load a .obj file and build the fragment list
257 ssgBranch *fgObjLoad( const string& path, FGTileEntry *t) {
260 double approx_normal[3] /*, normal[3], scale = 0.0 */;
261 // double x, y, z, xmax, xmin, ymax, ymin, zmax, zmin;
262 // GLfloat sgenparams[] = { 1.0, 0.0, 0.0, 0.0 };
263 // GLint display_list = 0;
265 bool in_fragment = false, in_faces = false;
266 int vncount, vtcount;
267 int n1 = 0, n2 = 0, n3 = 0, n4 = 0;
269 int last1 = 0, last2 = 0, odd = 0;
273 double scenery_version = 0.0;
274 double tex_width = 1000.0, tex_height = 1000.0;
275 bool shared_done = false;
276 int_list fan_vertices;
277 int_list fan_tex_coords;
279 ssgSimpleState *state = NULL;
281 ssgBranch *tile = new ssgBranch () ;
282 tile -> setName ( (char *)path.c_str() ) ;
284 // Attempt to open "path.gz" or "path"
285 fg_gzifstream in( path );
286 if ( ! in.is_open() ) {
287 FG_LOG( FG_TERRAIN, FG_ALERT, "Cannot open file: " << path );
288 FG_LOG( FG_TERRAIN, FG_ALERT, "default to ocean tile: " << path );
290 return fgGenTile( path, t );
293 shading = current_options.get_shading();
299 t->bounding_radius = 0.0;
305 // ignore initial comments and blank lines. (priming the pump)
306 // in >> skipcomment;
313 while ( in.get(c) && c != '\0' ) {
316 while ( ! in.eof() ) {
325 if ( in.get( c ) && c == '#' ) {
326 // process a comment line
328 // getline( in, line );
329 // cout << "comment = " << line << endl;
333 if ( token == "Version" ) {
334 // read scenery versions number
335 in >> scenery_version;
336 // cout << "scenery_version = " << scenery_version << endl;
337 } else if ( token == "gbs" ) {
338 // reference point (center offset)
339 in >> t->center >> t->bounding_radius;
341 // cout << "center = " << center
342 // << " radius = " << t->bounding_radius << endl;
343 } else if ( token == "bs" ) {
344 // reference point (center offset)
345 in >> fragment.center;
346 in >> fragment.bounding_radius;
348 // cout << "center = " << fragment.center
349 // << " radius = " << fragment.bounding_radius << endl;
350 } else if ( token == "usemtl" ) {
351 // material property specification
353 // if first usemtl with shared_done = false, then set
354 // shared_done true and build the ssg shared lists
355 if ( ! shared_done ) {
357 if ( (int)nodes.size() != vncount ) {
358 FG_LOG( FG_TERRAIN, FG_ALERT,
359 "Tile has mismatched nodes and normals: "
365 t->vtlist = new sgVec3 [ nodes.size() ];
366 t->vnlist = new sgVec3 [ vncount ];
367 t->tclist = new sgVec2 [ vtcount ];
369 for ( i = 0; i < (int)nodes.size(); ++i ) {
370 sgSetVec3( t->vtlist[i],
371 nodes[i][0], nodes[i][1], nodes[i][2] );
373 for ( i = 0; i < vncount; ++i ) {
374 sgSetVec3( t->vnlist[i],
379 for ( i = 0; i < vtcount; ++i ) {
380 sgSetVec2( t->tclist[i],
386 // series of individual triangles
391 // this also signals the start of a new fragment
393 // close out the previous structure and start the next
395 // printf("xglEnd(); xglEndList();\n");
398 // fragment.display_list = display_list;
400 // push this fragment onto the tile's object list
401 t->fragment_list.push_back(fragment);
406 // printf("start of fragment (usemtl)\n");
408 // display_list = xglGenLists(1);
409 // xglNewList(display_list, GL_COMPILE);
410 // printf("xglGenLists(); xglNewList();\n");
413 // reset the existing face list
414 // printf("cleaning a fragment with %d faces\n",
415 // fragment.faces.size());
418 // scan the material line
421 fragment.tile_ptr = t;
423 // find this material in the properties list
424 if ( ! material_mgr.find( material, fragment.material_ptr )) {
425 FG_LOG( FG_TERRAIN, FG_ALERT,
426 "Ack! unknown usemtl name = " << material
430 // set the texture width and height values for this
432 FGMaterial m = fragment.material_ptr->get_m();
433 tex_width = m.get_xsize();
434 tex_height = m.get_ysize();
435 state = fragment.material_ptr->get_state();
436 // cout << "(w) = " << tex_width << " (h) = "
437 // << tex_width << endl;
439 // initialize the fragment transformation matrix
441 for ( i = 0; i < 16; i++ ) {
442 fragment.matrix[i] = 0.0;
444 fragment.matrix[0] = fragment.matrix[5] =
445 fragment.matrix[10] = fragment.matrix[15] = 1.0;
448 // unknown comment, just gobble the input untill the
458 // cout << "token = " << token << endl;
460 if ( token == "vn" ) {
462 if ( vncount < FG_MAX_NODES ) {
463 in >> normals[vncount][0]
464 >> normals[vncount][1]
465 >> normals[vncount][2];
468 FG_LOG( FG_TERRAIN, FG_ALERT,
469 "Read too many vertex normals in " << path
470 << " ... dying :-(" );
473 } else if ( token == "vt" ) {
474 // vertex texture coordinate
475 if ( vtcount < FG_MAX_NODES*3 ) {
476 in >> tex_coords[vtcount][0]
477 >> tex_coords[vtcount][1];
480 FG_LOG( FG_TERRAIN, FG_ALERT,
481 "Read too many vertex texture coords in " << path
486 } else if ( token == "v" ) {
488 if ( t->ncount < FG_MAX_NODES ) {
489 /* in >> nodes[t->ncount][0]
490 >> nodes[t->ncount][1]
491 >> nodes[t->ncount][2]; */
493 nodes.push_back(node);
496 FG_LOG( FG_TERRAIN, FG_ALERT,
497 "Read too many nodes in " << path
498 << " ... dying :-(");
501 } else if ( token == "t" ) {
502 // start a new triangle strip
504 n1 = n2 = n3 = n4 = 0;
506 // fgPrintf( FG_TERRAIN, FG_DEBUG,
507 // " new tri strip = %s", line);
508 in >> n1 >> n2 >> n3;
509 fragment.add_face(n1, n2, n3);
511 // fgPrintf( FG_TERRAIN, FG_DEBUG, "(t) = ");
513 // xglBegin(GL_TRIANGLE_STRIP);
514 // printf("xglBegin(tristrip) %d %d %d\n", n1, n2, n3);
520 // Shading model is "GL_SMOOTH" so use precalculated
521 // (averaged) normals
522 // MAT3_SCALE_VEC(normal, normals[n1], scale);
523 // xglNormal3dv(normal);
524 pp = calc_tex_coords(nodes[n1], center);
525 // xglTexCoord2f(pp.lon(), pp.lat());
526 // xglVertex3dv(nodes[n1].get_n());
528 // MAT3_SCALE_VEC(normal, normals[n2], scale);
529 // xglNormal3dv(normal);
530 pp = calc_tex_coords(nodes[n2], center);
531 // xglTexCoord2f(pp.lon(), pp.lat());
532 // xglVertex3dv(nodes[n2].get_n());
534 // MAT3_SCALE_VEC(normal, normals[n3], scale);
535 // xglNormal3dv(normal);
536 pp = calc_tex_coords(nodes[n3], center);
537 // xglTexCoord2f(pp.lon(), pp.lat());
538 // xglVertex3dv(nodes[n3].get_n());
540 // Shading model is "GL_FLAT" so calculate per face
541 // normals on the fly.
543 calc_normal(nodes[n1], nodes[n2],
544 nodes[n3], approx_normal);
546 calc_normal(nodes[n2], nodes[n1],
547 nodes[n3], approx_normal);
549 // MAT3_SCALE_VEC(normal, approx_normal, scale);
550 // xglNormal3dv(normal);
552 pp = calc_tex_coords(nodes[n1], center);
553 // xglTexCoord2f(pp.lon(), pp.lat());
554 // xglVertex3dv(nodes[n1].get_n());
556 pp = calc_tex_coords(nodes[n2], center);
557 // xglTexCoord2f(pp.lon(), pp.lat());
558 // xglVertex3dv(nodes[n2].get_n());
560 pp = calc_tex_coords(nodes[n3], center);
561 // xglTexCoord2f(pp.lon(), pp.lat());
562 // xglVertex3dv(nodes[n3].get_n());
564 // printf("some normals, texcoords, and vertices\n");
570 // There can be three or four values
572 while ( in.get(c) ) {
574 break; // only the one
584 fragment.add_face(n3, n2, n4);
587 // Shading model is "GL_SMOOTH"
588 // MAT3_SCALE_VEC(normal, normals[n4], scale);
590 // Shading model is "GL_FLAT"
591 calc_normal(nodes[n3], nodes[n2], nodes[n4],
593 // MAT3_SCALE_VEC(normal, approx_normal, scale);
595 // xglNormal3dv(normal);
596 pp = calc_tex_coords(nodes[n4], center);
597 // xglTexCoord2f(pp.lon(), pp.lat());
598 // xglVertex3dv(nodes[n4].get_n());
603 // printf("a normal, texcoord, and vertex (4th)\n");
605 } else if ( (token == "tf") || (token == "ts") ) {
607 // fgPrintf( FG_TERRAIN, FG_DEBUG, "new fan");
609 fan_vertices.clear();
610 fan_tex_coords.clear();
612 // xglBegin(GL_TRIANGLE_FAN);
615 fan_vertices.push_back( n1 );
616 // xglNormal3dv(normals[n1]);
617 if ( in.get( c ) && c == '/' ) {
619 fan_tex_coords.push_back( tex );
620 if ( scenery_version >= 0.4 ) {
621 if ( tex_width > 0 ) {
622 t->tclist[tex][0] *= (1000.0 / tex_width);
624 if ( tex_height > 0 ) {
625 t->tclist[tex][1] *= (1000.0 / tex_height);
628 pp.setx( tex_coords[tex][0] * (1000.0 / tex_width) );
629 pp.sety( tex_coords[tex][1] * (1000.0 / tex_height) );
632 pp = calc_tex_coords(nodes[n1], center);
634 // xglTexCoord2f(pp.x(), pp.y());
635 // xglVertex3dv(nodes[n1].get_n());
638 fan_vertices.push_back( n2 );
639 // xglNormal3dv(normals[n2]);
640 if ( in.get( c ) && c == '/' ) {
642 fan_tex_coords.push_back( tex );
643 if ( scenery_version >= 0.4 ) {
644 if ( tex_width > 0 ) {
645 t->tclist[tex][0] *= (1000.0 / tex_width);
647 if ( tex_height > 0 ) {
648 t->tclist[tex][1] *= (1000.0 / tex_height);
651 pp.setx( tex_coords[tex][0] * (1000.0 / tex_width) );
652 pp.sety( tex_coords[tex][1] * (1000.0 / tex_height) );
655 pp = calc_tex_coords(nodes[n2], center);
657 // xglTexCoord2f(pp.x(), pp.y());
658 // xglVertex3dv(nodes[n2].get_n());
660 // read all subsequent numbers until next thing isn't a number
671 if ( ! isdigit(c) || in.eof() ) {
676 fan_vertices.push_back( n3 );
677 // cout << " triangle = "
678 // << n1 << "," << n2 << "," << n3
680 // xglNormal3dv(normals[n3]);
681 if ( in.get( c ) && c == '/' ) {
683 fan_tex_coords.push_back( tex );
684 if ( scenery_version >= 0.4 ) {
685 if ( tex_width > 0 ) {
686 t->tclist[tex][0] *= (1000.0 / tex_width);
688 if ( tex_height > 0 ) {
689 t->tclist[tex][1] *= (1000.0 / tex_height);
692 pp.setx( tex_coords[tex][0] * (1000.0 / tex_width) );
693 pp.sety( tex_coords[tex][1] * (1000.0 / tex_height) );
696 pp = calc_tex_coords(nodes[n3], center);
698 // xglTexCoord2f(pp.x(), pp.y());
699 // xglVertex3dv(nodes[n3].get_n());
701 fragment.add_face(n1, n2, n3);
707 // build the ssg entity
708 unsigned short *vindex =
709 new unsigned short [ fan_vertices.size() ];
710 unsigned short *tindex =
711 new unsigned short [ fan_tex_coords.size() ];
712 for ( i = 0; i < (int)fan_vertices.size(); ++i ) {
713 vindex[i] = fan_vertices[i];
715 for ( i = 0; i < (int)fan_tex_coords.size(); ++i ) {
716 tindex[i] = fan_tex_coords[i];
719 if ( token == "tf" ) {
722 new ssgVTable ( GL_TRIANGLE_FAN,
723 fan_vertices.size(), vindex, t->vtlist,
724 fan_vertices.size(), vindex, t->vnlist,
725 fan_tex_coords.size(), tindex,t->tclist,
730 new ssgVTable ( GL_TRIANGLE_STRIP,
731 fan_vertices.size(), vindex, t->vtlist,
732 fan_vertices.size(), vindex, t->vnlist,
733 fan_tex_coords.size(), tindex,t->tclist,
736 leaf->setState( state );
738 tile->addKid( leaf );
740 } else if ( token == "f" ) {
744 // xglBegin(GL_TRIANGLES);
745 // printf("xglBegin(triangles)\n");
749 // fgPrintf( FG_TERRAIN, FG_DEBUG, "new triangle = %s", line);*/
750 in >> n1 >> n2 >> n3;
751 fragment.add_face(n1, n2, n3);
753 // xglNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]);
754 // xglNormal3dv(normals[n1]);
755 pp = calc_tex_coords(nodes[n1], center);
756 // xglTexCoord2f(pp.lon(), pp.lat());
757 // xglVertex3dv(nodes[n1].get_n());
759 // xglNormal3dv(normals[n2]);
760 pp = calc_tex_coords(nodes[n2], center);
761 // xglTexCoord2f(pp.lon(), pp.lat());
762 // xglVertex3dv(nodes[n2].get_n());
764 // xglNormal3dv(normals[n3]);
765 pp = calc_tex_coords(nodes[n3], center);
766 // xglTexCoord2f(pp.lon(), pp.lat());
767 // xglVertex3dv(nodes[n3].get_n());
768 // printf("some normals, texcoords, and vertices (tris)\n");
769 } else if ( token == "q" ) {
770 // continue a triangle strip
773 // fgPrintf( FG_TERRAIN, FG_DEBUG, "continued tri strip = %s ",
777 // There can be one or two values
779 while ( in.get(c) ) {
781 break; // only the one
790 // fgPrintf( FG_TERRAIN, FG_DEBUG, "read %d %d\n", n1, n2);
793 fragment.add_face(last1, last2, n1);
795 fragment.add_face(last2, last1, n1);
799 // Shading model is "GL_SMOOTH"
800 // MAT3_SCALE_VEC(normal, normals[n1], scale);
802 // Shading model is "GL_FLAT"
804 calc_normal(nodes[last1], nodes[last2],
805 nodes[n1], approx_normal);
807 calc_normal(nodes[last2], nodes[last1],
808 nodes[n1], approx_normal);
810 // MAT3_SCALE_VEC(normal, approx_normal, scale);
812 // xglNormal3dv(normal);
814 pp = calc_tex_coords(nodes[n1], center);
815 // xglTexCoord2f(pp.lon(), pp.lat());
816 // xglVertex3dv(nodes[n1].get_n());
817 // printf("a normal, texcoord, and vertex (4th)\n");
824 // fgPrintf( FG_TERRAIN, FG_DEBUG, " (cont)\n");
827 fragment.add_face(last1, last2, n2);
829 fragment.add_face(last2, last1, n2);
833 // Shading model is "GL_SMOOTH"
834 // MAT3_SCALE_VEC(normal, normals[n2], scale);
836 // Shading model is "GL_FLAT"
838 calc_normal(nodes[last1], nodes[last2],
839 nodes[n2], approx_normal);
841 calc_normal(nodes[last2], nodes[last1],
842 nodes[n2], approx_normal);
844 // MAT3_SCALE_VEC(normal, approx_normal, scale);
846 // xglNormal3dv(normal);
848 pp = calc_tex_coords(nodes[n2], center);
849 // xglTexCoord2f(pp.lon(), pp.lat());
850 // xglVertex3dv(nodes[n2].get_n());
851 // printf("a normal, texcoord, and vertex (4th)\n");
858 FG_LOG( FG_TERRAIN, FG_WARN, "Unknown token in "
859 << path << " = " << token );
862 // eat white space before start of while loop so if we are
863 // done with useful input it is noticed before hand.
873 // close out the previous structure and start the next
876 // printf("xglEnd(); xglEndList();\n");
879 // fragment.display_list = display_list;
881 // push this fragment onto the tile's object list
882 t->fragment_list.push_back(fragment);
886 // Draw normal vectors (for visually verifying normals)
888 xglColor3f(0.0, 0.0, 0.0);
889 for ( i = 0; i < t->ncount; i++ ) {
890 xglVertex3d(nodes[i][0],
893 xglVertex3d(nodes[i][0] + 500*normals[i][0],
894 nodes[i][1] + 500*normals[i][1],
895 nodes[i][2] + 500*normals[i][2]);
903 FG_LOG( FG_TERRAIN, FG_DEBUG,
904 "Loaded " << path << " in "
905 << stopwatch.elapsedSeconds() << " seconds" );