Cleaned up types

This commit is contained in:
Robert Osfield 2017-02-23 18:14:36 +00:00
parent 8ff17ddf52
commit b5048d3b74
2 changed files with 15 additions and 17 deletions

View File

@ -299,20 +299,17 @@ public:
{
typedef std::vector<Glyph*> Glyphs;
typedef std::vector<unsigned int> LineNumbers;
typedef osg::ref_ptr<osg::Vec2Array> Coords2;
typedef osg::ref_ptr<osg::Vec3Array> Coords3;
typedef osg::ref_ptr<osg::Vec3Array> Coords;
typedef osg::ref_ptr<osg::Vec2Array> TexCoords;
typedef osg::ref_ptr<osg::Vec4Array> 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); }

View File

@ -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());