+ FGNewMat *newmat = material_lib.find( material );
+ if ( newmat == NULL ) {
+ // see if this is an on the fly texture
+ string file = path;
+ int pos = file.rfind( "/" );
+ file = file.substr( 0, pos );
+ cout << "current file = " << file << endl;
+ file += "/";
+ file += material;
+ cout << "current file = " << file << endl;
+ if ( ! material_lib.add_item( file ) ) {
+ SG_LOG( SG_TERRAIN, SG_ALERT,
+ "Ack! unknown usemtl name = " << material
+ << " in " << path );
+ } else {
+ // locate our newly created material
+ newmat = material_lib.find( material );
+ if ( newmat == NULL ) {
+ SG_LOG( SG_TERRAIN, SG_ALERT,
+ "Ack! bad on the fly material create = "
+ << material << " in " << path );
+ }
+ }
+ }
+
+ if ( newmat != NULL ) {
+ // set the texture width and height values for this
+ // material
+ tex_width = newmat->get_xsize();
+ tex_height = newmat->get_ysize();
+ state = newmat->get_state();
+ coverage = newmat->get_light_coverage();
+ // cout << "(w) = " << tex_width << " (h) = "
+ // << tex_width << endl;
+ } else {
+ coverage = -1;
+ }
+
+ // cout << "before list allocs" << endl;
+