1
0
Fork 0

Add support in materials file for non-repeating textures.

This commit is contained in:
curt 2000-08-25 05:53:12 +00:00
parent 927aa90378
commit faeb25940e
3 changed files with 11 additions and 35 deletions

View file

@ -57,40 +57,6 @@ FG_USING_STD(vector);
FG_USING_STD(less); 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 // Material management class
class FGMaterialLib { class FGMaterialLib {

View file

@ -40,6 +40,7 @@
// Constructor // Constructor
FGNewMat::FGNewMat ( void ) { FGNewMat::FGNewMat ( void ) {
wrapu = wrapv = 1;
} }
@ -56,6 +57,7 @@ FGNewMat::FGNewMat ( const string &mat_name, const string &tex_name )
material_name = mat_name; material_name = mat_name;
texture_name = tex_name; texture_name = tex_name;
xsize = ysize = 0; xsize = ysize = 0;
wrapu = wrapv = 1;
alpha = 0; alpha = 0;
ambient[0] = ambient[1] = ambient[2] = ambient[3] = 1.0; ambient[0] = ambient[1] = ambient[2] = ambient[3] = 1.0;
diffuse[0] = diffuse[1] = diffuse[2] = diffuse[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->enable( GL_TEXTURE_2D );
textured->disable( GL_BLEND ); textured->disable( GL_BLEND );
textured->disable( GL_ALPHA_TEST ); 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->enable( GL_COLOR_MATERIAL );
textured->setColourMaterial( GL_AMBIENT_AND_DIFFUSE ); textured->setColourMaterial( GL_AMBIENT_AND_DIFFUSE );
textured->setMaterial( GL_EMISSION, 0, 0, 0, 1 ); textured->setMaterial( GL_EMISSION, 0, 0, 0, 1 );
@ -195,6 +198,10 @@ operator >> ( istream& in, FGNewMat& m )
in >> token >> m.xsize; in >> token >> m.xsize;
} else if ( token == "ysize" ) { } else if ( token == "ysize" ) {
in >> token >> m.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" ) { } else if ( token == "ambient" ) {
in >> token >> m.ambient[0] >> m.ambient[1] in >> token >> m.ambient[0] >> m.ambient[1]
>> m.ambient[2] >> m.ambient[3]; >> m.ambient[2] >> m.ambient[3];

View file

@ -73,6 +73,9 @@ private:
// texture size // texture size
double xsize, ysize; double xsize, ysize;
// wrap texture?
int wrapu, wrapv;
// material properties // material properties
sgVec4 ambient, diffuse, specular, emission; sgVec4 ambient, diffuse, specular, emission;