-
- LeafMap::iterator lmi = leafMap.begin();
- while ( lmi != leafMap.end() ) {
- list<Leaf> &leaf_list = lmi->second;
- list<Leaf>::iterator li = leaf_list.begin();
- while ( li != leaf_list.end() ) {
- Leaf &leaf = *li;
- int ind = leaf.index;
- if ( leaf.type == GL_TRIANGLES ) {
- ssgLeaf *leaf = sgMakeLeaf( path, GL_TRIANGLES, matlib,
- tri_materials[ind],
- nodes, normals, texcoords,
- tris_v[ind], tris_n[ind], tris_tc[ind],
- is_base, ground_lights );
-
- if ( use_random_objects ) {
- SGMaterial *mat = matlib->find( tri_materials[ind] );
- if ( mat == NULL ) {
- SG_LOG( SG_INPUT, SG_ALERT,
- "Unknown material for random surface objects = "
- << tri_materials[ind] );
- } else {
- gen_random_surface_objects( leaf, random_object_branch,
- center, mat );
- }
- }
- local_terrain->addKid( leaf );
- } else if ( leaf.type == GL_TRIANGLE_STRIP ) {
- ssgLeaf *leaf = sgMakeLeaf( path, GL_TRIANGLE_STRIP,
- matlib, strip_materials[ind],
- nodes, normals, texcoords,
- strips_v[ind], strips_n[ind], strips_tc[ind],
- is_base, ground_lights );
-
- if ( use_random_objects ) {
- SGMaterial *mat = matlib->find( strip_materials[ind] );
- if ( mat == NULL ) {
- SG_LOG( SG_INPUT, SG_ALERT,
- "Unknown material for random surface objects = "
- << strip_materials[ind] );
- } else {
- gen_random_surface_objects( leaf, random_object_branch,
- center, mat );
- }
- }
- local_terrain->addKid( leaf );
- } else {
- ssgLeaf *leaf = sgMakeLeaf( path, GL_TRIANGLE_FAN,
- matlib, fan_materials[ind],
- nodes, normals, texcoords,
- fans_v[ind], fans_n[ind], fans_tc[ind],
- is_base, ground_lights );
- if ( use_random_objects ) {
- SGMaterial *mat = matlib->find( fan_materials[ind] );
- if ( mat == NULL ) {
- SG_LOG( SG_INPUT, SG_ALERT,
- "Unknown material for random surface objects = "
- << fan_materials[ind] );
- } else {
- gen_random_surface_objects( leaf, random_object_branch,
- center, mat );
- }
- }
- local_terrain->addKid( leaf );
- }
- ++li;
- }
- ++lmi;