#define _MATLIB_HXX
-#ifndef __cplusplus
-# error This library requires C++
-#endif
-
#include <simgear/compiler.h>
#include <simgear/structure/SGSharedPtr.hxx>
#include <map> // STL associative "array"
#include <vector> // STL "array"
-#include <osg/Node>
-#include <osg/StateSet>
-
class SGMaterial;
class SGPropertyNode;
-using std::string;
-using std::map;
-using std::vector;
-using std::less;
+namespace simgear { class Effect; }
+namespace osg { class Geode; }
// Material management class
class SGMaterialLib {
private:
// associative array of materials
- typedef map < string, SGSharedPtr<SGMaterial> > material_map;
+ typedef std::vector< SGSharedPtr<SGMaterial> > material_list;
+ typedef material_list::iterator material_list_iterator;
+ typedef std::map < std::string, material_list> material_map;
typedef material_map::iterator material_map_iterator;
typedef material_map::const_iterator const_material_map_iterator;
SGMaterialLib ( void );
// Load a library of material properties
- bool load( const string &fg_root, const string& mpath, const char *season,
+ bool load( const std::string &fg_root, const std::string& mpath,
SGPropertyNode *prop_root );
-
- // Add the named texture with default properties
- bool add_item( const string &tex_path );
- bool add_item( const string &mat_name, const string &tex_path );
- bool add_item( const string &mat_name, osg::StateSet *state );
-
// find a material record by material name
- SGMaterial *find( const string& material );
+ SGMaterial *find( const std::string& material );
material_map_iterator begin() { return matlib.begin(); }
const_material_map_iterator begin() const { return matlib.begin(); }
material_map_iterator end() { return matlib.end(); }
const_material_map_iterator end() const { return matlib.end(); }
- static const SGMaterial* findMaterial(const osg::StateSet* stateSet);
+ static const SGMaterial *findMaterial(const osg::Geode* geode);
// Destructor
~SGMaterialLib ( void );