#include <Misc/fgstream.hxx>
#include <Main/options.hxx>
#include <Main/views.hxx>
-#include <Misc/texload.h>
#include <Scenery/tile.hxx>
#include "materialmgr.hxx"
// Constructor
FGMaterialSlot::FGMaterialSlot ( void ) { }
+
// Destructor
FGMaterialSlot::~FGMaterialSlot ( void ) {
}
in >> m;
// if ( current_options.get_textures() ) {
- // m.load_texture( current_options.get_fg_root() );
+ // m.load_texture( current_options.get_fg_root() );
// }
FGMaterialSlot m_slot;
#include <map> // STL associative "array"
#include <vector> // STL "array"
-#include <Misc/material.hxx>
+#include "material.hxx"
FG_USING_STD(string);
FG_USING_STD(map);
// friend istream& operator >> ( istream& in, FGMaterialSlot& m );
+ inline FGMaterial get_m() const { return m; }
inline void set_m( FGMaterial new_m ) { m = new_m; }
};
int last1 = 0, last2 = 0, odd = 0;
double (*nodes)[3];
Point3D center;
+ double tex_width = 1000.0, tex_height = 1000.0;
// printf("loading %s\n", path.c_str() );
"Ack! unknown usemtl name = " << material
<< " in " << path );
}
-
+
+ // set the texture width and height values for this
+ // material
+ FGMaterial m = fragment.material_ptr->get_m();
+ tex_width = m.get_xsize();
+ tex_height = m.get_ysize();
+ cout << "(w) = " << tex_width << " (h) = " << tex_width << endl;
// initialize the fragment transformation matrix
/*
for ( i = 0; i < 16; i++ ) {
xglNormal3dv(normals[n1]);
if ( in.get( c ) && c == '/' ) {
in >> tex;
- pp.setx( tex_coords[tex][0] );
- pp.sety( tex_coords[tex][1] );
+ pp.setx( tex_coords[tex][0] * (1000.0 / tex_width) );
+ pp.sety( tex_coords[tex][1] * (1000.0 / tex_height) );
} else {
in.putback( c );
pp = calc_tex_coords(nodes[n1], center);
xglNormal3dv(normals[n2]);
if ( in.get( c ) && c == '/' ) {
in >> tex;
- pp.setx( tex_coords[tex][0] );
- pp.sety( tex_coords[tex][1] );
+ pp.setx( tex_coords[tex][0] * (1000.0 / tex_width) );
+ pp.sety( tex_coords[tex][1] * (1000.0 / tex_height) );
} else {
in.putback( c );
pp = calc_tex_coords(nodes[n2], center);
xglNormal3dv(normals[n3]);
if ( in.get( c ) && c == '/' ) {
in >> tex;
- pp.setx( tex_coords[tex][0] );
- pp.sety( tex_coords[tex][1] );
+ pp.setx( tex_coords[tex][0] * (1000.0 / tex_width) );
+ pp.sety( tex_coords[tex][1] * (1000.0 / tex_height) );
} else {
in.putback( c );
pp = calc_tex_coords(nodes[n3], center);