1 // matlib.hxx -- class to handle material properties
3 // Written by Curtis Olson, started May 1998.
5 // Copyright (C) 1998 - 2000 Curtis L. Olson - curt@flightgear.org
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 # error This library requires C++
36 #include <simgear/compiler.h>
38 #include STL_STRING // Standard C++ string library
39 #include <map> // STL associative "array"
40 #include <vector> // STL "array"
42 #include <plib/ssg.h> // plib include
53 // Material management class
58 // associative array of materials
59 typedef map < string, FGNewMat *, less<string> > material_map;
60 typedef material_map::iterator material_map_iterator;
61 typedef material_map::const_iterator const_material_map_iterator;
68 FGMaterialLib ( void );
70 // Load a library of material properties
71 bool load( const string& mpath );
73 // Add the named texture with default properties
74 bool add_item( const string &tex_path );
75 bool add_item( const string &mat_name, const string &tex_path );
76 bool add_item( const string &mat_name, ssgSimpleState *state );
78 // find a material record by material name
79 FGNewMat *find( const string& material );
81 void set_step (int step);
85 * Load the next deferred texture, if there is any.
87 void load_next_deferred();
89 material_map_iterator begin() { return matlib.begin(); }
90 const_material_map_iterator begin() const { return matlib.begin(); }
92 material_map_iterator end() { return matlib.end(); }
93 const_material_map_iterator end() const { return matlib.end(); }
96 ~FGMaterialLib ( void );
100 // global material management class
101 extern FGMaterialLib material_lib;
104 #endif // _MATLIB_HXX