]> git.mxchange.org Git - flightgear.git/commitdiff
Mathias Fröhlich:
authorehofman <ehofman>
Wed, 8 Feb 2006 10:25:56 +0000 (10:25 +0000)
committerehofman <ehofman>
Wed, 8 Feb 2006 10:25:56 +0000 (10:25 +0000)
Make use of the automatic reference counting class for ssg* data in flightgear.

18 files changed:
src/AIModel/AIBase.cxx
src/AIModel/AIBase.hxx
src/AIModel/AIManager.cxx
src/AIModel/AIManager.hxx
src/ATC/AIEntity.cxx
src/ATC/AIEntity.hxx
src/ATC/AILocalTraffic.cxx
src/ATC/AIMgr.cxx
src/ATC/AIMgr.hxx
src/Instrumentation/wxradar.cxx
src/Instrumentation/wxradar.hxx
src/Main/renderer.cxx
src/Model/acmodel.hxx
src/Model/modelmgr.hxx
src/Scenery/scenery.cxx
src/Scenery/scenery.hxx
src/Scenery/tileentry.cxx
src/Scenery/tileentry.hxx

index e816b232b70d6c5561c472dd1c688ec34362a66f..51a959e40d6762d912894070288c46eefed9f18f 100644 (file)
@@ -51,7 +51,6 @@ const double FGAIBase::lbs_to_slugs = 0.031080950172;   //conversion factor
 
 FGAIBase::FGAIBase()
   : fp( NULL ),
-    model( NULL ),
     props( NULL ),
     manager( NULL ),
     _refID( _newAIModelID() )
@@ -82,8 +81,6 @@ FGAIBase::~FGAIBase() {
     root->removeChild(_type_str.c_str(), index);
     delete fp;
     fp = NULL;
-    ssgDeRefDelete(model);
-    model = 0;
 }
 
 void FGAIBase::update(double dt) {
@@ -151,7 +148,6 @@ ssgBranch * FGAIBase::load3DModel(const string& fg_root,
   // some more code here to check whether a model with this name has already been loaded
   // if not load it, otherwise, get the memory pointer and do something like 
   // SetModel as in ATC/AIEntity.cxx
-  //SSGBranch *model;
   model = manager->getModel(path);
   if (!(model))
     {
@@ -161,17 +157,7 @@ ssgBranch * FGAIBase::load3DModel(const string& fg_root,
                            sim_time_sec);
       manager->setModel(path, model);
     }
-  //else
-  //  {
-  //    model->ref();
-  //    aip.init(model);
-  //    aip.setVisible(false);
-  //    globals->get_scenery()->get_scene_graph()->addKid(aip.getSceneGraph());
-  // do some setModel stuff.
   
-  if (model)
-    model->ref();
-
   return model;
 }
 
index 4d1f630b1915516948a57e8ea3e3a1e342c2e88f..02b9e07e0780396eb82b1559422f9a907602781e 100644 (file)
@@ -27,6 +27,7 @@
 #include <simgear/math/point3d.hxx>
 #include <simgear/scene/model/placement.hxx>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/structure/ssgSharedPtr.hxx>
 
 #include <Main/fg_props.hxx>
 
@@ -180,7 +181,7 @@ protected:
 
 
     string model_path;    //Path to the 3D model
-    ssgBranch * model;     //The 3D model object
+    ssgSharedPtr<ssgBranch> model; //The 3D model object
     SGModelPlacement aip;
     bool delete_me;
     bool invisible;
index 84f22ebf11f32192cf4da1603bb24603b770dce5..0047d0199b081895ba55a866e1c03b2b147fa4dc 100644 (file)
@@ -59,12 +59,6 @@ FGAIManager::~FGAIManager() {
       ++ai_list_itr;
     }
   ai_list.clear();
-  ModelVecIterator i = loadedModels.begin();
-  while (i != loadedModels.end())
-    {
-      ssgDeRefDelete(i->getModelId());
-      ++i;
-    }
 }
 
 
@@ -445,8 +439,6 @@ ssgBranch * FGAIManager::getModel(const string& path) const
 
 void FGAIManager::setModel(const string& path, ssgBranch *model)
 {
-  if (model)
-    model->ref();
   loadedModels.push_back(FGModelID(path,model));
 }
 
