]> git.mxchange.org Git - flightgear.git/blobdiff - src/Objects/newmat.hxx
Nuked the segfault on exit bug everyone was seeing. The material lib could
[flightgear.git] / src / Objects / newmat.hxx
index dc13a5507752673fad1703a205ae9430fc7245e0..72a92ecc3232815d5cbfb9cdf3406e91cfa80749 100644 (file)
@@ -46,7 +46,7 @@
 
 #include STL_STRING      // Standard C++ string library
 
-FG_USING_STD(string);
+SG_USING_STD(string);
 
 
 // MSVC++ 6.0 kuldge - Need forward declaration of friends.
@@ -79,9 +79,23 @@ private:
     // use mipmapping?
     int mipmap;
 
+    // coverage of night lighting.  This number is specifically the
+    // amount of area coverage we give a single light.  The size of a
+    // triangle is divided by this number and that is the number of
+    // lights assigned to that triangle.  Lower numbers mean more
+    // dense light ocverage.
+    double light_coverage;
+
     // material properties
     sgVec4 ambient, diffuse, specular, emission;
 
+    // true if texture loading deferred, and not yet loaded
+    bool texture_loaded;
+
+    // ref count so we can properly delete if we have multiple
+    // pointers to this record
+    int refcount;
+
 public:
 
     // Constructor
@@ -95,16 +109,21 @@ public:
     friend istream& operator >> ( istream& in, FGNewMat& m );
 
     // void load_texture( const string& root );
-    void build_ssg_state( const string& path, 
-                         GLenum shade_model, bool texture_default );
+    void build_ssg_state( GLenum shade_model, bool texture_default,
+                         bool defer_tex_load = false );
     void set_ssg_state( ssgSimpleState *s );
 
     inline string get_material_name() const { return material_name; }
     inline void set_material_name( const string& n ) { material_name = n; }
 
     inline string get_texture_name() const { return texture_name; }
+    inline const char *get_texture_name_c_str() const {
+        return texture_name.c_str();
+    }
     inline void set_texture_name( const string& n ) { texture_name = n; }
 
+    inline ssgSimpleState *get_textured() { return textured; }
+
     inline double get_xsize() const { return xsize; }
     inline double get_ysize() const { return ysize; }
     inline void set_xsize( double x ) { xsize = x; }
@@ -119,8 +138,20 @@ public:
     inline void set_specular( sgVec4 s ) { sgCopyVec4( specular, s ); }
     inline void set_emission( sgVec4 e ) { sgCopyVec4( emission, e ); }
 
+    inline bool get_texture_loaded() const { return texture_loaded; }
+    inline void set_texture_loaded( bool val ) { texture_loaded = val; }
+
+    inline double get_light_coverage () const { return light_coverage; }
+    inline void set_light_coverage (double coverage) {
+       light_coverage = coverage;
+    }
+
     inline ssgStateSelector *get_state() const { return state; }
 
+    inline void ref() { refcount++; }
+    inline void deRef() { refcount--; }
+    inline int getRef() const { return refcount; }
+
     void dump_info();
 };