]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/material/matlib.hxx
Random buildings - initial commit.
[simgear.git] / simgear / scene / material / matlib.hxx
index f457d2760bbec1ce07a3ce7520d3dd58e55e8676..7d52e5c133539857f4fa491c0ec4130b49c9d69a 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
 #define _MATLIB_HXX
 
 
-#ifndef __cplusplus                                                          
+#ifndef __cplusplus
 # error This library requires C++
-#endif                                   
+#endif
 
 #include <simgear/compiler.h>
 
-#include STL_STRING            // Standard C++ string library
+#include <simgear/structure/SGSharedPtr.hxx>
+
+#include <string>              // Standard C++ string library
 #include <map>                 // STL associative "array"
 #include <vector>              // STL "array"
 
-#include <plib/ssg.h>          // plib include
-
+#include <osg/Geode>
 
 class SGMaterial;
+class SGPropertyNode;
 
-SG_USING_STD(string);
-SG_USING_STD(map);
-SG_USING_STD(vector);
-SG_USING_STD(less);
+using std::string;
+using std::map;
+using std::vector;
+using std::less;
 
+namespace simgear
+{
+class Effect;
+}
 
 // Material management class
 class SGMaterialLib {
@@ -52,7 +58,9 @@ class SGMaterialLib {
 private:
 
     // associative array of materials
-    typedef map < string, SGMaterial *, less<string> > material_map;
+    typedef std::vector< SGSharedPtr<SGMaterial> > material_list;    
+    typedef material_list::iterator material_list_iterator;
+    typedef map < string,  material_list> material_map;
     typedef material_map::iterator material_map_iterator;
     typedef material_map::const_iterator const_material_map_iterator;
 
@@ -64,27 +72,19 @@ public:
     SGMaterialLib ( void );
 
     // Load a library of material properties
-    bool load( const string &fg_root, const string& mpath, const char *season );
-
-    // 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, ssgSimpleState *state );
-
+    bool load( const string &fg_root, const string& mpath,
+            SGPropertyNode *prop_root );
     // find a material record by material name
     SGMaterial *find( const string& material );
 
-    /**
-     * Load the next deferred texture, if there is any.
-     */
-    void load_next_deferred();
-
     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::Geode* geode);
+
     // Destructor
     ~SGMaterialLib ( void );
 };