Added a flag to protect Shared directory. Useful for rebuilding part of the scenery to fit with the rest.
This commit is contained in:
parent
2f87423796
commit
d72116c6ab
4 changed files with 30 additions and 3 deletions
|
@ -69,6 +69,10 @@ private:
|
||||||
// with the UK grid
|
// with the UK grid
|
||||||
bool useUKGrid;
|
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
|
// detail level constraints
|
||||||
int min_nodes;
|
int min_nodes;
|
||||||
int max_nodes;
|
int max_nodes;
|
||||||
|
@ -130,6 +134,10 @@ public:
|
||||||
inline bool get_useUKGrid() const { return useUKGrid; }
|
inline bool get_useUKGrid() const { return useUKGrid; }
|
||||||
inline void set_useUKGrid( const bool b ) { useUKGrid = b; }
|
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
|
// detail level constraints
|
||||||
inline int get_min_nodes() const { return min_nodes; }
|
inline int get_min_nodes() const { return min_nodes; }
|
||||||
inline void set_min_nodes( const int n ) { min_nodes = n; }
|
inline void set_min_nodes( const int n ) { min_nodes = n; }
|
||||||
|
|
|
@ -951,7 +951,7 @@ static void do_custom_objects( const TGConstruct& c ) {
|
||||||
char name[256];
|
char name[256];
|
||||||
|
|
||||||
for ( int i = 0; i < (int)load_dirs.size(); ++i ) {
|
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";
|
string index_file = base_dir + "/" + b.gen_index_str() + ".ind";
|
||||||
cout << "collecting custom objects from " << index_file << endl;
|
cout << "collecting custom objects from " << index_file << endl;
|
||||||
|
|
||||||
|
@ -1038,7 +1038,9 @@ static void construct_tile( TGConstruct& c ) {
|
||||||
TGMatch m;
|
TGMatch m;
|
||||||
m.load_neighbor_shared( c );
|
m.load_neighbor_shared( c );
|
||||||
m.split_tile( c );
|
m.split_tile( c );
|
||||||
|
if ( c.get_write_shared_edges() ) {
|
||||||
m.write_shared( c );
|
m.write_shared( c );
|
||||||
|
}
|
||||||
m.assemble_tile( c );
|
m.assemble_tile( c );
|
||||||
|
|
||||||
// now we must retriangulate the pasted together tile points
|
// now we must retriangulate the pasted together tile points
|
||||||
|
@ -1099,6 +1101,7 @@ static void usage( const string name ) {
|
||||||
cout << " --ydist=<degrees>" << endl;
|
cout << " --ydist=<degrees>" << endl;
|
||||||
cout << " --nudge=<float>" << endl;
|
cout << " --nudge=<float>" << endl;
|
||||||
cout << " --useUKgrid" << endl;
|
cout << " --useUKgrid" << endl;
|
||||||
|
cout << " --no-write-shared-edges" << endl;
|
||||||
cout << " ] <load directory...>" << endl;
|
cout << " ] <load directory...>" << endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
@ -1118,6 +1121,10 @@ int main(int argc, char **argv) {
|
||||||
// texture coordinate generation
|
// texture coordinate generation
|
||||||
bool useUKgrid = false;
|
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 );
|
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1147,6 +1154,8 @@ int main(int argc, char **argv) {
|
||||||
cover = arg.substr(8);
|
cover = arg.substr(8);
|
||||||
} else if (arg.find("--useUKgrid") == 0) {
|
} 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) {
|
} else if (arg.find("--") == 0) {
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1209,6 +1218,7 @@ int main(int argc, char **argv) {
|
||||||
c.set_work_base( work_dir );
|
c.set_work_base( work_dir );
|
||||||
c.set_output_base( output_dir );
|
c.set_output_base( output_dir );
|
||||||
c.set_useUKGrid( useUKgrid );
|
c.set_useUKGrid( useUKgrid );
|
||||||
|
c.set_write_shared_edges( writeSharedEdges );
|
||||||
|
|
||||||
c.set_min_nodes( 50 );
|
c.set_min_nodes( 50 );
|
||||||
c.set_max_nodes( (int)(TG_MAX_NODES * 0.8) );
|
c.set_max_nodes( (int)(TG_MAX_NODES * 0.8) );
|
||||||
|
|
|
@ -486,6 +486,13 @@ void TGMatch::write_shared( TGConstruct& c ) {
|
||||||
exit(-1);
|
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 ) {
|
if ( ! sw_flag ) {
|
||||||
fprintf( fp, "sw_node %.6f %.6f %.6f\n",
|
fprintf( fp, "sw_node %.6f %.6f %.6f\n",
|
||||||
sw_node.x(), sw_node.y(), sw_node.z() );
|
sw_node.x(), sw_node.y(), sw_node.z() );
|
||||||
|
|
|
@ -52,6 +52,8 @@ private:
|
||||||
point_list body_normals;
|
point_list body_normals;
|
||||||
|
|
||||||
// flags
|
// 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 sw_flag, se_flag, ne_flag, nw_flag;
|
||||||
bool north_flag, south_flag, east_flag, west_flag;
|
bool north_flag, south_flag, east_flag, west_flag;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue