1 // loader.cxx - implement SSG model and texture loaders.
3 #include <simgear/compiler.h>
4 #include <simgear/props/props.hxx>
11 ////////////////////////////////////////////////////////////////////////
12 // Implementation of SGssgLoader.
13 ////////////////////////////////////////////////////////////////////////
15 SGssgLoader::SGssgLoader ()
20 SGssgLoader::~SGssgLoader ()
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 SGModelLoader.
49 ////////////////////////////////////////////////////////////////////////
51 SGModelLoader::SGModelLoader ()
55 SGModelLoader::~SGModelLoader ()
60 SGModelLoader::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] = sgLoad3DModel( 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;