From e5685dfca530dda39c1032b28218af07866d9045 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 27 Feb 2017 15:15:37 +0000 Subject: [PATCH] Removed old code paths --- include/osgText/Text | 4 -- src/osgText/Text.cpp | 125 ++----------------------------------------- 2 files changed, 3 insertions(+), 126 deletions(-) diff --git a/include/osgText/Text b/include/osgText/Text index 879e3f8f6..20a65f196 100644 --- a/include/osgText/Text +++ b/include/osgText/Text @@ -308,11 +308,7 @@ public: Glyphs _glyphs; Coords _coords; ColorCoords _colorCoords; - TexCoords _texcoords; -#ifndef NEW_APPROACH - Coords _transformedBackdropCoords[8]; -#endif Primitives _primitives; diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index f00db7e94..6bbca9971 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -629,10 +629,8 @@ void Text::computeBackdropPositions() unsigned int numCoords = glyphquad._glyphs.size()*4; GlyphQuads::Coords& coords = glyphquad._coords; - -#ifdef NEW_APPROACH GlyphQuads::TexCoords& texcoords = glyphquad._texcoords; -#endif + unsigned int backdrop_index; unsigned int max_backdrop_index; if(_backdropType == OUTLINE) @@ -658,12 +656,7 @@ void Text::computeBackdropPositions() } for( ; backdrop_index < max_backdrop_index; backdrop_index++) { -#ifdef NEW_APPROACH GlyphQuads::Coords& transformedCoords = glyphquad._coords; -#else - GlyphQuads::Coords& transformedCoords = glyphquad._transformedBackdropCoords[backdrop_index]; - if (!transformedCoords) transformedCoords = new osg::Vec3Array(); -#endif for(i=0;idirty(); } } } @@ -1456,25 +1447,14 @@ void Text::drawTextWithBackdrop(osg::State& state, const osg::Vec4& colorMultipl max_backdrop_index = _backdropType+1; } -#ifdef NEW_APPROACH state.setVertexPointer(glyphquad._coords.get()); -#endif state.setTexCoordPointer(0, glyphquad._texcoords.get()); state.disableColorPointer(); state.Color(_backdropColor.r(),_backdropColor.g(),_backdropColor.b(),_backdropColor.a()); for( ; backdrop_index < max_backdrop_index; backdrop_index++) { -#ifdef NEW_APPROACH glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); -#else - const GlyphQuads::Coords& transformedCoords = glyphquad._transformedBackdropCoords[backdrop_index]; - if (transformedCoords.valid() && !transformedCoords->empty()) - { - state.setVertexPointer(transformedCoords.get()); - glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); - } -#endif } } @@ -1518,27 +1498,15 @@ void Text::renderWithPolygonOffset(osg::State& state, const osg::Vec4& colorMult max_backdrop_index = _backdropType+1; } -#ifdef NEW_APPROACH state.setVertexPointer(glyphquad._coords.get()); -#endif state.setTexCoordPointer( 0, glyphquad._texcoords.get()); state.disableColorPointer(); state.Color(_backdropColor.r(),_backdropColor.g(),_backdropColor.b(),_backdropColor.a()); for( ; backdrop_index < max_backdrop_index; backdrop_index++) { -#ifdef NEW_APPROACH glPolygonOffset(0.1f * osg::PolygonOffset::getFactorMultiplier(), osg::PolygonOffset::getUnitsMultiplier() * (max_backdrop_index-backdrop_index) ); glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); -#else - const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; - if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) - { - glPolygonOffset(0.1f * osg::PolygonOffset::getFactorMultiplier(), osg::PolygonOffset::getUnitsMultiplier() * (max_backdrop_index-backdrop_index) ); - state.setVertexPointer( transformedBackdropCoords.get()); - glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); - } -#endif } // Reset the polygon offset so the foreground text is on top @@ -1583,25 +1551,14 @@ void Text::renderWithNoDepthBuffer(osg::State& state, const osg::Vec4& colorMult max_backdrop_index = _backdropType+1; } -#ifdef NEW_APPROACH state.setVertexPointer(glyphquad._coords.get()); -#endif state.setTexCoordPointer( 0, glyphquad._texcoords.get()); state.disableColorPointer(); state.Color(_backdropColor.r(),_backdropColor.g(),_backdropColor.b(),_backdropColor.a()); for( ; backdrop_index < max_backdrop_index; backdrop_index++) { -#ifdef NEW_APPROACH glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); -#else - const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; - if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) - { - state.setVertexPointer( transformedBackdropCoords.get()); - glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); - } -#endif } drawForegroundText(state, glyphquad, colorMultiplier); @@ -1645,30 +1602,16 @@ void Text::renderWithDepthRange(osg::State& state, const osg::Vec4& colorMultipl max_backdrop_index = _backdropType+1; } -#ifdef NEW_APPROACH state.setVertexPointer(glyphquad._coords.get()); -#endif state.setTexCoordPointer( 0, glyphquad._texcoords.get()); state.disableColorPointer(); state.Color(_backdropColor.r(),_backdropColor.g(),_backdropColor.b(),_backdropColor.a()); for( ; backdrop_index < max_backdrop_index; backdrop_index++) { -#ifdef NEW_APPROACH double offset = double(max_backdrop_index-backdrop_index)*0.0001; glDepthRange( offset, 1.0+offset); glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); -#else - const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; - if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) - { - double offset = double(max_backdrop_index-backdrop_index)*0.0001; - glDepthRange( offset, 1.0+offset); - - state.setVertexPointer( transformedBackdropCoords.get()); - glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); - } -#endif } glDepthRange(0.0, 1.0); @@ -1752,24 +1695,13 @@ void Text::renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMult max_backdrop_index = _backdropType+1; } -#ifdef NEW_APPROACH state.setVertexPointer(glyphquad._coords.get()); -#endif state.setTexCoordPointer( 0, glyphquad._texcoords.get()); state.disableColorPointer(); for( ; backdrop_index < max_backdrop_index; backdrop_index++) { -#ifdef NEW_APPROACH glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); -#else - const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; - if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) - { - state.setVertexPointer( transformedBackdropCoords.get()); - glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); - } -#endif } // Draw the foreground text @@ -1822,25 +1754,14 @@ void Text::renderWithStencilBuffer(osg::State& state, const osg::Vec4& colorMult max_backdrop_index = _backdropType+1; } -#ifdef NEW_APPROACH state.setVertexPointer(glyphquad._coords.get()); -#endif state.setTexCoordPointer( 0, glyphquad._texcoords.get()); state.disableColorPointer(); state.Color(_backdropColor.r(),_backdropColor.g(),_backdropColor.b(),_backdropColor.a()); for( ; backdrop_index < max_backdrop_index; backdrop_index++) { -#ifdef NEW_APPROACH glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); -#else - const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; - if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) - { - state.setVertexPointer( transformedBackdropCoords.get()); - glyphquad._primitives[backdrop_index+1]->draw(state, _useVertexBufferObjects); - } -#endif } drawForegroundText(state, glyphquad, colorMultiplier); @@ -1867,14 +1788,6 @@ void Text::GlyphQuads::initGlyphQuads() _coords = new osg::Vec3Array(); _texcoords = new osg::Vec2Array(); _colorCoords = new osg::Vec4Array(); - -#ifndef NEW_APPROACH - for (int j = 0; j < 8; j++) - { - _transformedBackdropCoords[j] = new osg::Vec3Array(); - _primitives.push_back(new DrawElementsUShort(PrimitiveSet::TRIANGLES)); - } -#endif } void Text::GlyphQuads::setupPrimitives(BackdropType backdropType) @@ -1902,9 +1815,6 @@ void Text::GlyphQuads::setupPrimitives(BackdropType backdropType) DrawElementsUShort* indices = itr->get(); indices->clear(); -#ifndef NEW_APPROACH - baseIndex = 0; -#endif unsigned int endIndex = baseIndex + numCoords; for (unsigned short i = baseIndex; i < endIndex; i += 4) { @@ -1930,16 +1840,6 @@ void Text::GlyphQuads::initGPUBufferObjects() _colorCoords->setBinding(osg::Array::BIND_PER_VERTEX); _colorCoords->setVertexBufferObject(vbo); -#ifndef NEW_APPROACH - for (int j = 0; j < 8; j++) - { - if (_transformedBackdropCoords[j].valid()) - { - _transformedBackdropCoords[j]->setBinding(osg::Array::BIND_PER_VERTEX); - _transformedBackdropCoords[j]->setVertexBufferObject(vbo); - } - } -#endif osg::ref_ptr ebo = new osg::ElementBufferObject(); for(Primitives::iterator itr = _primitives.begin(); itr != _primitives.end(); @@ -1957,15 +1857,6 @@ void Text::GlyphQuads::resizeGLObjectBuffers(unsigned int maxSize) _texcoords->resizeGLObjectBuffers(maxSize); _colorCoords->resizeGLObjectBuffers(maxSize); -#ifndef NEW_APPROACH - for (int j = 0; j < 8; j++) - { - if (_transformedBackdropCoords[j].valid()) - { - _transformedBackdropCoords[j]->resizeGLObjectBuffers(maxSize); - } - } -#endif for(Primitives::iterator itr = _primitives.begin(); itr != _primitives.end(); ++itr) @@ -1982,16 +1873,6 @@ void Text::GlyphQuads::releaseGLObjects(osg::State* state) const _texcoords->releaseGLObjects(state); _colorCoords->releaseGLObjects(state); -#ifndef NEW_APPROACH - for (int j = 0; j < 8; j++) - { - if (_transformedBackdropCoords[j].valid()) - { - _transformedBackdropCoords[j]->releaseGLObjects(state); - } - } -#endif - for(Primitives::const_iterator itr = _primitives.begin(); itr != _primitives.end(); ++itr)