From: mfranz Date: Mon, 10 Apr 2006 15:32:55 +0000 (+0000) Subject: drop xscale member again, and use xsize/ysize instead. (One interface X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dbda8ef893995d2a65434f5701371fc815684ad9;p=simgear.git drop xscale member again, and use xsize/ysize instead. (One interface element less to confuse people.) --- diff --git a/simgear/scene/material/mat.cxx b/simgear/scene/material/mat.cxx index 37bf0491..8606e616 100644 --- a/simgear/scene/material/mat.cxx +++ b/simgear/scene/material/mat.cxx @@ -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 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; diff --git a/simgear/scene/material/mat.hxx b/simgear/scene/material/mat.hxx index 93c28777..8631fdc1 100644 --- a/simgear/scene/material/mat.hxx +++ b/simgear/scene/material/mat.hxx @@ -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 > object_groups; - // taxiway-/runway-sign elements - double xscale; + // taxiway-/runway-sign texture elements map glyphs; diff --git a/simgear/scene/tgdb/apt_signs.cxx b/simgear/scene/tgdb/apt_signs.cxx index 175e5c6f..2f80afe3 100644 --- a/simgear/scene/tgdb/apt_signs.cxx +++ b/simgear/scene/tgdb/apt_signs.cxx @@ -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);