X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fmisc%2Ftexcoord.cxx;h=3c9f762e89905bf264cad879d495a695126b7d6f;hb=3b3baa996b2485855534f08b68c52f3a40149598;hp=52cd16eeb4b9621f1fe17079055574a8b0310028;hpb=fb0916be0f3c8aad1a3810431a3b53105a905236;p=simgear.git diff --git a/simgear/misc/texcoord.cxx b/simgear/misc/texcoord.cxx index 52cd16ee..3c9f762e 100644 --- a/simgear/misc/texcoord.cxx +++ b/simgear/misc/texcoord.cxx @@ -140,8 +140,15 @@ enter this in the official comments in case I forget again. :-) */ +#include + +// #include STL_IOSTREAM + #include "texcoord.hxx" +// SG_USING_STD(cout); +// SG_USING_STD(endl); + #define FG_STANDARD_TEXTURE_DIMENSION 1000.0 // meters #define MAX_TEX_COORD 8.0 @@ -149,13 +156,14 @@ enter this in the official comments in case I forget again. :-) // return the basic unshifted/unmoded texture coordinate for a lat/lon -inline Point3D basic_tex_coord( const Point3D& p, - double degree_width, double degree_height, - double scale ) +static inline Point3D basic_tex_coord( const Point3D& p, + double degree_width, + double degree_height, + double scale ) { return Point3D( p.x() * ( degree_width * scale / FG_STANDARD_TEXTURE_DIMENSION ), - p.y() * ( degree_width * scale / + p.y() * ( degree_height * scale / FG_STANDARD_TEXTURE_DIMENSION ), 0.0 ); } @@ -163,7 +171,7 @@ inline Point3D basic_tex_coord( const Point3D& p, // traverse the specified fan/strip/list of vertices and attempt to // calculate "none stretching" texture coordinates -point_list calc_tex_coords( const FGBucket& b, const point_list& geod_nodes, +point_list sgCalcTexCoords( const SGBucket& b, const point_list& geod_nodes, const int_list& fan, double scale ) { // cout << "calculating texture coordinates for a specific fan of size = " @@ -178,10 +186,10 @@ point_list calc_tex_coords( const FGBucket& b, const point_list& geod_nodes, clat = (int)clat - 0.5; } - double clat_rad = clat * DEG_TO_RAD; + double clat_rad = clat * SGD_DEGREES_TO_RADIANS; double cos_lat = cos( clat_rad ); - double local_radius = cos_lat * EQUATORIAL_RADIUS_M; - double local_perimeter = 2.0 * local_radius * FG_PI; + double local_radius = cos_lat * SG_EQUATORIAL_RADIUS_M; + double local_perimeter = 2.0 * local_radius * SGD_PI; double degree_width = local_perimeter / 360.0; // cout << "clat = " << clat << endl; @@ -191,7 +199,7 @@ point_list calc_tex_coords( const FGBucket& b, const point_list& geod_nodes, // cout << "local_perimeter = " << local_perimeter << endl; // cout << "degree_width = " << degree_width << endl; - double perimeter = 2.0 * EQUATORIAL_RADIUS_M * FG_PI; + double perimeter = 2.0 * SG_EQUATORIAL_RADIUS_M * SGD_PI; double degree_height = perimeter / 360.0; // cout << "degree_height = " << degree_height << endl; @@ -323,10 +331,10 @@ point_list calc_tex_coords( const FGBucket& b, const point_list& geod_nodes, // cout << "adjusted_t " << adjusted_t << endl; } #endif - if ( adjusted_t.x() < FG_EPSILON ) { + if ( adjusted_t.x() < SG_EPSILON ) { adjusted_t.setx( 0.0 ); } - if ( adjusted_t.y() < FG_EPSILON ) { + if ( adjusted_t.y() < SG_EPSILON ) { adjusted_t.sety( 0.0 ); } adjusted_t.setz( 0.0 );