index 66c89a2f4ddece343ac99392f5ebd4ee24d0e57a..1c57df03a26bf4d27ebb164b33bbba6f60f343aa 100644 (file)
@@ -26,6 +26,7 @@
 #include <list>
 
 #include <simgear/structure/subsystem_mgr.hxx>
+#include <simgear/structure/ssgSharedPtr.hxx>
 
 #include <Main/fg_props.hxx>
 
@@ -42,7 +43,7 @@ SG_USING_STD(vector);
 class FGModelID
 {
 private:
-  ssgBranch * model;
+  ssgSharedPtr<ssgBranch> model;
   string path;
 public:
   FGModelID(const string& pth, ssgBranch * mdl) { path =pth; model=mdl;};
index efcaaee1cc56ce05be481d4185e32cf26939baf8..c8aeab1e3cef815d5d2fb23260e0f3775725a712 100644 (file)
@@ -45,7 +45,6 @@ FGAIEntity::FGAIEntity() {
 
 FGAIEntity::~FGAIEntity() {
        //cout << "FGAIEntity dtor called..." << endl;
-        ssgDeRefDelete(_model);        // Ought to check valid?
        //cout << "Removing model from scene graph..." << endl;
        globals->get_scenery()->get_scene_graph()->removeKid(_aip.getSceneGraph());
         // Unregister that one at the scenery manager
@@ -56,7 +55,6 @@ FGAIEntity::~FGAIEntity() {
 
 void FGAIEntity::SetModel(ssgBranch* model) {
        _model = model;
-       _model->ref();
        _aip.init(_model);
        _aip.setVisible(false);
        globals->get_scenery()->get_scene_graph()->addKid(_aip.getSceneGraph());
index 43da25d533f4fc0cff61874ea66d4110489cd509..9f2870dfa8655a941740fcb61ee1ee0570340118 100644 (file)
 #include <simgear/math/point3d.hxx>
 #include <simgear/scene/model/model.hxx>
 #include <simgear/scene/model/placement.hxx>
+#include <simgear/structure/ssgSharedPtr.hxx>
 
-class ssgBranch;
+
+class ssgBase;
 
 
 /*****************************************************************
@@ -65,7 +67,7 @@ protected:
     double _pitch;     //degrees
 
     char* _model_path; //Path to the 3D model
-       ssgBranch* _model;      // Pointer to the model
+    ssgSharedPtr<ssgBranch> _model;    // Pointer to the model
     SGModelPlacement _aip;
 
     void Transform();
index 997db2a94ad9fcfda86eb8f95a1b223298e69ded..29dda83d328078b59c772c0fce58f9c9d54635ea 100644 (file)
@@ -61,7 +61,6 @@ FGAILocalTraffic::FGAILocalTraffic() {
                                          globals->get_sim_time_sec() );
        *//*
        _model = model;
-       _model->ref();
        _aip.init(_model);
        */
        //SetModel(model);
@@ -125,7 +124,6 @@ FGAILocalTraffic::FGAILocalTraffic() {
 }
 
 FGAILocalTraffic::~FGAILocalTraffic() {
-       //_model->deRef();
 }
 
 void FGAILocalTraffic::GetAirportDetails(const string& id) {
index 4fdc5eec235366fd6ccf4d81657bacb529629d75..0edc4738efa4f6f21c76af3be1052ebaa72bafe9 100644 (file)
@@ -56,8 +56,6 @@ FGAIMgr::FGAIMgr() {
 }
 
 FGAIMgr::~FGAIMgr() {
-        ssgDeRefDelete(_defaultModel);
-       if(_havePiperModel) ssgDeRefDelete(_piperModel);
 }
 
 void FGAIMgr::init() {
@@ -105,10 +103,6 @@ void FGAIMgr::init() {
                _havePiperModel = false;
        }
 
-       // We need to keep one ref of the models open to stop ssg deleting them behind our back!
-       _defaultModel->ref();
-       if(_havePiperModel) _piperModel->ref();
-
        // go through the $FG_ROOT/ATC directory and find all *.taxi files
        SGPath path(globals->get_fg_root());
        path.append("ATC/");
index 885536dd57d25e51322b5c9a2e6425eed2f0935a..f8456ba3ede9163dcccbbdc4e7dcb02c9586ed92 100644 (file)
@@ -23,6 +23,7 @@
 #define _FG_AIMGR_HXX
 
 #include <simgear/structure/subsystem_mgr.hxx>
+#include <simgear/structure/ssgSharedPtr.hxx>
 
 #include <Main/fg_props.hxx>
 
@@ -109,8 +110,8 @@ public:
 
 private:
        
-       ssgBranch* _defaultModel;  // Cessna 172!
-       ssgBranch* _piperModel;    // pa28-161
+       ssgSharedPtr<ssgBranch> _defaultModel;  // Cessna 172!
+       ssgSharedPtr<ssgBranch> _piperModel;    // pa28-161
 
        bool initDone;  // Hack - guard against update getting called before init
 
index ad4d3db0cfdf3f4b8c87725678d0e7879a98d175..629f9abe11d563eb47bc901b2019b7771f7cf3ee 100644 (file)
@@ -70,8 +70,6 @@ wxRadarBg::wxRadarBg ()
 
 wxRadarBg::~wxRadarBg ()
 {
-    ssgDeRefDelete(resultTexture);
-    ssgDeRefDelete(wxEcho);
 }
 
 void
@@ -83,12 +81,10 @@ wxRadarBg::init ()
     _Instrument = fgGetNode(branch.c_str(), num, true );
     _serviceable_node = _Instrument->getChild("serviceable", 0, true);
     resultTexture = FGTextureManager::createTexture( odgauge_name );
-    resultTexture->ref();
     SGPath tpath(globals->get_fg_root());
     tpath.append("Aircraft/Instruments/Textures/wxecho.rgb");
     // no mipmap or else alpha will mix with pixels on the border of shapes, ruining the effect
     wxEcho = new ssgTexture( tpath.c_str(), false, false, false);
-    wxEcho->ref();
 
     _Instrument->setFloatValue("trk", 0.0);
     _Instrument->setFloatValue("tilt", 0.0);
index 3939977f08fbefb4c65cd2a8481cf9802a3a443b..1af69a5acc525d6b99fb55fc181dc6666cacc305 100644 (file)
@@ -26,6 +26,7 @@
 #include <simgear/props/props.hxx>
 #include <simgear/structure/subsystem_mgr.hxx>
 #include <simgear/environment/visual_enviro.hxx>
+#include <simgear/structure/ssgSharedPtr.hxx>
 
 class ssgTexture;
 class FGODGauge;
@@ -49,8 +50,8 @@ private:
 
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _Instrument;
-    ssgTexture *resultTexture;
-    ssgTexture *wxEcho;
+    ssgSharedPtr<ssgTexture> resultTexture;
+    ssgSharedPtr<ssgTexture> wxEcho;
     string last_switchKnob;
     bool sim_init_done;
     FGODGauge *odg;
index 7ccd7a7544ae1c4030cdb981fc9eb6c87efae956..f4a26425835c36d3b4ce93074ffc990a390b71fb 100644 (file)
@@ -116,10 +116,10 @@ sgMat4 copy_of_ssgOpenGLAxisSwapMatrix =
   {  0.0f,  0.0f,  0.0f,  1.0f }
 };
 
-ssgSimpleState *cloud3d_imposter_state;
-ssgSimpleState *default_state;
-ssgSimpleState *hud_and_panel;
-ssgSimpleState *menus;
+ssgSharedPtr<ssgSimpleState> cloud3d_imposter_state;
+ssgSharedPtr<ssgSimpleState> default_state;
+ssgSharedPtr<ssgSimpleState> hud_and_panel;
+ssgSharedPtr<ssgSimpleState> menus;
 
 SGShadowVolume *shadows;
 
@@ -141,7 +141,6 @@ FGRenderer::~FGRenderer()
 void
 FGRenderer::build_states( void ) {
     default_state = new ssgSimpleState;
-    default_state->ref();
     default_state->disable( GL_TEXTURE_2D );
     default_state->enable( GL_CULL_FACE );
     default_state->enable( GL_COLOR_MATERIAL );
@@ -153,7 +152,6 @@ FGRenderer::build_states( void ) {
     default_state->disable( GL_LIGHTING );
 
     cloud3d_imposter_state = new ssgSimpleState;
-    cloud3d_imposter_state->ref();
     cloud3d_imposter_state->enable( GL_TEXTURE_2D );
     cloud3d_imposter_state->enable( GL_CULL_FACE );
     cloud3d_imposter_state->enable( GL_COLOR_MATERIAL );
@@ -167,14 +165,12 @@ FGRenderer::build_states( void ) {
     cloud3d_imposter_state->disable( GL_LIGHTING );
 
     hud_and_panel = new ssgSimpleState;
-    hud_and_panel->ref();
     hud_and_panel->disable( GL_CULL_FACE );
     hud_and_panel->disable( GL_TEXTURE_2D );
     hud_and_panel->disable( GL_LIGHTING );
     hud_and_panel->enable( GL_BLEND );
 
     menus = new ssgSimpleState;
-    menus->ref();
     menus->disable( GL_CULL_FACE );
     menus->disable( GL_TEXTURE_2D );
     menus->enable( GL_BLEND );
index e15705374f0293bdf003f74d0749cb81b427d280..bee322e8bbaa6ca0b3f5e0ea282794f4e15dcd3a 100644 (file)
@@ -17,6 +17,7 @@ SG_USING_STD(string);
 SG_USING_STD(vector);
 
 #include <simgear/structure/subsystem_mgr.hxx> // for SGSubsystem
+#include <simgear/structure/ssgSharedPtr.hxx>
 
 
 // Don't pull in the headers, since we don't need them here.
@@ -43,8 +44,8 @@ public:
 private:
 
   SGModelPlacement * _aircraft;
-  ssgSelector * _selector;
-  ssgRoot * _scene;
+  ssgSharedPtr<ssgSelector> _selector;
+  ssgSharedPtr<ssgRoot> _scene;
   float _nearplane;
   float _farplane;
 
index 41376f47d1e469d6df7b89a6eed2456b220fa552..179d20c0878b4b157b37c0aaa89d6f150e5f5b63 100644 (file)
@@ -90,7 +90,7 @@ private:
 
   vector<Instance *> _instances;
 
-  ssgSelector * _selector;
+  ssgSharedPtr<ssgSelector> _selector;
 
 };
 
index 2b97835d23ae37810b1fcff3ed15158224e26250..e0acaaef17b5b3287b1087f64e6ca4f66727eb31 100644 (file)
@@ -112,7 +112,6 @@ void FGScenery::set_center( const Point3D& p ) {
 }
 
 void FGScenery::register_placement_transform(ssgPlacementTransform *trans) {
-    trans->ref();
     _placement_list.push_back(trans);        
     sgdVec3 c;
     sgdSetVec3(c, center.x(), center.y(), center.z());
@@ -124,7 +123,6 @@ void FGScenery::unregister_placement_transform(ssgPlacementTransform *trans) {
     while (it != _placement_list.end()) {
         if ((*it) == trans) {
             it = _placement_list.erase(it);        
-            ssgDeRefDelete(trans);
         } else
             ++it;
     }
@@ -155,7 +153,7 @@ FGScenery::get_cart_elevation_m(const sgdVec3& pos, double max_altoff,
     Point3D ppos(pos[0], pos[1], pos[2]);
     if (30.0*30.0 < ppos.distance3Dsquared(center)) {
       set_center( ppos );
-      replaced_center = false;
+      replaced_center = true;
     }
   }
 
index 996eb8ddcfed7e8fd60a5e044711135450eaa3f4..2042085ca728596b3d269ca39dcff927acba8c2c 100644 (file)
 #include <simgear/compiler.h>
 #include <simgear/structure/subsystem_mgr.hxx>
 #include <simgear/math/point3d.hxx>
+#include <simgear/scene/model/placementtrans.hxx>
+#include <simgear/structure/ssgSharedPtr.hxx>
 
 SG_USING_STD(list);
 
 class ssgRoot;
 class ssgBranch;
-class ssgPlacementTransform;
 
 
 // Define a structure containing global scenery parameters
@@ -57,17 +58,17 @@ class FGScenery : public SGSubsystem {
     double sun_angle;
 
     // SSG scene graph
-    ssgRoot *scene_graph;
-    ssgBranch *terrain_branch;
-    ssgRoot *gnd_lights_root;
-    ssgRoot *vasi_lights_root;
-    ssgRoot *rwy_lights_root;
-    ssgRoot *taxi_lights_root;
-    ssgBranch *models_branch;
-    ssgBranch *aircraft_branch;
+    ssgSharedPtr<ssgRoot> scene_graph;
+    ssgSharedPtr<ssgBranch> terrain_branch;
+    ssgSharedPtr<ssgRoot> gnd_lights_root;
+    ssgSharedPtr<ssgRoot> vasi_lights_root;
+    ssgSharedPtr<ssgRoot> rwy_lights_root;
+    ssgSharedPtr<ssgRoot> taxi_lights_root;
+    ssgSharedPtr<ssgBranch> models_branch;
+    ssgSharedPtr<ssgBranch> aircraft_branch;
 
     // list of all placement transform, used to move the scenery center on the fly.
-    typedef list<ssgPlacementTransform*> placement_list_type;
+    typedef list<ssgSharedPtr<ssgPlacementTransform> > placement_list_type;
     placement_list_type _placement_list;
 
 public:
index 329ae43454a6846a3c79add624675b3941cee252..4d3f7008aaaf8b6e093ab6b85954401add892147 100644 (file)
@@ -201,16 +201,6 @@ static void my_remove_branch( ssgBranch * branch ) {
 // is intended to spread the load of freeing a complex tile out over
 // several frames.
 static int fgPartialFreeSSGtree( ssgBranch *b, int n ) {
-
-#if 0
-    // for testing: we could call the following two lines and replace
-    // the functionality of this entire function and everything will
-    // get properly freed, but it will happen all at once and could
-    // cause a huge frame rate hit.
-    ssgDeRefDelete( b );
-    return 0;
-#endif
-
     int num_deletes = 0;
 
     if ( n > 0 ) {
@@ -264,7 +254,7 @@ bool FGTileEntry::free_tile() {
         // disconnected from the scene graph)
         SG_LOG( SG_TERRAIN, SG_DEBUG, "FREEING terra_transform" );
         if ( fgPartialFreeSSGtree( terra_transform, delete_size ) == 0 ) {
-            ssgDeRefDelete( terra_transform );
+            terra_transform = 0;
             free_tracker |= TERRA_NODE;
         }
     } else if ( !(free_tracker & GROUND_LIGHTS) && gnd_lights_transform ) {
@@ -272,7 +262,7 @@ bool FGTileEntry::free_tile() {
         // disconnected from the scene graph)
         SG_LOG( SG_TERRAIN, SG_DEBUG, "FREEING gnd_lights_transform" );
         if ( fgPartialFreeSSGtree( gnd_lights_transform, delete_size ) == 0 ) {
-            ssgDeRefDelete( gnd_lights_transform );
+            gnd_lights_transform = 0;
             free_tracker |= GROUND_LIGHTS;
         }
     } else if ( !(free_tracker & VASI_LIGHTS) && vasi_lights_selector ) {
@@ -280,7 +270,7 @@ bool FGTileEntry::free_tile() {
         // been disconnected from the scene graph)
         SG_LOG( SG_TERRAIN, SG_DEBUG, "FREEING vasi_lights_selector" );
         if ( fgPartialFreeSSGtree( vasi_lights_selector, delete_size ) == 0 ) {
-            ssgDeRefDelete( vasi_lights_selector );
+            vasi_lights_selector = 0;
             free_tracker |= VASI_LIGHTS;
         }
     } else if ( !(free_tracker & RWY_LIGHTS) && rwy_lights_selector ) {
@@ -288,7 +278,7 @@ bool FGTileEntry::free_tile() {
         // been disconnected from the scene graph)
         SG_LOG( SG_TERRAIN, SG_DEBUG, "FREEING rwy_lights_selector" );
         if ( fgPartialFreeSSGtree( rwy_lights_selector, delete_size ) == 0 ) {
-            ssgDeRefDelete( rwy_lights_selector );
+            rwy_lights_selector = 0;
             free_tracker |= RWY_LIGHTS;
         }
     } else if ( !(free_tracker & TAXI_LIGHTS) && taxi_lights_selector ) {
@@ -296,7 +286,7 @@ bool FGTileEntry::free_tile() {
         // disconnected from the scene graph)
         SG_LOG( SG_TERRAIN, SG_DEBUG, "FREEING taxi_lights_selector" );
         if ( fgPartialFreeSSGtree( taxi_lights_selector, delete_size ) == 0 ) {
-            ssgDeRefDelete( taxi_lights_selector );
+            taxi_lights_selector = 0;
             free_tracker |= TAXI_LIGHTS;
         }
     } else if ( !(free_tracker & LIGHTMAPS) ) {
@@ -798,21 +788,19 @@ FGTileEntry::load( const string_list &path_list, bool is_base )
 
     if (found_tile_base) {
         // load tile if found ...
-        ssgBranch *geometry = new ssgBranch;
+        ssgSharedPtr<ssgBranch> geometry = new ssgBranch;
         if ( obj_load( object_base.str(), geometry,
                        NULL, NULL, NULL, light_pts, true ) ) {
             geometry->getKid( 0 )->setTravCallback(SSG_CALLBACK_PRETRAV,
                     &FGTileMgr::tile_filter_cb);
 
             new_tile -> addKid( geometry );
-        } else {
-            delete geometry;
         }
 
     } else {
         // ... or generate an ocean tile on the fly
         SG_LOG(SG_TERRAIN, SG_INFO, "  Generating ocean tile");
-        ssgBranch *geometry = new ssgBranch;
+        ssgSharedPtr<ssgBranch> geometry = new ssgBranch;
         Point3D c;
         double br;
         if ( sgGenTile( path_list[0], tile_bucket, &c, &br,
@@ -821,7 +809,6 @@ FGTileEntry::load( const string_list &path_list, bool is_base )
             bounding_radius = br;
             new_tile -> addKid( geometry );
         } else {
-            delete geometry;
             SG_LOG( SG_TERRAIN, SG_ALERT,
                     "Warning: failed to generate ocean tile!" );
         }
@@ -836,10 +823,10 @@ FGTileEntry::load( const string_list &path_list, bool is_base )
             SGPath custom_path = obj->path;
             custom_path.append( obj->name );
 
-            ssgBranch *geometry = new ssgBranch;
-            ssgBranch *vasi_lights = new ssgBranch;
-            ssgBranch *rwy_lights = new ssgBranch;
-            ssgBranch *taxi_lights = new ssgBranch;
+            ssgSharedPtr<ssgBranch> geometry = new ssgBranch;
+            ssgSharedPtr<ssgBranch> vasi_lights = new ssgBranch;
+            ssgSharedPtr<ssgBranch> rwy_lights = new ssgBranch;
+            ssgSharedPtr<ssgBranch> taxi_lights = new ssgBranch;
 
             if ( obj_load( custom_path.str(),
                            geometry, vasi_lights, rwy_lights,
@@ -850,30 +837,16 @@ FGTileEntry::load( const string_list &path_list, bool is_base )
                                                 SSG_CALLBACK_PRETRAV,
                                                 &FGTileMgr::tile_filter_cb );
                     new_tile -> addKid( geometry );
-                } else {
-                    delete geometry;
                 }
 
                 if ( vasi_lights -> getNumKids() > 0 )
                     vasi_lights_transform -> addKid( vasi_lights );
-                else
-                    delete vasi_lights;
 
                 if ( rwy_lights -> getNumKids() > 0 )
                     rwy_lights_transform -> addKid( rwy_lights );
-                else
-                    delete rwy_lights;
 
                 if ( taxi_lights -> getNumKids() > 0 )
                     taxi_lights_transform -> addKid( taxi_lights );
-                else
-                    delete taxi_lights;
-
-            } else {
-                delete geometry;
-                delete vasi_lights;
-                delete rwy_lights;
-                delete taxi_lights;
             }
 
 
@@ -1017,7 +990,6 @@ FGTileEntry::add_ssg_nodes( ssgBranch *terrain_branch,
     }
 #endif
 
-    terra_transform->ref();
     terrain_branch->addKid( terra_transform );
     globals->get_scenery()->register_placement_transform(terra_transform);
 
@@ -1030,7 +1002,6 @@ FGTileEntry::add_ssg_nodes( ssgBranch *terrain_branch,
     if ( gnd_lights_transform != NULL ) {
         // bump up the ref count so we can remove this later without
         // having ssg try to free the memory.
-        gnd_lights_transform->ref();
         gnd_lights_branch->addKid( gnd_lights_transform );
         globals->get_scenery()->register_placement_transform(gnd_lights_transform);
     }
@@ -1038,7 +1009,6 @@ FGTileEntry::add_ssg_nodes( ssgBranch *terrain_branch,
     if ( vasi_lights_transform != NULL ) {
         // bump up the ref count so we can remove this later without
         // having ssg try to free the memory.
-        vasi_lights_selector->ref();
         vasi_lights_selector->addKid( vasi_lights_transform );
         globals->get_scenery()->register_placement_transform(vasi_lights_transform);
         vasi_lights_branch->addKid( vasi_lights_selector );
@@ -1047,7 +1017,6 @@ FGTileEntry::add_ssg_nodes( ssgBranch *terrain_branch,
     if ( rwy_lights_transform != NULL ) {
         // bump up the ref count so we can remove this later without
         // having ssg try to free the memory.
-        rwy_lights_selector->ref();
         rwy_lights_selector->addKid( rwy_lights_transform );
         globals->get_scenery()->register_placement_transform(rwy_lights_transform);
         rwy_lights_branch->addKid( rwy_lights_selector );
@@ -1056,7 +1025,6 @@ FGTileEntry::add_ssg_nodes( ssgBranch *terrain_branch,
     if ( taxi_lights_transform != NULL ) {
         // bump up the ref count so we can remove this later without
         // having ssg try to free the memory.
-        taxi_lights_selector->ref();
         taxi_lights_selector->addKid( taxi_lights_transform );
         globals->get_scenery()->register_placement_transform(taxi_lights_transform);
         taxi_lights_branch->addKid( taxi_lights_selector );
index e7f6fd3b21c15dce5d8bde4b015b33189c47c8b4..e60f4107b49543249daaeafdbf7c3fe59530737a 100644 (file)
@@ -41,6 +41,8 @@
 #include <simgear/bucket/newbucket.hxx>
 #include <simgear/math/point3d.hxx>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/scene/model/placementtrans.hxx>
+#include <simgear/structure/ssgSharedPtr.hxx>
 
 #if defined( sgi )
 #include <strings.h>
@@ -58,7 +60,6 @@ typedef point_list::const_iterator const_point_list_iterator;
 class ssgLeaf;
 class ssgBranch;
 class ssgTransform;
-class ssgPlacementTransform;
 class ssgSelector;
 class ssgRangeSelector;
 class ssgVertexArray;
@@ -75,7 +76,7 @@ private:
     string model_path;
     string texture_path;
     FGTileEntry *tile;
-    ssgTransform *obj_trans;
+    ssgSharedPtr<ssgTransform> obj_trans;
     SGBucket bucket;
 
 
@@ -128,27 +129,27 @@ private:
     //                 - kidn(fan)
 
     // pointer to ssg transform for this tile
-    ssgPlacementTransform *terra_transform;
-    ssgPlacementTransform *vasi_lights_transform;
-    ssgPlacementTransform *rwy_lights_transform;
-    ssgPlacementTransform *taxi_lights_transform;
-    ssgPlacementTransform *gnd_lights_transform;
+    ssgSharedPtr<ssgPlacementTransform> terra_transform;
+    ssgSharedPtr<ssgPlacementTransform> vasi_lights_transform;
+    ssgSharedPtr<ssgPlacementTransform> rwy_lights_transform;
+    ssgSharedPtr<ssgPlacementTransform> taxi_lights_transform;
+    ssgSharedPtr<ssgPlacementTransform> gnd_lights_transform;
 
     // pointer to ssg range selector for this tile
-    ssgRangeSelector *terra_range;
-    ssgRangeSelector *gnd_lights_range;
+    ssgSharedPtr<ssgRangeSelector> terra_range;
+    ssgSharedPtr<ssgRangeSelector> gnd_lights_range;
 
     // we create several preset brightness and can choose which one we
     // want based on lighting conditions.
-    ssgSelector *gnd_lights_brightness;
+    ssgSharedPtr<ssgSelector> gnd_lights_brightness;
 
     // we need to be able to turn runway lights on or off (doing this
     // via a call back would be nifty, but then the call back needs to
     // know about the higher level application's global state which is
     // a problem if we move the code into simgear.)
-    ssgSelector *vasi_lights_selector;
-    ssgSelector *rwy_lights_selector;
-    ssgSelector *taxi_lights_selector;
+    ssgSharedPtr<ssgSelector> vasi_lights_selector;
+    ssgSharedPtr<ssgSelector> rwy_lights_selector;
+    ssgSharedPtr<ssgSelector> taxi_lights_selector;
 
     /**
      * Indicates this tile has been loaded from a file and connected