]> git.mxchange.org Git - flightgear.git/blob - src/Objects/matlib.hxx
Revert to pre-wind-sticking ground reaction forces until they can be debugged.
[flightgear.git] / src / Objects / matlib.hxx
1 // matlib.hxx -- class to handle material properties
2 //
3 // Written by Curtis Olson, started May 1998.
4 //
5 // Copyright (C) 1998 - 2000  Curtis L. Olson  - curt@flightgear.org
6 //
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.
11 //
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.
16 //
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.
20 //
21 // $Id$
22
23
24 #ifndef _MATLIB_HXX
25 #define _MATLIB_HXX
26
27
28 #ifndef __cplusplus                                                          
29 # error This library requires C++
30 #endif                                   
31
32 #ifdef HAVE_CONFIG_H
33 #  include <config.h>
34 #endif
35
36 #ifdef HAVE_WINDOWS_H
37 #  include <windows.h>
38 #endif
39
40 #include <simgear/compiler.h>
41
42 #include <GL/glut.h>
43 #include <GL/gl.h>
44
45 #include STL_STRING             // Standard C++ string library
46 #include <map>                  // STL associative "array"
47 #include <vector>               // STL "array"
48
49 #include <plib/ssg.h>           // plib include
50
51 #include "newmat.hxx"
52
53
54 SG_USING_STD(string);
55 SG_USING_STD(map);
56 SG_USING_STD(vector);
57 SG_USING_STD(less);
58
59
60 // Material management class
61 class FGMaterialLib {
62
63 private:
64
65     // associative array of materials
66     typedef map < string, FGNewMat *, less<string> > material_map;
67     typedef material_map::iterator material_map_iterator;
68     typedef material_map::const_iterator const_material_map_iterator;
69
70     material_map matlib;
71
72 public:
73
74     // Constructor
75     FGMaterialLib ( void );
76
77     // Load a library of material properties
78     bool load( const string& mpath );
79
80     // Add the named texture with default properties
81     bool add_item( const string &tex_path );
82     bool add_item( const string &mat_name, const string &tex_path );
83     bool add_item( const string &mat_name, ssgSimpleState *state );
84
85     // find a material record by material name
86     FGNewMat *find( const string& material );
87
88     void set_step (int step);
89     int get_step ();
90
91     // Load one pending "deferred" texture.  Return true if a texture
92     // loaded successfully, false if no pending, or error.
93     void load_next_deferred();
94
95     material_map_iterator begin() { return matlib.begin(); }
96     const_material_map_iterator begin() const { return matlib.begin(); }
97
98     material_map_iterator end() { return matlib.end(); }
99     const_material_map_iterator end() const { return matlib.end(); }
100
101     // Destructor
102     ~FGMaterialLib ( void );
103 };
104
105
106 // global material management class
107 extern FGMaterialLib material_lib;
108
109
110 #endif // _MATLIB_HXX