1 // obj.cxx -- routines to handle loading scenery and building the plib
4 // Written by Curtis Olson, started October 1997.
6 // Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
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.
29 #ifdef SG_MATH_EXCEPTION_CLASH
36 #include <simgear/compiler.h>
37 #include <simgear/sg_inlines.h>
38 #include <simgear/io/sg_binobj.hxx>
42 #include <vector> // STL
43 #include <ctype.h> // isdigit()
45 #include <simgear/constants.h>
46 #include <simgear/debug/logstream.hxx>
47 #include <simgear/math/point3d.hxx>
48 #include <simgear/math/polar3d.hxx>
49 #include <simgear/math/sg_geodesy.hxx>
50 #include <simgear/math/sg_random.h>
51 #include <simgear/math/vector.hxx>
52 #include <simgear/misc/sgstream.hxx>
53 #include <simgear/misc/stopwatch.hxx>
54 #include <simgear/misc/texcoord.hxx>
55 #include <simgear/scene/material/mat.hxx>
56 #include <simgear/scene/material/matlib.hxx>
57 #include <simgear/scene/tgdb/leaf.hxx>
58 #include <simgear/scene/tgdb/pt_lights.hxx>
60 #include <Main/globals.hxx>
61 #include <Main/fg_props.hxx>
62 #include <Time/light.hxx>
71 typedef vector < int > int_list;
72 typedef int_list::iterator int_list_iterator;
73 typedef int_list::const_iterator int_point_list_iterator;
76 // not used because plib branches don't honor call backs.
78 runway_lights_pretrav (ssgEntity * e, int mask)
80 // Turn on lights only at night
81 float sun_angle = cur_light_params.sun_angle * SGD_RADIANS_TO_DEGREES;
82 return int((sun_angle > 85.0) ||
83 (fgGetDouble("/environment/visibility-m") < 5000.0));
87 // Generate an ocean tile
88 bool fgGenTile( const string& path, SGBucket b,
89 Point3D *center, double *bounding_radius,
90 SGMaterialLib *matlib, ssgBranch* geometry )
92 ssgSimpleState *state = NULL;
94 geometry->setName( (char *)path.c_str() );
96 double tex_width = 1000.0;
99 // find Ocean material in the properties list
100 SGMaterial *mat = matlib->find( "Ocean" );
102 // set the texture width and height values for this
104 tex_width = mat->get_xsize();
105 // tex_height = newmat->get_ysize();
108 state = mat->get_state();
110 SG_LOG( SG_TERRAIN, SG_ALERT,
111 "Ack! unknown usemtl name = " << "Ocean"
115 // Calculate center point
116 double clon = b.get_center_lon();
117 double clat = b.get_center_lat();
118 double height = b.get_height();
119 double width = b.get_width();
121 *center = sgGeodToCart( Point3D(clon*SGD_DEGREES_TO_RADIANS,
122 clat*SGD_DEGREES_TO_RADIANS,
124 // cout << "center = " << center << endl;;
126 // Caculate corner vertices
128 geod[0] = Point3D( clon - width/2.0, clat - height/2.0, 0.0 );
129 geod[1] = Point3D( clon + width/2.0, clat - height/2.0, 0.0 );
130 geod[2] = Point3D( clon + width/2.0, clat + height/2.0, 0.0 );
131 geod[3] = Point3D( clon - width/2.0, clat + height/2.0, 0.0 );
135 for ( i = 0; i < 4; ++i ) {
136 rad[i] = Point3D( geod[i].x() * SGD_DEGREES_TO_RADIANS,
137 geod[i].y() * SGD_DEGREES_TO_RADIANS,
141 Point3D cart[4], rel[4];
142 for ( i = 0; i < 4; ++i ) {
143 cart[i] = sgGeodToCart(rad[i]);
144 rel[i] = cart[i] - *center;
145 // cout << "corner " << i << " = " << cart[i] << endl;
148 // Calculate bounding radius
149 *bounding_radius = center->distance3D( cart[0] );
150 // cout << "bounding radius = " << t->bounding_radius << endl;
154 for ( i = 0; i < 4; ++i ) {
155 double length = cart[i].distance3D( Point3D(0.0) );
156 normals[i] = cart[i] / length;
157 // cout << "normal = " << normals[i] << endl;
160 // Calculate texture coordinates
161 point_list geod_nodes;
163 geod_nodes.reserve(4);
166 rectangle.reserve(4);
167 for ( i = 0; i < 4; ++i ) {
168 geod_nodes.push_back( geod[i] );
169 rectangle.push_back( i );
171 point_list texs = calc_tex_coords( b, geod_nodes, rectangle,
172 1000.0 / tex_width );
174 // Allocate ssg structure
175 ssgVertexArray *vl = new ssgVertexArray( 4 );
176 ssgNormalArray *nl = new ssgNormalArray( 4 );
177 ssgTexCoordArray *tl = new ssgTexCoordArray( 4 );
178 ssgColourArray *cl = new ssgColourArray( 1 );
181 sgSetVec4( color, 1.0, 1.0, 1.0, 1.0 );
184 // sgVec3 *vtlist = new sgVec3 [ 4 ];
185 // t->vec3_ptrs.push_back( vtlist );
186 // sgVec3 *vnlist = new sgVec3 [ 4 ];
187 // t->vec3_ptrs.push_back( vnlist );
188 // sgVec2 *tclist = new sgVec2 [ 4 ];
189 // t->vec2_ptrs.push_back( tclist );
193 for ( i = 0; i < 4; ++i ) {
195 rel[i].x(), rel[i].y(), rel[i].z() );
199 normals[i].x(), normals[i].y(), normals[i].z() );
202 sgSetVec2( tmp2, texs[i].x(), texs[i].y());
207 new ssgVtxTable ( GL_TRIANGLE_FAN, vl, nl, tl, cl );
209 leaf->setState( state );
211 geometry->addKid( leaf );
217 static void random_pt_inside_tri( float *res,
218 float *n1, float *n2, float *n3 )
220 double a = sg_random();
221 double b = sg_random();
226 double c = 1 - a - b;
228 res[0] = n1[0]*a + n2[0]*b + n3[0]*c;
229 res[1] = n1[1]*a + n2[1]*b + n3[1]*c;
230 res[2] = n1[2]*a + n2[2]*b + n3[2]*c;
235 * User data for populating leaves when they come in range.
237 class LeafUserData : public ssgBase
249 void setup_triangle( int i );
254 * User data for populating triangles when they come in range.
256 class TriUserData : public ssgBase
265 SGMaterial::ObjectGroup * object_group;
267 LeafUserData * leafData;
270 void fill_in_triangle();
271 void add_object_to_triangle(SGMaterial::Object * object);
272 void makeWorldMatrix (sgMat4 ROT, double hdg_deg );
277 * Fill in a triangle with randomly-placed objects.
279 * This method is invoked by a callback when the triangle is in range
280 * but not yet populated.
284 void TriUserData::fill_in_triangle ()
286 // generate a repeatable random seed
289 int nObjects = object_group->get_object_count();
291 for (int i = 0; i < nObjects; i++) {
292 SGMaterial::Object * object = object_group->get_object(i);
293 double num = area / object->get_coverage_m2();
295 // place an object each unit of area
296 while ( num > 1.0 ) {
297 add_object_to_triangle(object);
300 // for partial units of area, use a zombie door method to
301 // create the proper random chance of an object being created
304 if ( sg_random() <= num ) {
305 // a zombie made it through our door
306 add_object_to_triangle(object);
312 void TriUserData::add_object_to_triangle (SGMaterial::Object * object)
314 // Set up the random heading if required.
316 if (object->get_heading_type() == SGMaterial::Object::HEADING_RANDOM)
317 hdg_deg = sg_random() * 360;
320 makeWorldMatrix(mat, hdg_deg);
322 ssgTransform * pos = new ssgTransform;
323 pos->setTransform(mat);
324 pos->addKid( object->get_random_model( globals->get_model_loader(),
325 globals->get_fg_root(),
326 globals->get_props(),
327 globals->get_sim_time_sec() )
332 void TriUserData::makeWorldMatrix (sgMat4 mat, double hdg_deg )
335 mat[0][0] = leafData->sin_lat * leafData->cos_lon;
336 mat[0][1] = leafData->sin_lat * leafData->sin_lon;
337 mat[0][2] = -leafData->cos_lat;
340 mat[1][0] = -leafData->sin_lon;
341 mat[1][1] = leafData->cos_lon;
345 float sin_hdg = sin( hdg_deg * SGD_DEGREES_TO_RADIANS ) ;
346 float cos_hdg = cos( hdg_deg * SGD_DEGREES_TO_RADIANS ) ;
347 mat[0][0] = cos_hdg * leafData->sin_lat * leafData->cos_lon - sin_hdg * leafData->sin_lon;
348 mat[0][1] = cos_hdg * leafData->sin_lat * leafData->sin_lon + sin_hdg * leafData->cos_lon;
349 mat[0][2] = -cos_hdg * leafData->cos_lat;
352 mat[1][0] = -sin_hdg * leafData->sin_lat * leafData->cos_lon - cos_hdg * leafData->sin_lon;
353 mat[1][1] = -sin_hdg * leafData->sin_lat * leafData->sin_lon + cos_hdg * leafData->cos_lon;
354 mat[1][2] = sin_hdg * leafData->cos_lat;
358 mat[2][0] = leafData->cos_lat * leafData->cos_lon;
359 mat[2][1] = leafData->cos_lat * leafData->sin_lon;
360 mat[2][2] = leafData->sin_lat;
363 // translate to random point in triangle
365 random_pt_inside_tri(result, p1, p2, p3);
366 sgSubVec3(mat[3], result, center);
372 * SSG callback for an in-range triangle of randomly-placed objects.
374 * This pretraversal callback is attached to a branch that is traversed
375 * only when a triangle is in range. If the triangle is not currently
376 * populated with randomly-placed objects, this callback will populate
379 * @param entity The entity to which the callback is attached (not used).
380 * @param mask The entity's traversal mask (not used).
381 * @return Always 1, to allow traversal and culling to continue.
384 tri_in_range_callback (ssgEntity * entity, int mask)
386 TriUserData * data = (TriUserData *)entity->getUserData();
387 if (!data->is_filled_in) {
388 data->fill_in_triangle();
389 data->is_filled_in = true;
396 * SSG callback for an out-of-range triangle of randomly-placed objects.
398 * This pretraversal callback is attached to a branch that is traversed
399 * only when a triangle is out of range. If the triangle is currently
400 * populated with randomly-placed objects, the objects will be removed.
403 * @param entity The entity to which the callback is attached (not used).
404 * @param mask The entity's traversal mask (not used).
405 * @return Always 0, to prevent any further traversal or culling.
408 tri_out_of_range_callback (ssgEntity * entity, int mask)
410 TriUserData * data = (TriUserData *)entity->getUserData();
411 if (data->is_filled_in) {
412 data->branch->removeAllKids();
413 data->is_filled_in = false;
420 * ssgEntity with a dummy bounding sphere, to fool culling.
422 * This forces the in-range and out-of-range branches to be visited
423 * when appropriate, even if they have no children. It's ugly, but
424 * it works and seems fairly efficient (since branches can still
425 * be culled when they're out of the view frustum).
427 class DummyBSphereEntity : public ssgBranch
430 DummyBSphereEntity (float radius)
432 bsphere.setCenter(0, 0, 0);
433 bsphere.setRadius(radius);
435 virtual ~DummyBSphereEntity () {}
436 virtual void recalcBSphere () { bsphere_is_invalid = false; }
441 * Calculate the bounding radius of a triangle from its center.
443 * @param center The triangle center.
444 * @param p1 The first point in the triangle.
445 * @param p2 The second point in the triangle.
446 * @param p3 The third point in the triangle.
447 * @return The greatest distance any point lies from the center.
450 get_bounding_radius( sgVec3 center, float *p1, float *p2, float *p3)
452 return sqrt( SG_MAX3( sgDistanceSquaredVec3(center, p1),
453 sgDistanceSquaredVec3(center, p2),
454 sgDistanceSquaredVec3(center, p3) ) );
459 * Set up a triangle for randomly-placed objects.
461 * No objects will be added unless the triangle comes into range.
465 void LeafUserData::setup_triangle (int i )
468 leaf->getTriangle(i, &n1, &n2, &n3);
470 float * p1 = leaf->getVertex(n1);
471 float * p2 = leaf->getVertex(n2);
472 float * p3 = leaf->getVertex(n3);
474 // Set up a single center point for LOD
477 (p1[0] + p2[0] + p3[0]) / 3.0,
478 (p1[1] + p2[1] + p3[1]) / 3.0,
479 (p1[2] + p2[2] + p3[2]) / 3.0);
480 double area = sgTriArea(p1, p2, p3);
482 // maximum radius of an object from center.
483 double bounding_radius = get_bounding_radius(center, p1, p2, p3);
485 // Set up a transformation to the center
486 // point, so that everything else can
487 // be specified relative to it.
488 ssgTransform * location = new ssgTransform;
490 sgMakeTransMat4(TRANS, center);
491 location->setTransform(TRANS);
492 branch->addKid(location);
494 // Iterate through all the object types.
495 int num_groups = mat->get_object_group_count();
496 for (int j = 0; j < num_groups; j++) {
497 // Look up the random object.
498 SGMaterial::ObjectGroup * group = mat->get_object_group(j);
500 // Set up the range selector for the entire
501 // triangle; note that we use the object
502 // range plus the bounding radius here, to
503 // allow for objects far from the center.
504 float ranges[] = { 0,
505 group->get_range_m() + bounding_radius,
507 ssgRangeSelector * lod = new ssgRangeSelector;
508 lod->setRanges(ranges, 3);
509 location->addKid(lod);
511 // Create the in-range and out-of-range
513 ssgBranch * in_range = new ssgBranch;
514 ssgBranch * out_of_range = new ssgBranch;
516 // Set up the user data for if/when
517 // the random objects in this triangle
519 TriUserData * data = new TriUserData;
520 data->is_filled_in = false;
524 sgCopyVec3 (data->center, center);
526 data->object_group = group;
527 data->branch = in_range;
528 data->leafData = this;
529 data->seed = (unsigned int)(p1[0] * j);
531 // Set up the in-range node.
532 in_range->setUserData(data);
533 in_range->setTravCallback(SSG_CALLBACK_PRETRAV,
534 tri_in_range_callback);
535 lod->addKid(in_range);
537 // Set up the out-of-range node.
538 out_of_range->setUserData(data);
539 out_of_range->setTravCallback(SSG_CALLBACK_PRETRAV,
540 tri_out_of_range_callback);
541 out_of_range->addKid(new DummyBSphereEntity(bounding_radius));
542 lod->addKid(out_of_range);
547 * SSG callback for an in-range leaf of randomly-placed objects.
549 * This pretraversal callback is attached to a branch that is
550 * traversed only when a leaf is in range. If the leaf is not
551 * currently prepared to be populated with randomly-placed objects,
552 * this callback will prepare it (actual population is handled by
553 * the tri_in_range_callback for individual triangles).
555 * @param entity The entity to which the callback is attached (not used).
556 * @param mask The entity's traversal mask (not used).
557 * @return Always 1, to allow traversal and culling to continue.
560 leaf_in_range_callback (ssgEntity * entity, int mask)
562 LeafUserData * data = (LeafUserData *)entity->getUserData();
564 if (!data->is_filled_in) {
565 // Iterate through all the triangles
566 // and populate them.
567 int num_tris = data->leaf->getNumTriangles();
568 for ( int i = 0; i < num_tris; ++i ) {
569 data->setup_triangle(i);
571 data->is_filled_in = true;
578 * SSG callback for an out-of-range leaf of randomly-placed objects.
580 * This pretraversal callback is attached to a branch that is
581 * traversed only when a leaf is out of range. If the leaf is
582 * currently prepared to be populated with randomly-placed objects (or
583 * is actually populated), the objects will be removed.
585 * @param entity The entity to which the callback is attached (not used).
586 * @param mask The entity's traversal mask (not used).
587 * @return Always 0, to prevent any further traversal or culling.
590 leaf_out_of_range_callback (ssgEntity * entity, int mask)
592 LeafUserData * data = (LeafUserData *)entity->getUserData();
593 if (data->is_filled_in) {
594 data->branch->removeAllKids();
595 data->is_filled_in = false;
602 * Randomly place objects on a surface.
604 * The leaf node provides the geometry of the surface, while the
605 * material provides the objects and placement density. Latitude
606 * and longitude are required so that the objects can be rotated
607 * to the world-up vector. This function does not actually add
608 * any objects; instead, it attaches an ssgRangeSelector to the
609 * branch with callbacks to generate the objects when needed.
611 * @param leaf The surface where the objects should be placed.
612 * @param branch The branch that will hold the randomly-placed objects.
613 * @param center The center of the leaf in FlightGear coordinates.
614 * @param material_name The name of the surface's material.
617 gen_random_surface_objects (ssgLeaf *leaf,
622 // If the surface has no triangles, return
624 int num_tris = leaf->getNumTriangles();
628 // If the material has no randomly-placed
629 // objects, return now.
630 if (mat->get_object_group_count() < 1)
633 // Calculate the geodetic centre of
634 // the tile, for aligning automatic
636 double lon_deg, lat_rad, lat_deg, alt_m, sl_radius_m;
637 Point3D geoc = sgCartToPolar3d(*center);
638 lon_deg = geoc.lon() * SGD_RADIANS_TO_DEGREES;
639 sgGeocToGeod(geoc.lat(), geoc.radius(),
640 &lat_rad, &alt_m, &sl_radius_m);
641 lat_deg = lat_rad * SGD_RADIANS_TO_DEGREES;
644 // max random object range: 20000m
645 float ranges[] = { 0, 20000, 1000000 };
646 ssgRangeSelector * lod = new ssgRangeSelector;
647 lod->setRanges(ranges, 3);
650 // Create the in-range and out-of-range
652 ssgBranch * in_range = new ssgBranch;
653 ssgBranch * out_of_range = new ssgBranch;
654 lod->addKid(in_range);
655 lod->addKid(out_of_range);
657 LeafUserData * data = new LeafUserData;
658 data->is_filled_in = false;
661 data->branch = in_range;
662 data->sin_lat = sin(lat_deg * SGD_DEGREES_TO_RADIANS);
663 data->cos_lat = cos(lat_deg * SGD_DEGREES_TO_RADIANS);
664 data->sin_lon = sin(lon_deg * SGD_DEGREES_TO_RADIANS);
665 data->cos_lon = cos(lon_deg * SGD_DEGREES_TO_RADIANS);
667 in_range->setUserData(data);
668 in_range->setTravCallback(SSG_CALLBACK_PRETRAV, leaf_in_range_callback);
669 out_of_range->setUserData(data);
670 out_of_range->setTravCallback(SSG_CALLBACK_PRETRAV,
671 leaf_out_of_range_callback);
673 ->addKid(new DummyBSphereEntity(leaf->getBSphere()->getRadius()));
678 ////////////////////////////////////////////////////////////////////////
680 ////////////////////////////////////////////////////////////////////////
682 // Load an Binary obj file
683 bool fgBinObjLoad( const string& path, const bool is_base,
685 double *bounding_radius,
686 SGMaterialLib *matlib,
688 ssgBranch* rwy_lights,
689 ssgBranch* taxi_lights,
690 ssgVertexArray *ground_lights )
693 bool use_random_objects =
694 fgGetBool("/sim/rendering/random-objects", true);
696 if ( ! obj.read_bin( path ) ) {
700 geometry->setName( (char *)path.c_str() );
702 // reference point (center offset/bounding sphere)
703 *center = obj.get_gbs_center();
704 *bounding_radius = obj.get_gbs_radius();
706 point_list const& nodes = obj.get_wgs84_nodes();
707 // point_list const& colors = obj.get_colors();
708 point_list const& normals = obj.get_normals();
709 point_list const& texcoords = obj.get_texcoords();
714 group_list::size_type i;
717 string_list const& pt_materials = obj.get_pt_materials();
718 group_list const& pts_v = obj.get_pts_v();
719 group_list const& pts_n = obj.get_pts_n();
720 for ( i = 0; i < pts_v.size(); ++i ) {
721 // cout << "pts_v.size() = " << pts_v.size() << endl;
722 if ( pt_materials[i].substr(0, 3) == "RWY" ) {
724 sgSetVec3( up, center->x(), center->y(), center->z() );
725 // returns a transform -> lod -> leaf structure
726 ssgBranch *branch = sgMakeDirectionalLights( nodes, normals,
729 pt_materials[i], up );
730 // branches don't honor callbacks as far as I know so I'm
731 // commenting this out to avoid a plib runtime warning.
732 branch->setTravCallback( SSG_CALLBACK_PRETRAV,
733 runway_lights_pretrav );
734 if ( pt_materials[i].substr(0, 16) == "RWY_BLUE_TAXIWAY" ) {
735 taxi_lights->addKid( branch );
737 rwy_lights->addKid( branch );
740 material = pt_materials[i];
742 ssgLeaf *leaf = sgMakeLeaf( path, GL_POINTS, matlib, material,
743 nodes, normals, texcoords,
744 pts_v[i], pts_n[i], tex_index,
745 false, ground_lights );
746 geometry->addKid( leaf );
750 // Put all randomly-placed objects under a separate branch
751 // (actually an ssgRangeSelector) named "random-models".
752 ssgBranch * random_object_branch = 0;
753 if (use_random_objects) {
754 float ranges[] = { 0, 20000 }; // Maximum 20km range for random objects
755 ssgRangeSelector * object_lod = new ssgRangeSelector;
756 object_lod->setRanges(ranges, 2);
757 object_lod->setName("random-models");
758 geometry->addKid(object_lod);
759 random_object_branch = new ssgBranch;
760 object_lod->addKid(random_object_branch);
763 // generate triangles
764 string_list const& tri_materials = obj.get_tri_materials();
765 group_list const& tris_v = obj.get_tris_v();
766 group_list const& tris_n = obj.get_tris_n();
767 group_list const& tris_tc = obj.get_tris_tc();
768 for ( i = 0; i < tris_v.size(); ++i ) {
769 ssgLeaf *leaf = sgMakeLeaf( path, GL_TRIANGLES, matlib,
771 nodes, normals, texcoords,
772 tris_v[i], tris_n[i], tris_tc[i],
773 is_base, ground_lights );
775 if ( use_random_objects ) {
776 SGMaterial *mat = matlib->find( tri_materials[i] );
778 SG_LOG( SG_INPUT, SG_ALERT,
779 "Unknown material for random surface objects = "
780 << tri_materials[i] );
782 gen_random_surface_objects( leaf, random_object_branch,
785 geometry->addKid( leaf );
789 string_list const& strip_materials = obj.get_strip_materials();
790 group_list const& strips_v = obj.get_strips_v();
791 group_list const& strips_n = obj.get_strips_n();
792 group_list const& strips_tc = obj.get_strips_tc();
793 for ( i = 0; i < strips_v.size(); ++i ) {
794 ssgLeaf *leaf = sgMakeLeaf( path, GL_TRIANGLE_STRIP,
795 matlib, strip_materials[i],
796 nodes, normals, texcoords,
797 strips_v[i], strips_n[i], strips_tc[i],
798 is_base, ground_lights );
800 if ( use_random_objects ) {
801 SGMaterial *mat = matlib->find( strip_materials[i] );
803 SG_LOG( SG_INPUT, SG_ALERT,
804 "Unknown material for random surface objects = "
805 << strip_materials[i] );
807 gen_random_surface_objects( leaf, random_object_branch,
810 geometry->addKid( leaf );
814 string_list const& fan_materials = obj.get_fan_materials();
815 group_list const& fans_v = obj.get_fans_v();
816 group_list const& fans_n = obj.get_fans_n();
817 group_list const& fans_tc = obj.get_fans_tc();
818 for ( i = 0; i < fans_v.size(); ++i ) {
819 ssgLeaf *leaf = sgMakeLeaf( path, GL_TRIANGLE_FAN,
820 matlib, fan_materials[i],
821 nodes, normals, texcoords,
822 fans_v[i], fans_n[i], fans_tc[i],
823 is_base, ground_lights );
824 if ( use_random_objects ) {
825 SGMaterial *mat = matlib->find( fan_materials[i] );
827 SG_LOG( SG_INPUT, SG_ALERT,
828 "Unknown material for random surface objects = "
829 << fan_materials[i] );
831 gen_random_surface_objects( leaf, random_object_branch,
834 geometry->addKid( leaf );