Added the option for changing the type of the GlyphQuads::Coords

This commit is contained in:
Robert Osfield
2017-02-22 12:07:43 +00:00
parent f8dc5c4988
commit 04d23659b3
4 changed files with 85 additions and 53 deletions

View File

@@ -304,9 +304,14 @@ public:
typedef osg::ref_ptr<osg::Vec2Array> TexCoords;
typedef osg::ref_ptr<osg::Vec4Array> ColorCoords;
Glyphs _glyphs;
Coords2 _coords;
#ifdef NEW_APPROACH
typedef Coords3 Coords;
#else
typedef Coords2 Coords;
#endif
Glyphs _glyphs;
Coords _coords;
#ifdef NEW_APPROACH
Coords3 _transformedCoords;
@@ -338,8 +343,26 @@ public:
Glyphs& getGlyphs() { return _glyphs; }
const Glyphs& getGlyphs() const { return _glyphs; }
#ifdef NEW_APPROACH
void addCoord(const osg::Vec2& c) { _coords->push_back(osg::Vec3(c.x(), c.y(), 0.0f)); }
void getCoord(unsigned int i, osg::Vec2& c) const { c.set((*_coords)[i].x(), (*_coords)[i].y()); }
void getCoord(unsigned int i, osg::Vec3& c) const { c = (*_coords)[i]; }
Coords3& getCoords() { return _coords; }
const Coords3& getCoords() const { return _coords; }
#else
void addCoord(const osg::Vec2& c) { _coords->push_back(c); }
void getCoord(unsigned int i, osg::Vec2& c) const { c = (*_coords)[i]; }
void getCoord(unsigned int i, osg::Vec3& c) const { c.set((*_coords)[i].x(), (*_coords)[i].y(), 0.0f); }
Coords2& getCoords() { return _coords; }
const Coords2& getCoords() const { return _coords; }
#endif
void addTexCoord(const osg::Vec2& tc) { _texcoords->push_back(tc); }
#ifndef NEW_APPROACH
Coords3& getTransformedCoords(unsigned int contexID) { return _transformedCoords[contexID]; }