drop xscale member again, and use xsize/ysize instead. (One interface

element less to confuse people.)
This commit is contained in:
mfranz
2006-04-10 15:32:55 +00:00
parent cd143c15d5
commit dbda8ef893
3 changed files with 10 additions and 14 deletions

View File

@@ -160,8 +160,7 @@ SGMaterial::read_properties( const string &fg_root, const SGPropertyNode * props
for (unsigned int i = 0; i < object_group_nodes.size(); i++)
object_groups.push_back(new SGMatModelGroup(object_group_nodes[i]));
// handling of glyphs for taxi-/runway-signs
xscale = props->getDoubleValue("xscale", 1.0);
// read glyph table for taxi-/runway-signs
vector<SGPropertyNode_ptr> glyph_nodes = props->getChildren("glyph");
for (unsigned int i = 0; i < glyph_nodes.size(); i++) {
const char *name = glyph_nodes[i]->getStringValue("name");
@@ -185,7 +184,6 @@ SGMaterial::init ()
ysize = 0;
wrapu = true;
wrapv = true;
xscale = 1;
mipmap = true;
light_coverage = 0.0;

View File

@@ -168,11 +168,6 @@ public:
return object_groups[index];
}
/**
* Get the horizontal scaling factor for runway/taxiway signs.
*/
virtual inline double get_xscale() const { return xscale; }
/**
* Return pointer to glyph class, or 0 if it doesn't exist.
*/
@@ -234,8 +229,7 @@ private:
vector<SGSharedPtr<SGMatModelGroup> > object_groups;
// taxiway-/runway-sign elements
double xscale;
// taxiway-/runway-sign texture elements
map<string, SGMaterialGlyph *> glyphs;

View File

@@ -38,9 +38,12 @@
// for temporary storage of sign elements
struct element_info {
element_info(SGMaterial *m, SGMaterialGlyph *g) : material(m), glyph(g) {}
element_info(SGMaterial *m, SGMaterialGlyph *g) : material(m), glyph(g) {
scale = m->get_xsize() / (m->get_ysize() < 0.001 ? 1.0 : m->get_ysize());
}
SGMaterial *material;
SGMaterialGlyph *glyph;
double scale;
};
@@ -154,8 +157,9 @@ ssgBranch *sgMakeTaxiSign( SGMaterialLib *matlib,
continue;
}
elements.push_back(new element_info(material, glyph));
total_width += glyph->get_width() * material->get_xscale();
element_info *e = new element_info(material, glyph);
elements.push_back(e);
total_width += glyph->get_width() * e->scale;
}
double hpos = -total_width / 2;
@@ -171,7 +175,7 @@ ssgBranch *sgMakeTaxiSign( SGMaterialLib *matlib,
double xoffset = element->glyph->get_left();
double width = element->glyph->get_width();
double abswidth = width * element->material->get_xscale();
double abswidth = width * element->scale;
// vertices
ssgVertexArray *vl = new ssgVertexArray(4);