((SGPropertyNode *)props)->getChildren("object-group");
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);
+ 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");
+ if (name)
+ glyphs[name] = new SGMaterialGlyph(glyph_nodes[i]);
+ }
}
ysize = 0;
wrapu = true;
wrapv = true;
+ xscale = 1;
+
mipmap = true;
light_coverage = 0.0;
shininess = 1.0;
_status.push_back( _internal_state( s, "", true ) );
}
+
+\f
+////////////////////////////////////////////////////////////////////////
+// SGMaterialGlyph.
+////////////////////////////////////////////////////////////////////////
+
+SGMaterialGlyph::SGMaterialGlyph(SGPropertyNode *p) :
+ _left(p->getDoubleValue("left", 0.0)),
+ _right(p->getDoubleValue("right", 1.0))
+{
+}
+
+
// end of mat.cxx
#include STL_STRING // Standard C++ string library
#include <vector>
+#include <map>
#include <plib/sg.h>
#include <plib/ssg.h>
SG_USING_STD(string);
SG_USING_STD(vector);
+SG_USING_STD(map);
+
+
+class SGMaterialGlyph;
/**
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.
+ */
+ virtual SGMaterialGlyph * get_glyph (const string& name) const {
+ map<string, SGMaterialGlyph *>::const_iterator it = glyphs.find(name);
+ return it != glyphs.end() ? it->second : 0;
+ }
+
protected:
\f
vector<SGSharedPtr<SGMatModelGroup> > object_groups;
+ // taxiway-/runway-sign elements
+ double xscale;
+ map<string, SGMaterialGlyph *> glyphs;
+
\f
////////////////////////////////////////////////////////////////////
// Internal constructors and methods.
};
+
+class SGMaterialGlyph {
+public:
+ SGMaterialGlyph(SGPropertyNode *);
+ inline double get_left() const { return _left; }
+ inline double get_right() const { return _right; }
+ inline double get_width() const { return _right - _left; }
+
+protected:
+ double _left;
+ double _right;
+};
+
#endif // _SG_MAT_HXX