]> git.mxchange.org Git - flightgear.git/commitdiff
Modified Files:
authorfrohlich <frohlich>
Sat, 5 May 2007 08:08:24 +0000 (08:08 +0000)
committerfrohlich <frohlich>
Sat, 5 May 2007 08:08:24 +0000 (08:08 +0000)
src/AIModel/AIBase.cxx src/AIModel/AICarrier.cxx
src/ATC/AIEntity.cxx src/Cockpit/hud_rwy.cxx
  src/FDM/Makefile.am src/FDM/flight.hxx src/FDM/groundcache.cxx
src/Instrumentation/HUD/HUD_runway.cxx src/Main/Makefile.am
src/Main/fg_init.cxx src/Main/main.cxx src/Main/renderer.cxx
src/Main/viewer.cxx src/Main/viewer.hxx src/Model/acmodel.cxx
src/Model/modelmgr.cxx src/Scenery/scenery.cxx
src/Scenery/scenery.hxx src/Scenery/tileentry.cxx
src/Time/tmp.cxx: Remove the scenery center handling.
Osg has double valued transforms at any relevant place.

16 files changed:
src/AIModel/AIBase.cxx
src/AIModel/AICarrier.cxx
src/ATC/AIEntity.cxx
src/Cockpit/hud_rwy.cxx
src/FDM/groundcache.cxx
src/Instrumentation/HUD/HUD_runway.cxx
src/Main/main.cxx
src/Main/renderer.cxx
src/Main/viewer.cxx
src/Main/viewer.hxx
src/Model/acmodel.cxx
src/Model/modelmgr.cxx
src/Scenery/scenery.cxx
src/Scenery/scenery.hxx
src/Scenery/tileentry.cxx
src/Time/tmp.cxx

