Refactored the computation of the transforms for the osgText::Text

This commit is contained in:
Robert Osfield
2017-02-21 17:07:53 +00:00
parent ad0e6a0f81
commit cd991eaa97
3 changed files with 326 additions and 7 deletions

View File

@@ -306,11 +306,24 @@ public:
Glyphs _glyphs;
Coords2 _coords;
#ifdef NEW_APPROACH
Coords3 _transformedCoords;
#else
osg::buffered_object<Coords3> _transformedCoords;
#endif
TexCoords _texcoords;
LineNumbers _lineNumbers;
#ifdef NEW_APPROACH
Coords3 _transformedBackdropCoords[8];
#else
osg::buffered_object<Coords3> _transformedBackdropCoords[8];
#endif
ColorCoords _colorCoords;
osg::ref_ptr<osg::DrawElementsUShort> _quadIndices;
@@ -328,6 +341,7 @@ public:
Coords2& getCoords() { return _coords; }
const Coords2& getCoords() const { return _coords; }
#ifndef NEW_APPROACH
Coords3& getTransformedCoords(unsigned int contexID) { return _transformedCoords[contexID]; }
const Coords3& getTransformedCoords(unsigned int contexID) const { return _transformedCoords[contexID]; }
@@ -336,6 +350,7 @@ public:
LineNumbers& getLineNumbers() { return _lineNumbers; }
const LineNumbers& getLineNumbers() const { return _lineNumbers; }
#endif
/** Resize any per context GLObject buffers to specified size. */
void resizeGLObjectBuffers(unsigned int maxSize);
@@ -371,6 +386,8 @@ protected:
virtual ~Text();
bool computeMatrix(osg::State& state, osg::Matrix& matrix) const;
Font* getActiveFont();
const Font* getActiveFont() const;

View File

@@ -20,6 +20,8 @@
#include <osgText/KerningType>
#include <osgText/Font>
#define NEW_APPROACH
namespace osgText {
@@ -318,8 +320,10 @@ protected:
int _width;
int _height;
osg::Vec3 _transformedPosition;
#ifndef NEW_APPROACH
osg::Matrix _modelview;
osg::Matrix _projection;
#endif
osg::Matrix _matrix;
};