From: curt Date: Fri, 25 Aug 2000 05:53:12 +0000 (+0000) Subject: Add support in materials file for non-repeating textures. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=faeb25940e9c7110ada4d40016364bca4670fa5f;p=flightgear.git Add support in materials file for non-repeating textures. --- diff --git a/src/Objects/matlib.hxx b/src/Objects/matlib.hxx index b97e64388..3b2caf2e2 100644 --- a/src/Objects/matlib.hxx +++ b/src/Objects/matlib.hxx @@ -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 { diff --git a/src/Objects/newmat.cxx b/src/Objects/newmat.cxx index 17489498b..7d9ffc34d 100644 --- a/src/Objects/newmat.cxx +++ b/src/Objects/newmat.cxx @@ -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]; diff --git a/src/Objects/newmat.hxx b/src/Objects/newmat.hxx index c5eecac03..c73fd502d 100644 --- a/src/Objects/newmat.hxx +++ b/src/Objects/newmat.hxx @@ -73,6 +73,9 @@ private: // texture size double xsize, ysize; + // wrap texture? + int wrapu, wrapv; + // material properties sgVec4 ambient, diffuse, specular, emission;