index 12214e4db6c10db0b516ad3f2ec2cc20da32c956..d837f569981ad237987ec19041a646357fc407cd 100644 (file)
@@ -76,7 +76,6 @@ FGAIBase::FGAIBase(object_type ot) :
 FGAIBase::~FGAIBase() {
     // Unregister that one at the scenery manager
     if (globals->get_scenery()) {
-        globals->get_scenery()->unregister_placement_transform(aip.getTransform());
         globals->get_scenery()->get_scene_graph()->removeChild(aip.getSceneGraph());
     }
 
@@ -174,8 +173,6 @@ bool FGAIBase::init(bool search_in_AI_path) {
      invisible = false;
      globals->get_scenery()->get_scene_graph()->addChild(aip.getSceneGraph());
 
-     // Register that one at the scenery manager
-     globals->get_scenery()->register_placement_transform(aip.getTransform());
      fgSetString("/ai/models/model-added", props->getPath());
    } else {
 
index 3a83c13fee7f7fe76487ff4afc995e7353cb3a13..d3fa369a17a1783ced6e51bee7a6ae2f831b56ec 100644 (file)
@@ -271,7 +271,7 @@ void FGAICarrier::update(double dt) {
     // For the flols reuse some computations done above ...
 
     // The position of the eyepoint - at least near that ...
-    SGVec3d eyePos(globals->get_current_view()->get_absolute_view_pos());
+    SGVec3d eyePos(globals->get_current_view()->get_view_pos());
     // Add the position offset of the AIModel to gain the earth
     // centered position
     SGVec3d eyeWrtCarrier = eyePos - cartPos;
index 7afbef1ba9c93be699d3e8a15bc705918bb96f07..41baf4a05eebb9c597cdb9222e161e5ec9974fea 100644 (file)
@@ -47,8 +47,6 @@ FGAIEntity::~FGAIEntity() {
        //cout << "FGAIEntity dtor called..." << endl;
        //cout << "Removing model from scene graph..." << endl;
        globals->get_scenery()->get_scene_graph()->removeChild(_aip.getSceneGraph());
-        // Unregister that one at the scenery manager
-        globals->get_scenery()->unregister_placement_transform(_aip.getTransform());
 
        //cout << "Done!" << endl;
 }
@@ -58,8 +56,6 @@ void FGAIEntity::SetModel(osg::Node* model) {
        _aip.init(_model.get());
        _aip.setVisible(false);
        globals->get_scenery()->get_scene_graph()->addChild(_aip.getSceneGraph());
-        // Register that one at the scenery manager
-        globals->get_scenery()->register_placement_transform(_aip.getTransform());
 
 }
 
index aac5e26e0ca29274626b70a935981fe894489fba..6b40e178fa419d2a556596fe6f2b01701eff7d59 100644 (file)
@@ -207,14 +207,6 @@ void runway_instr::get_rwy_points(sgdVec3 *points3d)
 
     geo_direct_wgs_84(alt, frontLat, frontLon, runway._heading + 90, width, &tempLat, &tempLon, &az);
     sgGeodToCart(tempLat * SG_DEGREES_TO_RADIANS, tempLon * SG_DEGREES_TO_RADIANS, alt, points3d[3]);
-
-    //Get the current tile center
-    SGVec3d tileCenter = globals->get_scenery()->get_center();
-    for (int i = 0; i < 6; i++) {
-        points3d[i][0] -= tileCenter.x();
-        points3d[i][1] -= tileCenter.y();
-        points3d[i][2] -= tileCenter.z();
-    }
 }
 
 
index 4424e5fdd65f68a80115a06529d7afe1e85e0517..2cedf7cc811da7f93abf4dfa5a60c1fe822ed19e 100644 (file)
@@ -145,12 +145,6 @@ public:
     mGroundProperty.pivot = SGVec3d(0, 0, 0);
   }
 
-  void setSceneryCenter(const SGVec3d& cntr)
-  {
-    mLocalToGlobal.makeTranslate(cntr.osg());
-    mGlobalToLocal.makeTranslate(-cntr.osg());
-  }
-
   void updateCullMode(osg::StateSet* stateSet)
   {
     if (!stateSet)
@@ -507,7 +501,6 @@ FGGroundCache::prepare_ground_cache(double ref_time, const SGVec3d& pt,
 
   // Walk the scene graph and extract solid ground triangles and carrier data.
   GroundCacheFillVisitor gcfv(this, down, pt, cacheRadius, wireCacheRadius);
-  gcfv.setSceneryCenter(globals->get_scenery()->get_center());
   globals->get_scenery()->get_scene_graph()->accept(gcfv);
 
   // some stats
index c2555eba94695e79ae8bb34acdb28951dab8a17e..10d2fd80735c0f5773b64776cf75085bae3c4af6 100644 (file)
@@ -199,14 +199,6 @@ void HUD::Runway::get_rwy_points(sgdVec3 *_points3d)
 
     geo_direct_wgs_84(alt, frontLat, frontLon, _runway._heading + 90, width, &tempLat, &tempLon, &az);
     sgGeodToCart(tempLat * SG_DEGREES_TO_RADIANS, tempLon * SG_DEGREES_TO_RADIANS, alt, _points3d[3]);
-
-    //Get the current tile center
-    SGVec3d tileCenter = globals->get_scenery()->get_center();
-    for (int i = 0; i < 6; i++) {
-        _points3d[i][0] -= tileCenter.x();
-        _points3d[i][1] -= tileCenter.y();
-        _points3d[i][2] -= tileCenter.z();
-    }
 }
 
 
index 2cd9514e04d246a8b99d5b55cc6c537066c61e9e..70a4e5966f4b6e90a322fc243f0bb6f442c8ba41 100644 (file)
@@ -513,26 +513,6 @@ static void fgMainLoop( void ) {
     //
     double visibility_meters = fgGetDouble("/environment/visibility-m");
     FGViewer *current_view = globals->get_current_view();
-    // Let the scenery center follow the current view position with
-    // 30m increments.
-    //
-    // Having the scenery center near the view position will eliminate
-    // jitter of objects which are placed very near the view position
-    // and haveing it's center near that view position.
-    // So the 3d insruments of the aircraft will not jitter with this.
-    // 
-    // Following the view position exactly would introduce jitter of
-    // the scenery tiles (they would be from their center up to 10000m
-    // to the view and this will introduce roundoff too). By stepping
-    // at 30m incements the roundoff error of the scenery tiles is
-    // still present, but we will make exactly the same roundoff error
-    // at each frame until the center is switched to a new
-    // position. This roundoff is still visible but you will most
-    // propably not notice.
-    double *vp = globals->get_current_view()->get_absolute_view_pos();
-    SGVec3d cntr(vp);
-    if (30.0*30.0 < distSqr(cntr, globals->get_scenery()->get_center()))
-      globals->get_scenery()->set_center( cntr );
 
     globals->get_tile_mgr()->prep_ssg_nodes( current_view->getSGLocation(),
                                              visibility_meters );
@@ -548,8 +528,7 @@ static void fgMainLoop( void ) {
         double ref_time, r;
         SGVec3d pt;
         bool valid = cur_fdm_state->is_valid_m(&ref_time, pt.sg(), &r);
-        double *vp = globals->get_current_view()->get_absolute_view_pos();
-        SGVec3d viewpos(vp);
+        SGVec3d viewpos(globals->get_current_view()->get_view_pos());
         if (valid && distSqr(viewpos, pt) < r*r) {
             // Reuse the cache ...
             double lev
@@ -630,10 +609,6 @@ static void fgIdleFunction ( void ) {
     if ( idle_state == 0 ) {
         idle_state++;
 
-#ifdef GL_EXT_texture_lod_bias
-        // negative values sharpen, positive values blur mipmapped textures
-        glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, -0.5 ) ;
-#endif
         // This seems to be the absolute earliest in the init sequence
         // that these calls will return valid info.  Too bad it's after
         // we've already created and sized our window. :-(
index 3ce641c0c8f849ff9a13722050b0f8a5cd33f040..ad13865fce8a6940f0331ba9a5355a89ad413bcb 100644 (file)
@@ -633,10 +633,9 @@ FGRenderer::update( bool refresh_camera_settings ) {
         resize( fgGetInt("/sim/startup/xsize"),
                 fgGetInt("/sim/startup/ysize") );
 
-        SGVec3d center = globals->get_scenery()->get_center();
         SGVec3d position = current__view->getViewPosition();
         SGQuatd attitude = current__view->getViewOrientation();
-        SGVec3d osgPosition = attitude.transform(center - position);
+        SGVec3d osgPosition = attitude.transform(-position);
         mCameraView->setPosition(osgPosition.osg());
         mCameraView->setAttitude(inverse(attitude).osg());
     }
@@ -678,8 +677,8 @@ FGRenderer::update( bool refresh_camera_settings ) {
 
         static SGSkyState sstate;
 
-        sstate.view_pos  = current__view->get_view_pos();
-        sstate.zero_elev = current__view->get_zero_elev();
+        sstate.view_pos  = toVec3f(current__view->get_view_pos());
+        sstate.zero_elev = toVec3f(current__view->get_zero_elev());
         sstate.view_up   = current__view->get_world_up();
         sstate.lon       = current__view->getLongitude_deg()
                             * SGD_DEGREES_TO_RADIANS;
@@ -823,7 +822,7 @@ FGRenderer::update( bool refresh_camera_settings ) {
     mFrameStamp->setCalendarTime(*globals->get_time_params()->getGmt());
     mUpdateVisitor->setViewData(current__view->getViewPosition(),
                                 current__view->getViewOrientation());
-    mUpdateVisitor->setSceneryCenter(globals->get_scenery()->get_center());
+    mUpdateVisitor->setSceneryCenter(SGVec3d(0, 0, 0));
     SGVec3f direction(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2]);
     mUpdateVisitor->setLight(direction, l->scene_ambient(),
                              l->scene_diffuse(), l->scene_specular());
@@ -1014,9 +1013,6 @@ FGRenderer::pick( unsigned x, unsigned y,
   if (!viewport)
     return false;
 
-  // good old scenery center
-  SGVec3d center = globals->get_scenery()->get_center();
-
   // don't know why, but the update has partly happened somehow,
   // so update the scenery part of the viewer
   FGViewer *current_view = globals->get_current_view();
@@ -1024,7 +1020,7 @@ FGRenderer::pick( unsigned x, unsigned y,
   current_view->set_dirty();
   SGVec3d position = current_view->getViewPosition();
   SGQuatd attitude = current_view->getViewOrientation();
-  SGVec3d osgPosition = attitude.transform(center - position);
+  SGVec3d osgPosition = attitude.transform(-position);
   mCameraView->setPosition(osgPosition.osg());
   mCameraView->setAttitude(inverse(attitude).osg());
 
@@ -1075,7 +1071,6 @@ FGRenderer::pick( unsigned x, unsigned y,
             sceneryPick.info.wgs84 = SGVec3d(localPt*(*hi->getMatrix()));
           else
             sceneryPick.info.wgs84 = SGVec3d(localPt);
-          sceneryPick.info.wgs84 += globals->get_scenery()->get_center();
           sceneryPick.callback = pickCallback;
           pickList.push_back(sceneryPick);
         }
index f91cb7f5b5582b24459593ac7904ed035b4bd3cf..9cd807da0b267006addcf5e62053b80e5eca7c98 100644 (file)
@@ -402,14 +402,6 @@ FGViewer::setOrientationOffsets (double roll_offset_deg, double pitch_offset_deg
   _heading_offset_deg = heading_offset_deg;
 }
 
-double *
-FGViewer::get_absolute_view_pos () 
-{
-  if (_dirty)
-    recalc();
-  return _absolute_view_pos.data();
-}
-
 // recalc() is done every time one of the setters is called (making the 
 // cached data "dirty") on the next "get".  It calculates all the outputs 
 // for viewer.
@@ -422,12 +414,9 @@ FGViewer::recalc ()
     recalcLookAt();
   }
 
-  SGVec3d center = globals->get_scenery()->get_center();
-  _view_pos = toVec3f(_absolute_view_pos - center);
-
   SGGeod geodEyePoint = SGGeod::fromCart(_absolute_view_pos);
   geodEyePoint.setElevationM(0);
-  _zero_elev = toVec3f(SGVec3d::fromGeod(geodEyePoint) - center);
+  _zero_elev = SGVec3d::fromGeod(geodEyePoint);
   
   SGQuatd hlOr = SGQuatd::fromLonLat(geodEyePoint);
   _surface_south = toVec3f(hlOr.backTransform(-SGVec3d::e1()));
index 2e46afba6c03a77cb4a1cb56551d2df4c1fe7311..8085838225fc8b9aeb0ced8f8b9ea13c6bef9139 100644 (file)
@@ -209,12 +209,8 @@ public:
 
     // Vectors and positions...
 
-    // Get zero view_pos
-    const SGVec3f& get_view_pos() {if ( _dirty ) { recalc(); } return _view_pos; }
-    // Get the absolute view position in fgfs coordinates.
-    virtual double * get_absolute_view_pos ();
     // Get zero elev
-    const SGVec3f& get_zero_elev() {if ( _dirty ) { recalc(); } return _zero_elev; }
+    const SGVec3d& get_zero_elev() {if ( _dirty ) { recalc(); } return _zero_elev; }
     // Get world up vector
     const SGVec3f& get_world_up() {if ( _dirty ) { recalc(); } return _world_up; }
     // Get surface east vector
@@ -222,6 +218,7 @@ public:
     // Get surface south vector
     const SGVec3f& get_surface_south() {if ( _dirty ) { recalc(); } return _surface_south; }
 
+    const SGVec3d& get_view_pos() { if ( _dirty ) { recalc(); } return _absolute_view_pos; }
     const SGVec3d& getViewPosition() { if ( _dirty ) { recalc(); } return _absolute_view_pos; }
     const SGQuatd& getViewOrientation() { if ( _dirty ) { recalc(); } return mViewOrientation; }
 
@@ -275,7 +272,6 @@ private:
 
     SGQuatd mViewOrientation;
     SGVec3d _absolute_view_pos;
-    SGVec3f _relative_view_pos;
 
     double _lon_deg;
     double _lat_deg;
@@ -345,19 +341,14 @@ private:
     // Ratio of window width and height; height = width *
     // aspect_ratio.  This value is automatically calculated based on
     // window dimentions.
-    double _aspect_ratio;   
+    double _aspect_ratio;
 
     // default = 1.0, this value is user configurable and is
     // multiplied into the aspect_ratio to get the actual vertical fov
     double _aspect_ratio_multiplier;
 
-    // view position in opengl world coordinates (this is the
-    // abs_view_pos translated to scenery.center)
-    SGVec3f _view_pos;
-
     // cartesion coordinates of current lon/lat if at sea level
-    // translated to scenery.center
-    SGVec3f _zero_elev;
+    SGVec3d _zero_elev;
 
     // surface vector heading south
     SGVec3f _surface_south;
index 271382d03313459ce9041802a915ea9e930bd0cc..c8706e6970c1a31ac490261458837b80f3c6285c 100644 (file)
@@ -42,10 +42,6 @@ FGAircraftModel::FGAircraftModel ()
 
 FGAircraftModel::~FGAircraftModel ()
 {
-  // Unregister that one at the scenery manager
-  if (_aircraft)
-    globals->get_scenery()->unregister_placement_transform(_aircraft->getTransform());
-
   delete _aircraft;
                                // SSG will delete it
   globals->get_scenery()->get_aircraft_branch()->removeChild(_selector.get());
@@ -89,9 +85,6 @@ FGAircraftModel::init ()
   // Do not do altitude computations with that model
   _selector->setNodeMask(~SG_NODEMASK_TERRAIN_BIT);
   globals->get_scenery()->get_aircraft_branch()->addChild(_selector.get());
-
-  // Register that one at the scenery manager
-  globals->get_scenery()->register_placement_transform(_aircraft->getTransform());
 }
 
 void
index 561f3df8a3db27083cf504953b668542fcdeb24d..29666e074f2fcfd8537031bfead6323325d4f1e7 100644 (file)
@@ -121,9 +121,6 @@ FGModelMgr::add_model (SGPropertyNode * node)
                        // Add this model to the global scene graph
   globals->get_scenery()->get_scene_graph()->addChild(model->getSceneGraph());
 
-  // Register that one at the scenery manager
-  globals->get_scenery()->register_placement_transform(model->getTransform());
-
 
                        // Save this instance for updating
   add_instance(instance);
@@ -212,9 +209,6 @@ FGModelMgr::Instance::Instance ()
 
 FGModelMgr::Instance::~Instance ()
 {
-  // Unregister that one at the scenery manager
-  globals->get_scenery()->unregister_placement_transform(model->getTransform());
-
   delete model;
 }
 
index a4b32d73d0d373e87be6720e68d948c9d782c58c..26f49e4c932b5226ebe6dfe34e1a320f6eb1419c 100644 (file)
@@ -65,8 +65,7 @@ public:
 };
 
 // Scenery Management system
-FGScenery::FGScenery() :
-  center(0, 0, 0)
+FGScenery::FGScenery()
 {
     SG_LOG( SG_TERRAIN, SG_INFO, "Initializing scenery subsystem" );
 }
@@ -128,32 +127,6 @@ void FGScenery::bind() {
 void FGScenery::unbind() {
 }
 
-void FGScenery::set_center( const SGVec3d& p ) {
-    if (center == p)
-      return;
-    center = p;
-    placement_list_type::iterator it = _placement_list.begin();
-    while (it != _placement_list.end()) {
-        (*it)->setSceneryCenter(center);
-        ++it;
-    }
-}
-
-void FGScenery::register_placement_transform(SGPlacementTransform *trans) {
-    _placement_list.push_back(trans);        
-    trans->setSceneryCenter(center);
-}
-
-void FGScenery::unregister_placement_transform(SGPlacementTransform *trans) {
-    placement_list_type::iterator it = _placement_list.begin();
-    while (it != _placement_list.end()) {
-        if ((*it) == trans) {
-            it = _placement_list.erase(it);        
-        } else
-            ++it;
-    }
-}
-
 bool
 FGScenery::get_elevation_m(double lat, double lon, double max_alt,
                            double& alt, const SGMaterial** material,
@@ -172,18 +145,8 @@ FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff,
   if ( norm1(pos) < 1 )
     return false;
 
-  SGVec3d saved_center = center;
-  bool replaced_center = false;
-  if (exact) {
-    if (30*30 < distSqr(pos, center)) {
-      set_center( pos );
-      replaced_center = true;
-    }
-  }
-
-
-  SGVec3d start = pos + max_altoff*normalize(pos) - center;
-  SGVec3d end = - center;
+  SGVec3d start = pos + max_altoff*normalize(pos);
+  SGVec3d end(0, 0, 0);
   
   osgUtil::IntersectVisitor intersectVisitor;
   intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
@@ -200,7 +163,6 @@ FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff,
         = intersectVisitor.getHitList(lineSegment.get())[i];
       SGVec3d point;
       point.osg() = hit.getWorldIntersectPoint();
-      point += center;
       SGGeod geod = SGGeod::fromCart(point);
       double elevation = geod.getElevationM();
       if (alt < elevation) {
@@ -211,9 +173,6 @@ FGScenery::get_cart_elevation_m(const SGVec3d& pos, double max_altoff,
     }
   }
 
-  if (replaced_center)
-    set_center( saved_center );
-  
   return hits;
 }
 
@@ -225,21 +184,9 @@ FGScenery::get_cart_ground_intersection(const SGVec3d& pos, const SGVec3d& dir,
   if ( norm1(pos) < 1 )
     return false;
 
-  // Well that 'exactness' is somehow problematic, but makes at least sure
-  // that we don't compute that with a cenery center at the other side of
-  // the world ...
-  SGVec3d saved_center = center;
-  bool replaced_center = false;
-  if (exact) {
-    if (30*30 < distSqr(pos, center)) {
-      set_center( pos );
-      replaced_center = true;
-    }
-  }
-
   // Make really sure the direction is normalized, is really cheap compared to
   // computation of ground intersection.
-  SGVec3d start = pos - center;
+  SGVec3d start = pos;
   SGVec3d end = start + 1e5*normalize(dir); // FIXME visibility ???
   
   osgUtil::IntersectVisitor intersectVisitor;
@@ -260,13 +207,10 @@ FGScenery::get_cart_ground_intersection(const SGVec3d& pos, const SGVec3d& dir,
       double newdist = length(start - point);
       if (newdist < dist) {
         dist = newdist;
-        nearestHit = point + center;
+        nearestHit = point;
       }
     }
   }
 
-  if (replaced_center)
-    set_center( saved_center );
-
   return hits;
 }
index 9ee3ae482acc88838db9b8378f27d4021e12e6b7..49b3dce4e64dc83c3147ffccf55971ab9a5ada21 100644 (file)
@@ -47,9 +47,6 @@ class SGMaterial;
 
 // Define a structure containing global scenery parameters
 class FGScenery : public SGSubsystem {
-    // center of current scenery chunk
-    SGVec3d center;
-
     // FIXME this should be a views property
     // angle of sun relative to current local horizontal
     double sun_angle;
@@ -64,10 +61,6 @@ class FGScenery : public SGSubsystem {
     osg::ref_ptr<osg::Group> models_branch;
     osg::ref_ptr<osg::Group> aircraft_branch;
 
-    // list of all placement transform, used to move the scenery center on the fly.
-    typedef list<osg::ref_ptr<SGPlacementTransform> > placement_list_type;
-    placement_list_type _placement_list;
-
 public:
 
     FGScenery();
@@ -116,9 +109,6 @@ public:
     bool get_cart_ground_intersection(const SGVec3d& start, const SGVec3d& dir,
                                       SGVec3d& nearestHit, bool exact = false);
 
-    const SGVec3d& get_center() const { return center; }
-    void set_center( const SGVec3d& p );
-
     osg::Group *get_scene_graph () const { return scene_graph.get(); }
     inline void set_scene_graph (osg::Group * s) { scene_graph = s; }
 
@@ -166,9 +156,6 @@ public:
     inline void set_aircraft_branch (osg::Group *t) {
         aircraft_branch = t;
     }
-
-    void register_placement_transform(SGPlacementTransform *trans);
-    void unregister_placement_transform(SGPlacementTransform *trans);
 };
 
 
index b87da6b1d6fbca5a418d3c5746004004f23cf905..45c8bf440e4149dedbaa7c697dab6cac0241b809 100644 (file)
@@ -743,7 +743,6 @@ FGTileEntry::add_ssg_nodes( osg::Group *terrain_branch,
     // bump up the ref count so we can remove this later without
     // having ssg try to free the memory.
     terrain_branch->addChild( terra_transform.get() );
-    globals->get_scenery()->register_placement_transform(terra_transform.get());
 
     SG_LOG( SG_TERRAIN, SG_DEBUG,
             "connected a tile into scene graph.  terra_transform = "
@@ -755,14 +754,12 @@ FGTileEntry::add_ssg_nodes( osg::Group *terrain_branch,
         // bump up the ref count so we can remove this later without
         // having ssg try to free the memory.
         gnd_lights_branch->addChild( gnd_lights_transform.get() );
-        globals->get_scenery()->register_placement_transform(gnd_lights_transform.get());
     }
 
     if ( vasi_lights_transform.get() != NULL ) {
         // bump up the ref count so we can remove this later without
         // having ssg try to free the memory.
         vasi_lights_selector->addChild( vasi_lights_transform.get() );
-        globals->get_scenery()->register_placement_transform(vasi_lights_transform.get());
         vasi_lights_branch->addChild( vasi_lights_selector.get() );
     }
 
@@ -770,7 +767,6 @@ FGTileEntry::add_ssg_nodes( osg::Group *terrain_branch,
         // bump up the ref count so we can remove this later without
         // having ssg try to free the memory.
         rwy_lights_selector->addChild( rwy_lights_transform.get() );
-        globals->get_scenery()->register_placement_transform(rwy_lights_transform.get());
         rwy_lights_branch->addChild( rwy_lights_selector.get() );
     }
 
@@ -778,7 +774,6 @@ FGTileEntry::add_ssg_nodes( osg::Group *terrain_branch,
         // bump up the ref count so we can remove this later without
         // having ssg try to free the memory.
         taxi_lights_selector->addChild( taxi_lights_transform.get() );
-        globals->get_scenery()->register_placement_transform(taxi_lights_transform.get());
         taxi_lights_branch->addChild( taxi_lights_selector.get() );
     }
 
@@ -797,9 +792,6 @@ FGTileEntry::disconnect_ssg_nodes()
         SG_LOG( SG_TERRAIN, SG_DEBUG, "removing a fully loaded tile!  terra_transform = " << terra_transform.get() );
     }
         
-    // Unregister that one at the scenery manager
-    globals->get_scenery()->unregister_placement_transform(terra_transform.get());
-
     // find the terrain branch parent
     int pcount = terra_transform->getNumParents();
     if ( pcount > 0 ) {
@@ -822,8 +814,6 @@ FGTileEntry::disconnect_ssg_nodes()
 
     // find the ground lighting branch
     if ( gnd_lights_transform.get() ) {
-        // Unregister that one at the scenery manager
-        globals->get_scenery()->unregister_placement_transform(gnd_lights_transform.get());
         pcount = gnd_lights_transform->getNumParents();
         if ( pcount > 0 ) {
             // find the first parent (should only be one)
@@ -846,8 +836,6 @@ FGTileEntry::disconnect_ssg_nodes()
 
     // find the vasi lighting branch
     if ( vasi_lights_transform.get() ) {
-        // Unregister that one at the scenery manager
-        globals->get_scenery()->unregister_placement_transform(vasi_lights_transform.get());
         pcount = vasi_lights_transform->getNumParents();
         if ( pcount > 0 ) {
             // find the first parent (should only be one)
@@ -870,8 +858,6 @@ FGTileEntry::disconnect_ssg_nodes()
 
     // find the runway lighting branch
     if ( rwy_lights_transform.get() ) {
-        // Unregister that one at the scenery manager
-        globals->get_scenery()->unregister_placement_transform(rwy_lights_transform.get());
         pcount = rwy_lights_transform->getNumParents();
         if ( pcount > 0 ) {
             // find the first parent (should only be one)
@@ -894,8 +880,6 @@ FGTileEntry::disconnect_ssg_nodes()
 
     // find the taxi lighting branch
     if ( taxi_lights_transform.get() ) {
-        // Unregister that one at the scenery manager
-        globals->get_scenery()->unregister_placement_transform(taxi_lights_transform.get());
         pcount = taxi_lights_transform->getNumParents();
         if ( pcount > 0 ) {
             // find the first parent (should only be one)
index 9c743e5a3626422f05ab1733160447093f65da08..5b4a894dc21314eca2935ffe94611c5ab8283266 100644 (file)
@@ -101,8 +101,7 @@ void fgUpdateSunPos( void ) {
            << l->get_sun_angle() );
     
     // calculate vector to sun's position on the earth's surface
-    SGVec3d rel_sunpos = globals->get_scenery()->get_center();
-    rel_sunpos += l->get_sunpos() - toVec3d(v->get_view_pos());
+    SGVec3d rel_sunpos = l->get_sunpos() - v->get_view_pos();
     // vector in cartesian coordinates from current position to the
     // postion on the earth's surface the sun is directly over
     SGVec3f to_sun = toVec3f(rel_sunpos);
@@ -114,7 +113,7 @@ void fgUpdateSunPos( void ) {
     // local plane representing "horizontal".
 
     SGVec3f world_up = v->get_world_up();
-    SGVec3f view_pos = v->get_view_pos();
+    SGVec3f view_pos = toVec3f(v->get_view_pos());
     // surface direction to go to head towards sun
     SGVec3f surface_to_sun;
     sgmap_vec_onto_cur_surface_plane( world_up.data(), view_pos.data(),