From b5048d3b7464c102eabaa0b252928744106c017d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 23 Feb 2017 18:14:36 +0000 Subject: [PATCH] Cleaned up types --- include/osgText/Text | 12 +++++------- src/osgText/Text.cpp | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/include/osgText/Text b/include/osgText/Text index af16bc743..e8f89bb7e 100644 --- a/include/osgText/Text +++ b/include/osgText/Text @@ -299,20 +299,17 @@ public: { typedef std::vector Glyphs; typedef std::vector LineNumbers; - typedef osg::ref_ptr Coords2; - typedef osg::ref_ptr Coords3; + typedef osg::ref_ptr Coords; typedef osg::ref_ptr TexCoords; typedef osg::ref_ptr ColorCoords; - typedef Coords3 Coords; - Glyphs _glyphs; Coords _coords; TexCoords _texcoords; LineNumbers _lineNumbers; - Coords3 _transformedBackdropCoords[8]; + Coords _transformedBackdropCoords[8]; ColorCoords _colorCoords; @@ -329,12 +326,13 @@ public: const Glyphs& getGlyphs() const { return _glyphs; } void addCoord(const osg::Vec2& c) { _coords->push_back(osg::Vec3(c.x(), c.y(), 0.0f)); } + void addCoord(const osg::Vec3& c) { _coords->push_back(c); } 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; } + Coords& getCoords() { return _coords; } + const Coords& getCoords() const { return _coords; } void addTexCoord(const osg::Vec2& tc) { _texcoords->push_back(tc); } diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index b1c11c6f3..186d00bd1 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -190,7 +190,7 @@ String::iterator Text::computeLastCharacterOnLine(osg::Vec2& cursor, String::ite if (lastChar!=last) { String::iterator lastValidChar = lastChar; - String::iterator prevChar; + String::iterator prevChar; while (lastValidChar != first){ prevChar = lastValidChar - 1; @@ -656,7 +656,7 @@ void Text::computeBackdropPositions() } for( ; backdrop_index < max_backdrop_index; backdrop_index++) { - GlyphQuads::Coords3& transformedCoords = glyphquad._transformedBackdropCoords[backdrop_index]; + GlyphQuads::Coords& transformedCoords = glyphquad._transformedBackdropCoords[backdrop_index]; if (!transformedCoords) transformedCoords = new osg::Vec3Array(); @@ -1365,7 +1365,7 @@ float Text::bilinearInterpolate(float x1, float x2, float y1, float y2, float x, void Text::drawForegroundText(osg::State& state, const GlyphQuads& glyphquad, const osg::Vec4& colorMultiplier) const { - const GlyphQuads::Coords3& transformedCoords = glyphquad._coords; + const GlyphQuads::Coords& transformedCoords = glyphquad._coords; if (transformedCoords.valid() && !transformedCoords->empty()) { @@ -1461,7 +1461,7 @@ void Text::drawTextWithBackdrop(osg::State& state, const osg::Vec4& colorMultipl for( ; backdrop_index < max_backdrop_index; backdrop_index++) { - const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; + const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) { state.setVertexPointer(transformedBackdropCoords.get()); @@ -1516,7 +1516,7 @@ void Text::renderWithPolygonOffset(osg::State& state, const osg::Vec4& colorMult for( ; backdrop_index < max_backdrop_index; backdrop_index++) { - const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; + const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) { state.setVertexPointer( transformedBackdropCoords.get()); @@ -1574,7 +1574,7 @@ void Text::renderWithNoDepthBuffer(osg::State& state, const osg::Vec4& colorMult for( ; backdrop_index < max_backdrop_index; backdrop_index++) { - const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; + const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) { state.setVertexPointer( transformedBackdropCoords.get()); @@ -1629,7 +1629,7 @@ void Text::renderWithDepthRange(osg::State& state, const osg::Vec4& colorMultipl for( ; backdrop_index < max_backdrop_index; backdrop_index++) { - const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; + const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) { state.setVertexPointer( transformedBackdropCoords.get()); @@ -1726,7 +1726,7 @@ void Text::renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMult for( ; backdrop_index < max_backdrop_index; backdrop_index++) { - const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; + const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) { state.setVertexPointer( transformedBackdropCoords.get()); @@ -1735,7 +1735,7 @@ void Text::renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMult } // Draw the foreground text - const GlyphQuads::Coords3& transformedCoords = glyphquad._coords; + const GlyphQuads::Coords& transformedCoords = glyphquad._coords; if (transformedCoords.valid() && !transformedCoords->empty()) { state.setVertexPointer( transformedCoords.get()); @@ -1794,7 +1794,7 @@ void Text::renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMult for( ; backdrop_index < max_backdrop_index; backdrop_index++) { - const GlyphQuads::Coords3& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; + const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) { state.setVertexPointer( transformedBackdropCoords.get());