1
0
Fork 0

Moved material property and texture management back to Simulator/Objects/

Working on scalable texture sizes.
This commit is contained in:
curt 1999-05-13 02:24:55 +00:00
parent 2cd7fb198e
commit d4988dc104
4 changed files with 21 additions and 11 deletions

View file

@ -2,7 +2,9 @@ noinst_LIBRARIES = libObjects.a
libObjects_a_SOURCES = \
fragment.cxx fragment.hxx \
material.cxx material.hxx \
materialmgr.cxx materialmgr.hxx \
obj.cxx obj.hxx
obj.cxx obj.hxx \
texload.c texload.h colours.h
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator

View file

@ -46,7 +46,6 @@
#include <Misc/fgstream.hxx>
#include <Main/options.hxx>
#include <Main/views.hxx>
#include <Misc/texload.h>
#include <Scenery/tile.hxx>
#include "materialmgr.hxx"
@ -62,6 +61,7 @@ fgMATERIAL_MGR material_mgr;
// Constructor
FGMaterialSlot::FGMaterialSlot ( void ) { }
// Destructor
FGMaterialSlot::~FGMaterialSlot ( void ) {
}
@ -158,7 +158,7 @@ fgMATERIAL_MGR::load_lib ( 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;

View file

@ -46,7 +46,7 @@
#include <map> // STL associative "array"
#include <vector> // STL "array"
#include <Misc/material.hxx>
#include "material.hxx"
FG_USING_STD(string);
FG_USING_STD(map);
@ -123,6 +123,7 @@ public:
// friend istream& operator >> ( istream& in, FGMaterialSlot& m );
inline FGMaterial get_m() const { return m; }
inline void set_m( FGMaterial new_m ) { m = new_m; }
};

View file

@ -142,6 +142,7 @@ int fgObjLoad( const string& path, fgTILE *t) {
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() );
@ -242,7 +243,13 @@ int fgObjLoad( const string& path, fgTILE *t) {
"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++ ) {
@ -414,8 +421,8 @@ int fgObjLoad( const string& path, fgTILE *t) {
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);
@ -427,8 +434,8 @@ int fgObjLoad( const string& path, fgTILE *t) {
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);
@ -454,8 +461,8 @@ int fgObjLoad( const string& path, fgTILE *t) {
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);