+ // if first usemtl with shared_done = false, then set
+ // shared_done true and build the ssg shared lists
+ if ( ! shared_done ) {
+ // sanity check
+ if ( (int)nodes.size() != vncount ) {
+ FG_LOG( FG_TERRAIN, FG_ALERT,
+ "Tile has mismatched nodes and normals: "
+ << path );
+ // exit(-1);
+ }
+ shared_done = true;
+
+ t->vtlist = new sgVec3 [ nodes.size() ];
+ t->vnlist = new sgVec3 [ vncount ];
+ t->tclist = new sgVec2 [ vtcount ];
+
+ for ( i = 0; i < (int)nodes.size(); ++i ) {
+ sgSetVec3( t->vtlist[i],
+ nodes[i][0], nodes[i][1], nodes[i][2] );
+ }
+ for ( i = 0; i < vncount; ++i ) {
+ sgSetVec3( t->vnlist[i],
+ normals[i][0],
+ normals[i][1],
+ normals[i][2] );
+ }
+ for ( i = 0; i < vtcount; ++i ) {
+ sgSetVec2( t->tclist[i],
+ tex_coords[i][0], tex_coords[i][1] );
+ }