diff --git a/src/BuildTiles/Main/construct.hxx b/src/BuildTiles/Main/construct.hxx index 3defb05b..2c9ce99b 100644 --- a/src/BuildTiles/Main/construct.hxx +++ b/src/BuildTiles/Main/construct.hxx @@ -69,6 +69,10 @@ private: // with the UK grid bool useUKGrid; + // flag indicating whether this is a rebuild and Shared edge + // data should only be used for fitting, but not rewritten + bool writeSharedEdges; + // detail level constraints int min_nodes; int max_nodes; @@ -129,6 +133,10 @@ public: // UK grid flag inline bool get_useUKGrid() const { return useUKGrid; } inline void set_useUKGrid( const bool b ) { useUKGrid = b; } + + // shared edge write flag + inline bool get_write_shared_edges() const { return writeSharedEdges; } + inline void set_write_shared_edges( const bool b ) { writeSharedEdges = b; } // detail level constraints inline int get_min_nodes() const { return min_nodes; } diff --git a/src/BuildTiles/Main/main.cxx b/src/BuildTiles/Main/main.cxx index f13dd6e6..d235bfbe 100644 --- a/src/BuildTiles/Main/main.cxx +++ b/src/BuildTiles/Main/main.cxx @@ -951,7 +951,7 @@ static void do_custom_objects( const TGConstruct& c ) { char name[256]; for ( int i = 0; i < (int)load_dirs.size(); ++i ) { - string base_dir = load_dirs[i] + "/" + b.gen_base_path(); + string base_dir = c.get_work_base() + "/" + load_dirs[i] + "/" + b.gen_base_path(); string index_file = base_dir + "/" + b.gen_index_str() + ".ind"; cout << "collecting custom objects from " << index_file << endl; @@ -1038,7 +1038,9 @@ static void construct_tile( TGConstruct& c ) { TGMatch m; m.load_neighbor_shared( c ); m.split_tile( c ); - m.write_shared( c ); + if ( c.get_write_shared_edges() ) { + m.write_shared( c ); + } m.assemble_tile( c ); // now we must retriangulate the pasted together tile points @@ -1099,6 +1101,7 @@ static void usage( const string name ) { cout << " --ydist=" << endl; cout << " --nudge=" << endl; cout << " --useUKgrid" << endl; + cout << " --no-write-shared-edges" << endl; cout << " ] " << endl; exit(-1); } @@ -1118,6 +1121,10 @@ int main(int argc, char **argv) { // texture coordinate generation bool useUKgrid = false; + // flag indicating whether this is a rebuild and Shared edge + // data should only be used for fitting, but not rewritten + bool writeSharedEdges = true; + sglog().setLogLevels( SG_ALL, SG_DEBUG ); // @@ -1146,7 +1153,9 @@ int main(int argc, char **argv) { } else if (arg.find("--cover=") == 0) { cover = arg.substr(8); } else if (arg.find("--useUKgrid") == 0) { - useUKgrid = true; + useUKgrid = true; + } else if (arg.find("--no-write-shared-edges") == 0) { + writeSharedEdges = false; } else if (arg.find("--") == 0) { usage(argv[0]); } else { @@ -1209,6 +1218,7 @@ int main(int argc, char **argv) { c.set_work_base( work_dir ); c.set_output_base( output_dir ); c.set_useUKGrid( useUKgrid ); + c.set_write_shared_edges( writeSharedEdges ); c.set_min_nodes( 50 ); c.set_max_nodes( (int)(TG_MAX_NODES * 0.8) ); diff --git a/src/BuildTiles/Match/match.cxx b/src/BuildTiles/Match/match.cxx index df8d42f7..b4caa7c2 100644 --- a/src/BuildTiles/Match/match.cxx +++ b/src/BuildTiles/Match/match.cxx @@ -486,6 +486,13 @@ void TGMatch::write_shared( TGConstruct& c ) { exit(-1); } + /* + * We only write data out for those sides for which the adjacent + * tiles still have to be built. + * + * If we have already read data for a given corner or side, this + * means that the adjacent tile already has been built. + */ if ( ! sw_flag ) { fprintf( fp, "sw_node %.6f %.6f %.6f\n", sw_node.x(), sw_node.y(), sw_node.z() ); diff --git a/src/BuildTiles/Match/match.hxx b/src/BuildTiles/Match/match.hxx index 5beaed82..f76431c8 100644 --- a/src/BuildTiles/Match/match.hxx +++ b/src/BuildTiles/Match/match.hxx @@ -52,6 +52,8 @@ private: point_list body_normals; // flags + // a flag is set if and only if we have read data for the given + // corner or side bool sw_flag, se_flag, ne_flag, nw_flag; bool north_flag, south_flag, east_flag, west_flag;