1 // newmat.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++
43 #include <simgear/compiler.h>
47 #include STL_STRING // Standard C++ string library
52 // MSVC++ 6.0 kuldge - Need forward declaration of friends.
54 istream& operator >> ( istream& in, FGNewMat& m );
56 // Material property class
65 // pointers to ssg states
66 ssgStateSelector *state;
67 ssgSimpleState *textured;
68 ssgSimpleState *nontextured;
76 // material properties
77 sgVec4 ambient, diffuse, specular, emission;
83 FGNewMat ( const string& name );
88 friend istream& operator >> ( istream& in, FGNewMat& m );
90 // void load_texture( const string& root );
91 void build_ssg_state( const string& path,
92 GLenum shade_model, bool texture_default );
94 inline string get_material_name() const { return material_name; }
95 inline void set_material_name( const string& n ) { material_name = n; }
97 inline string get_texture_name() const { return texture_name; }
98 inline void set_texture_name( const string& n ) { texture_name = n; }
100 inline double get_xsize() const { return xsize; }
101 inline double get_ysize() const { return ysize; }
102 inline void set_xsize( double x ) { xsize = x; }
103 inline void set_ysize( double y ) { ysize = y; }
105 inline float *get_ambient() { return ambient; }
106 inline float *get_diffuse() { return diffuse; }
107 inline float *get_specular() { return specular; }
108 inline float *get_emission() { return emission; }
109 inline void set_ambient( sgVec4 a ) { sgCopyVec4( ambient, a ); }
110 inline void set_diffuse( sgVec4 d ) { sgCopyVec4( diffuse, d ); }
111 inline void set_specular( sgVec4 s ) { sgCopyVec4( specular, s ); }
112 inline void set_emission( sgVec4 e ) { sgCopyVec4( emission, e ); }
114 inline ssgStateSelector *get_state() const { return state; }
120 #endif // _NEWMAT_HXX