]> git.mxchange.org Git - flightgear.git/commitdiff
Point3D tweaks.
authorcurt <curt>
Sun, 18 Oct 1998 01:17:16 +0000 (01:17 +0000)
committercurt <curt>
Sun, 18 Oct 1998 01:17:16 +0000 (01:17 +0000)
Airports/genapt.cxx
Main/fg_init.cxx
Main/views.cxx
Objects/fragment.cxx
Objects/obj.cxx
Scenery/tilemgr.cxx
Time/sunpos.cxx

index 4d62bcf23c4f6dd226e7a6ee5b96b0b8f5a96f69..3ed91daff0f8a99f552d3b5a12700a526871a8da 100644 (file)
@@ -64,40 +64,12 @@ static double calc_dist(const Point3D& p1, const Point3D& p2) {
 
 #define FG_APT_BASE_TEX_CONSTANT 2000.0
 
-#ifdef OLD_TEX_COORDS
-// Calculate texture coordinates for a given point.
-static fgPoint3d
-calc_tex_coords(const fgPoint3d& p) {
-    fgPoint3d tex;
-
-    cout << "Texture coordinates = " << 
-       FG_APT_BASE_TEX_CONSTANT * p.lon << "  " << 
-       FG_APT_BASE_TEX_CONSTANT * p.lat << "\n";
-
-    tex.x = fmod(FG_APT_BASE_TEX_CONSTANT * p.lon, 10.0);
-    tex.y = fmod(FG_APT_BASE_TEX_CONSTANT * p.lat, 10.0);
-
-    if ( tex.x < 0.0 ) {
-       tex.x += 10.0;
-    }
-
-    if ( tex.y < 0.0 ) {
-       tex.y += 10.0;
-    }
-
-    cout << "Texture coordinates = " << tex.x << "  " << tex.y << "\n";
-
-    return tex;
-}
-#endif
-
-
 // Calculate texture coordinates for a given point.
 static Point3D calc_tex_coords(double *node, const Point3D& ref) {
     Point3D cp;
     Point3D pp;
 
-    cp.setvals( node[0] + ref.x(), node[1] + ref.y(), node[2] + ref.z() );
+    cp = Point3D( node[0] + ref.x(), node[1] + ref.y(), node[2] + ref.z() );
 
     pp = fgCartToPolar3d(cp);
 
@@ -310,9 +282,9 @@ fgAptGenerate(const string& path, fgTILE *tile)
        // we have just finished reading and airport record.
        // process the info
        size = perimeter.size();
-       average.setvals( avex / (double)size + tile->center.x(),
-                        avey / (double)size + tile->center.y(),
-                        avez / (double)size + tile->center.z() );
+       average = Point3D( avex / (double)size + tile->center.x(),
+                          avey / (double)size + tile->center.y(),
+                          avez / (double)size + tile->center.z() );
 
        gen_base(average, perimeter, tile);
     }
@@ -322,6 +294,9 @@ fgAptGenerate(const string& path, fgTILE *tile)
 
 
 // $Log$
+// Revision 1.6  1998/10/18 01:17:16  curt
+// Point3D tweaks.
+//
 // Revision 1.5  1998/10/16 23:27:14  curt
 // C++-ifying.
 //
index 8d3bd73039660d5b89e7f33282c05aaab0944a9c..9ef8d815480e6e761a43799e04d6b88975667868 100644 (file)
@@ -199,7 +199,7 @@ int fgInitSubsystems( void )
     // the center of the earth and our view position.  Doesn't have to
     // be the exact elevation (this is good because we don't know it
     // yet :-)
-    geod_pos.setvals( FG_Longitude, FG_Latitude, 0.0);
+    geod_pos = Point3D( FG_Longitude, FG_Latitude, 0.0);
     abs_view_pos = fgGeodToCart(geod_pos);
 
     // Calculate ground elevation at starting point
@@ -362,6 +362,9 @@ int fgInitSubsystems( void )
 
 
 // $Log$
+// Revision 1.44  1998/10/18 01:17:17  curt
+// Point3D tweaks.
+//
 // Revision 1.43  1998/10/17 01:34:22  curt
 // C++ ifying ...
 //
index b806fdc69e80416f5c1776a290bd222370aa041f..db33feb76ca3cbba6737562e008391e0032a8e77 100644 (file)
@@ -268,10 +268,9 @@ void fgVIEW::UpdateViewMath( fgFLIGHT *f ) {
     //        scenery.center.y, scenery.center.z);
 
     // calculate the cartesion coords of the current lat/lon/0 elev
-    p.setvals(
-             FG_Longitude, 
-             FG_Lat_geocentric, 
-             FG_Sea_level_radius * FEET_TO_METER );
+    p = Point3D( FG_Longitude, 
+                FG_Lat_geocentric, 
+                FG_Sea_level_radius * FEET_TO_METER );
 
     cur_zero_elev = fgPolarToCart3d(p) - scenery.center;
 
@@ -585,6 +584,9 @@ fgVIEW::~fgVIEW( void ) {
 
 
 // $Log$
+// Revision 1.24  1998/10/18 01:17:19  curt
+// Point3D tweaks.
+//
 // Revision 1.23  1998/10/17 01:34:26  curt
 // C++ ifying ...
 //
index aff61494b4d5dcdd59ec762b969b608de8fceeed..2466dfd7690264775f6be7944f764b2f7174f2db 100644 (file)
@@ -202,7 +202,7 @@ int fgFRAGMENT::intersect( const Point3D& end0,
                // everything is too close together to tell the difference
                // so the current intersection point should work as good
                // as any
-               result.setvals(x, y, z);
+               result = Point3D(x, y, z);
                return(1);
            }
            side1 = FG_SIGN (t1 - t2);
@@ -282,7 +282,7 @@ int fgFRAGMENT::intersect( const Point3D& end0,
        } else {
            // all dimensions are really small so lets call it close
            // enough and return a successful match
-           result.setvals(x, y, z);
+           result = Point3D(x, y, z);
            return(1);
        }
 
@@ -314,7 +314,7 @@ int fgFRAGMENT::intersect( const Point3D& end0,
        }
 
        // printf( "intersection point = %.2f %.2f %.2f\n", x, y, z);
-       result.setvals(x, y, z);
+       result = Point3D(x, y, z);
        return(1);
     }
 
@@ -324,6 +324,9 @@ int fgFRAGMENT::intersect( const Point3D& end0,
 }
 
 // $Log$
+// Revision 1.6  1998/10/18 01:17:20  curt
+// Point3D tweaks.
+//
 // Revision 1.5  1998/10/16 00:54:37  curt
 // Converted to Point3D class.
 //
index 2f997f9cefed24881f1db1bc9451c9fbdbabbc19..7818a8c07d1f0f3ff660a77af10fb291de509c80 100644 (file)
@@ -85,29 +85,31 @@ static void calc_normal(double p1[3], double p2[3],
 }
 
 
-#define FG_TEX_CONSTANT 128.0
+#define FG_TEX_CONSTANT 8.0
 
 
 // Calculate texture coordinates for a given point.
-Point3D calc_tex_coords(double *node, const Point3D& ref) {
+static Point3D calc_tex_coords(double *node, const Point3D& ref) {
     Point3D cp;
     Point3D pp;
 
-    cp.setvals( node[0] + ref.x(),
-               node[1] + ref.y(),
-               node[2] + ref.z() );
+    cp = Point3D( node[0] + ref.x(),
+                 node[1] + ref.y(),
+                 node[2] + ref.z() );
 
     pp = fgCartToPolar3d(cp);
 
-    pp.setx( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.x(), 25.0) );
-    pp.sety( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.y(), 25.0) );
+    cout << pp << endl;
+
+    pp.setx( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.x(), 1.0) );
+    pp.sety( fmod(RAD_TO_DEG * FG_TEX_CONSTANT * pp.y(), 1.0) );
 
     if ( pp.x() < 0.0 ) {
-       pp.setx( pp.x() + 25.0 );
+       pp.setx( pp.x() + 1.0 );
     }
 
     if ( pp.y() < 0.0 ) {
-       pp.sety( pp.y() + 25.0 );
+       pp.sety( pp.y() + 1.0 );
     }
 
     return(pp);
@@ -547,6 +549,9 @@ int fgObjLoad( const string& path, fgTILE *t) {
 
 
 // $Log$
+// Revision 1.6  1998/10/18 01:17:21  curt
+// Point3D tweaks.
+//
 // Revision 1.5  1998/10/16 00:54:39  curt
 // Converted to Point3D class.
 //
index 09e81d18f1b4886e27c18c94d09073f1ebe245e0..a52695abb4473aafdabc860db569074361f46288 100644 (file)
@@ -434,7 +434,7 @@ double fgTileMgrCurElev( double lon, double lat, const Point3D& abs_view_pos ) {
 
     scenery.next_center = t->center;
     
-    earth_center.setvals(0.0, 0.0, 0.0);
+    earth_center = Point3D(0.0, 0.0, 0.0);
 
     fgPrintf( FG_TERRAIN, FG_DEBUG, 
              "Pos = (%.2f, %.2f) Current bucket = %d %d %d %d  Index = %ld\n", 
@@ -633,6 +633,9 @@ void fgTileMgrRender( void ) {
 
 
 // $Log$
+// Revision 1.41  1998/10/18 01:17:23  curt
+// Point3D tweaks.
+//
 // Revision 1.40  1998/10/17 01:34:28  curt
 // C++ ifying ...
 //
index cf0b54eefe3e679169dfabb26f3eaae43c28150f..37c47aab73a5d6bea0e52e981bc3de70b0859228 100644 (file)
@@ -346,7 +346,7 @@ void fgUpdateSunPos( void ) {
 
     fgGeodToGeoc(sun_gd_lat, 0.0, &sl_radius, &l->sun_gc_lat);
 
-    p.setvals( l->sun_lon, l->sun_gc_lat, sl_radius );
+    p = Point3D( l->sun_lon, l->sun_gc_lat, sl_radius );
     l->fg_sunpos = fgPolarToCart3d(p);
 
     printf( "    t->cur_time = %ld\n", t->cur_time);
@@ -423,6 +423,9 @@ void fgUpdateSunPos( void ) {
 
 
 // $Log$
+// Revision 1.15  1998/10/18 01:17:24  curt
+// Point3D tweaks.
+//
 // Revision 1.14  1998/10/17 01:34:32  curt
 // C++ ifying ...
 //