More work on photo inserter.
This commit is contained in:
parent
b452149e06
commit
472ac57338
4 changed files with 45 additions and 11 deletions
|
@ -1060,14 +1060,17 @@ int main(int argc, char **argv) {
|
||||||
struct rlimit limit;
|
struct rlimit limit;
|
||||||
limit.rlim_cur = 20000000;
|
limit.rlim_cur = 20000000;
|
||||||
limit.rlim_max = 20000000;
|
limit.rlim_max = 20000000;
|
||||||
|
|
||||||
result = setrlimit( RLIMIT_DATA, &limit );
|
result = setrlimit( RLIMIT_DATA, &limit );
|
||||||
cout << "result of setting mem limit = " << result << endl;
|
cout << "result of setting mem limit = " << result << endl;
|
||||||
result = setrlimit( RLIMIT_STACK, &limit );
|
result = setrlimit( RLIMIT_STACK, &limit );
|
||||||
cout << "result of setting mem limit = " << result << endl;
|
cout << "result of setting mem limit = " << result << endl;
|
||||||
result = setrlimit( RLIMIT_CORE, &limit );
|
result = setrlimit( RLIMIT_CORE, &limit );
|
||||||
cout << "result of setting mem limit = " << result << endl;
|
cout << "result of setting mem limit = " << result << endl;
|
||||||
|
#if 0
|
||||||
result = setrlimit( RLIMIT_RSS, &limit );
|
result = setrlimit( RLIMIT_RSS, &limit );
|
||||||
cout << "result of setting mem limit = " << result << endl;
|
cout << "result of setting mem limit = " << result << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
// cpu time limit since occassionally the triangulator can go into
|
// cpu time limit since occassionally the triangulator can go into
|
||||||
// an infinite loop.
|
// an infinite loop.
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
|
|
||||||
#include <simgear/math/sg_types.hxx>
|
#include <simgear/math/sg_types.hxx>
|
||||||
|
|
||||||
|
#include <Polygon/polygon.hxx>
|
||||||
|
|
||||||
|
|
||||||
void write_polygon( const FGPolygon& poly, const string& base );
|
void write_polygon( const FGPolygon& poly, const string& base );
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ photo_LDADD = \
|
||||||
$(top_builddir)/src/Lib/Polygon/libPolygon.a \
|
$(top_builddir)/src/Lib/Polygon/libPolygon.a \
|
||||||
$(top_builddir)/src/Lib/poly2tri/libpoly2tri.a \
|
$(top_builddir)/src/Lib/poly2tri/libpoly2tri.a \
|
||||||
$(top_builddir)/src/Lib/Geometry/libGeometry.a \
|
$(top_builddir)/src/Lib/Geometry/libGeometry.a \
|
||||||
|
$(top_builddir)/src/Lib/Output/libOutput.a \
|
||||||
$(top_builddir)/src/Lib/TriangleJRS/libTriangleJRS.a \
|
$(top_builddir)/src/Lib/TriangleJRS/libTriangleJRS.a \
|
||||||
-lsgbucket -lsgdebug -lsgio -lsgmath -lsgmisc -lz -lgpc \
|
-lsgbucket -lsgdebug -lsgio -lsgmath -lsgmisc -lz -lgpc \
|
||||||
$(base_LIBS)
|
$(base_LIBS)
|
||||||
|
|
|
@ -35,12 +35,16 @@
|
||||||
|
|
||||||
#include <Array/array.hxx>
|
#include <Array/array.hxx>
|
||||||
#include <Geometry/trinodes.hxx>
|
#include <Geometry/trinodes.hxx>
|
||||||
|
#include <Output/output.hxx>
|
||||||
|
#include <Polygon/index.hxx>
|
||||||
|
#include <Polygon/split.hxx>
|
||||||
|
#include <Polygon/polygon.hxx>
|
||||||
|
|
||||||
SG_USING_STD(string);
|
SG_USING_STD(string);
|
||||||
|
|
||||||
|
|
||||||
const int MAX_XDIV = 32;
|
const int MAX_XDIV = 16;
|
||||||
const int MAX_YDIV = 32;
|
const int MAX_YDIV = 16;
|
||||||
|
|
||||||
|
|
||||||
// fix node elevations
|
// fix node elevations
|
||||||
|
@ -121,7 +125,7 @@ int main( int argc, char **argv ) {
|
||||||
if ( argc != 13 ) {
|
if ( argc != 13 ) {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
"Usage " << argv[0]
|
"Usage " << argv[0]
|
||||||
<< " root <image>.png xdiv ydiv x0 y0 x1 y1 x2 y2 x3 y3" );
|
<< " root image(base) xdiv ydiv x0 y0 x1 y1 x2 y2 x3 y3" );
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +136,7 @@ int main( int argc, char **argv ) {
|
||||||
int ydiv = atoi( argv[4] );
|
int ydiv = atoi( argv[4] );
|
||||||
if ( xdiv > MAX_XDIV || xdiv < 1 || ydiv > MAX_YDIV || ydiv < 1 ) {
|
if ( xdiv > MAX_XDIV || xdiv < 1 || ydiv > MAX_YDIV || ydiv < 1 ) {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
"{x,y}div must be in the range of 1 - 32" );
|
"{x,y}div must be in the range of 1 - " << MAX_XDIV );
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,11 +214,12 @@ int main( int argc, char **argv ) {
|
||||||
strip_tc.push_back( 2 );
|
strip_tc.push_back( 2 );
|
||||||
|
|
||||||
char bufx[5], bufy[5];
|
char bufx[5], bufy[5];
|
||||||
snprintf( bufx, 5, "%02d", i );
|
snprintf( bufx, 5, "%X", i );
|
||||||
snprintf( bufy, 5, "%02d", j );
|
snprintf( bufy, 5, "%X", j );
|
||||||
string material = bufx;
|
string material = image;
|
||||||
|
material += bufx;
|
||||||
material += bufy;
|
material += bufy;
|
||||||
material += image;
|
material += ".png";
|
||||||
|
|
||||||
strips_v.push_back( strip_v );
|
strips_v.push_back( strip_v );
|
||||||
strips_tc.push_back( strip_tc );
|
strips_tc.push_back( strip_tc );
|
||||||
|
@ -236,9 +241,11 @@ int main( int argc, char **argv ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// bounding sphere
|
// bounding sphere
|
||||||
Point3D center_geod = Point3D( (x0 + x2) / 2 * SGD_DEGREES_TO_RADIANS,
|
Point3D center_geod = Point3D( ((x0 + x2) / 2) * SGD_DEGREES_TO_RADIANS,
|
||||||
(y0 + y2) / 2 * SGD_DEGREES_TO_RADIANS, 0 );
|
((y0 + y2) / 2) * SGD_DEGREES_TO_RADIANS,
|
||||||
|
0 );
|
||||||
Point3D gbs_center = sgGeodToCart( center_geod );
|
Point3D gbs_center = sgGeodToCart( center_geod );
|
||||||
|
cout << "gbs center = " << gbs_center << endl;
|
||||||
float gbs_radius = sgCalcBoundingRadius( gbs_center, wgs84_nodes );
|
float gbs_radius = sgCalcBoundingRadius( gbs_center, wgs84_nodes );
|
||||||
|
|
||||||
// normals
|
// normals
|
||||||
|
@ -264,6 +271,7 @@ int main( int argc, char **argv ) {
|
||||||
string_list fan_materials; fan_materials.clear();
|
string_list fan_materials; fan_materials.clear();
|
||||||
|
|
||||||
obj.set_gbs_center( gbs_center );
|
obj.set_gbs_center( gbs_center );
|
||||||
|
cout << "gbs center = " << gbs_center << endl;
|
||||||
obj.set_gbs_radius( gbs_radius );
|
obj.set_gbs_radius( gbs_radius );
|
||||||
obj.set_wgs84_nodes( wgs84_nodes );
|
obj.set_wgs84_nodes( wgs84_nodes );
|
||||||
obj.set_normals( normals );
|
obj.set_normals( normals );
|
||||||
|
@ -281,7 +289,8 @@ int main( int argc, char **argv ) {
|
||||||
// write the object
|
// write the object
|
||||||
string objpath = root + "/PhotoObj";
|
string objpath = root + "/PhotoObj";
|
||||||
string name = image;
|
string name = image;
|
||||||
SGBucket b( center_geod.x(), center_geod.y() );
|
SGBucket b( center_geod.x() * SGD_RADIANS_TO_DEGREES,
|
||||||
|
center_geod.y() * SGD_RADIANS_TO_DEGREES);
|
||||||
|
|
||||||
bool result = obj.write_bin( objpath, name, b );
|
bool result = obj.write_bin( objpath, name, b );
|
||||||
if ( !result ) {
|
if ( !result ) {
|
||||||
|
@ -289,5 +298,24 @@ int main( int argc, char **argv ) {
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// write the index entry
|
||||||
|
write_index( objpath, b, name );
|
||||||
|
|
||||||
|
// write the 'hole' polygon
|
||||||
|
FGPolygon hole; hole.erase();
|
||||||
|
Point3D p;
|
||||||
|
|
||||||
|
p = Point3D( x0, y0, 0 ); hole.add_node( 0, p );
|
||||||
|
p = Point3D( x1, y1, 0 ); hole.add_node( 0, p );
|
||||||
|
p = Point3D( x2, y2, 0 ); hole.add_node( 0, p );
|
||||||
|
p = Point3D( x3, y3, 0 ); hole.add_node( 0, p );
|
||||||
|
|
||||||
|
// initialize persistant polygon counter
|
||||||
|
string counter_file = root + "/poly_counter";
|
||||||
|
poly_index_init( counter_file );
|
||||||
|
|
||||||
|
string holepath = root + "/PhotoArea";
|
||||||
|
split_polygon( holepath, HoleArea, hole );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue