1 // loader.cxx - implement SSG model and texture loaders.
3 #include <simgear/compiler.h>
4 #include <simgear/props/props.hxx>
11 ////////////////////////////////////////////////////////////////////////
12 // Implementation of FGSSGLoader.
13 ////////////////////////////////////////////////////////////////////////
15 FGSSGLoader::FGSSGLoader ()
20 FGSSGLoader::~FGSSGLoader ()
22 std::map<string, ssgBase *>::iterator it = _table.begin();
23 while (it != _table.end()) {
32 std::map<string, ssgBase *>::iterator it = _table.begin();
33 while (it != _table.end()) {
34 ssgBase * item = it->second;
35 // If there is only one reference, it's
36 // ours; no one else is using the item.
37 if (item->getRef() == 1) {
47 ////////////////////////////////////////////////////////////////////////
48 // Implementation of FGModelLoader.
49 ////////////////////////////////////////////////////////////////////////
51 FGModelLoader::FGModelLoader ()
55 FGModelLoader::~FGModelLoader ()
60 FGModelLoader::load_model( const string &fg_root,
62 SGPropertyNode *prop_root,
65 // FIXME: normalize path to
67 std::map<string, ssgBase *>::iterator it = _table.find(path);
68 if (it == _table.end()) {
69 _table[path] = fgLoad3DModel( fg_root, path, prop_root, sim_time_sec );
70 it = _table.find(path);
71 it->second->ref(); // add one reference to keep it around
73 return (ssgEntity *)it->second;