Point3D tweaks.
This commit is contained in:
parent
5b752bfb5f
commit
7efee52485
7 changed files with 45 additions and 51 deletions
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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 ...
|
||||
//
|
||||
|
|
|
@ -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 ...
|
||||
//
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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 ...
|
||||
//
|
||||
|
|
|
@ -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 ...
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue