]> git.mxchange.org Git - flightgear.git/commitdiff
Add support in materials file for non-repeating textures.
authorcurt <curt>
Fri, 25 Aug 2000 05:53:12 +0000 (05:53 +0000)
committercurt <curt>
Fri, 25 Aug 2000 05:53:12 +0000 (05:53 +0000)
src/Objects/matlib.hxx
src/Objects/newmat.cxx
src/Objects/newmat.hxx

index b97e64388ba21d665e1fd1e1bc830008a75cb123..3b2caf2e280bfebe150fe77b509e3f7bfd96e8df 100644 (file)
@@ -57,40 +57,6 @@ FG_USING_STD(vector);
 FG_USING_STD(less);
 
 
-#if 0
-// Material property class
-class FGMaterialSlotold {
-
-private:
-
-    FGMaterial m;
-
-    // ssg stage structure
-    ssgStateSelector *state;
-    bool state_valid;
-
-public:
-
-    // Constructor
-    FGMaterialSlotold ( void );
-
-    // Destructor
-    ~FGMaterialSlotold ( void );
-
-    // friend istream& operator >> ( istream& in, FGMaterialSlot& m );
-
-    inline FGMaterial get_m() const { return m; }
-    inline void set_m( FGMaterial new_m ) { m = new_m; }
-
-    // ssg state
-    inline ssgStateSelector *get_state() { return state; }
-    inline void set_state( ssgStateSelector *s ) { state = s; }
-    inline bool get_state_valid() const { return state_valid; }
-    inline void set_state_valid( bool flag ) { state_valid = flag; }
-};
-#endif
-
-
 // Material management class
 class FGMaterialLib {
 
index 17489498bd14aefac1c0b93578bf08eda88be057..7d9ffc34dbbe98e0c9e2fb28b96940f2ca884249 100644 (file)
@@ -40,6 +40,7 @@
 
 // Constructor
 FGNewMat::FGNewMat ( void ) {
+    wrapu = wrapv = 1;
 }
 
 
@@ -56,6 +57,7 @@ FGNewMat::FGNewMat ( const string &mat_name, const string &tex_name )
     material_name = mat_name;
     texture_name = tex_name;
     xsize = ysize = 0;
+    wrapu = wrapv = 1;
     alpha = 0; 
     ambient[0]  = ambient[1]  = ambient[2]  = ambient[3]  = 1.0;
     diffuse[0]  = diffuse[1]  = diffuse[2]  = diffuse[3]  = 1.0;
@@ -80,7 +82,8 @@ void FGNewMat::build_ssg_state( const string& path,
     textured->enable( GL_TEXTURE_2D );
     textured->disable( GL_BLEND );
     textured->disable( GL_ALPHA_TEST );
-    textured->setTexture( (char *)tex_file.c_str() );
+    textured->setTexture( (char *)tex_file.c_str(), wrapu, wrapv );
+    cout << "wrap u = " << wrapu << " wrapv = " << wrapv << endl;
     textured->enable( GL_COLOR_MATERIAL );
     textured->setColourMaterial( GL_AMBIENT_AND_DIFFUSE );
     textured->setMaterial( GL_EMISSION, 0, 0, 0, 1 );
@@ -195,6 +198,10 @@ operator >> ( istream& in, FGNewMat& m )
            in >> token >> m.xsize;
        } else if ( token == "ysize" ) {
            in >> token >> m.ysize;
+       } else if ( token == "wrapu" ) {
+           in >> token >> m.wrapu;
+       } else if ( token == "wrapv" ) {
+           in >> token >> m.wrapv;
        } else if ( token == "ambient" ) {
            in >> token >> m.ambient[0] >> m.ambient[1]
               >> m.ambient[2] >> m.ambient[3];
index c5eecac033c7c0170ece04d197dbe97574327fde..c73fd502dc9f415828d70aeb7a095a9794d4c22d 100644 (file)
@@ -73,6 +73,9 @@ private:
     // texture size
     double xsize, ysize;
 
+    // wrap texture?
+    int wrapu, wrapv;
+
     // material properties
     sgVec4 ambient, diffuse, specular, emission;