]> git.mxchange.org Git - flightgear.git/commitdiff
Trial support for texture sets with varying resolution.
authorcurt <curt>
Wed, 4 Oct 2000 20:51:57 +0000 (20:51 +0000)
committercurt <curt>
Wed, 4 Oct 2000 20:51:57 +0000 (20:51 +0000)
src/Objects/matlib.cxx

index 5c3f72727488356cd0dd0a8f7d480840cdcd7cfd..7f8fcb658bc8abc3a0e62a49212a8aa582a7842c 100644 (file)
@@ -63,6 +63,28 @@ FGMaterialLib::FGMaterialLib ( void ) {
 }
 
 
+static bool local_file_exists( const string& path ) {
+    fg_gzifstream in( path );
+    if ( ! in.is_open() ) {
+       return false;
+    } else {
+       return true;
+    }
+
+#if 0
+    cout << path << " ";
+    FILE *fp = fopen( path.c_str(), "r" );
+    if ( fp == NULL ) {
+       cout << " doesn't exist\n";
+       return false;
+    } else {
+       cout << " exists\n";
+       return true;
+    }
+#endif
+}
+
+
 // Load a library of material properties
 bool FGMaterialLib::load( const string& mpath ) {
     string material_name;
@@ -97,8 +119,15 @@ bool FGMaterialLib::load( const string& mpath ) {
 
            // build the ssgSimpleState
            FGPath tex_path( current_options.get_fg_root() );
-           tex_path.append( "Textures" );
+           tex_path.append( "Textures.high" );
 
+           FGPath tmp_path = tex_path;
+           tmp_path.append( m.get_texture_name() );
+           if ( ! local_file_exists( tmp_path.str() ) ) {
+               tex_path = FGPath( current_options.get_fg_root() );
+               tex_path.append( "Textures" );
+           }
+           
            FG_LOG( FG_TERRAIN, FG_INFO, "  Loading material " 
                    << material_name << " (" << tex_path.c_str() << ")");