Add support in materials file for non-repeating textures.
This commit is contained in:
parent
927aa90378
commit
faeb25940e
3 changed files with 11 additions and 35 deletions
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -73,6 +73,9 @@ private:
|
|||
// texture size
|
||||
double xsize, ysize;
|
||||
|
||||
// wrap texture?
|
||||
int wrapu, wrapv;
|
||||
|
||||
// material properties
|
||||
sgVec4 ambient, diffuse, specular, emission;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue