Refactored osgText::Tex3D to use a single vertex and normal arrays and a combined set of primitive sets. Deprecated Text3D::RenderMode as it's no longer used.

This commit is contained in:
Robert Osfield
2017-03-02 16:11:10 +00:00
parent 4721651dbe
commit a69216a79d
2 changed files with 38 additions and 241 deletions

View File

@@ -25,13 +25,7 @@ class OSGTEXT_EXPORT Text3D : public osgText::TextBase
{
public:
/** Reder mode used to render the Text.
* PER_FACE : render all front face with the default StateSet
* all wall face with the wall StateSet
* all back face with the back StateSet (back face of the character, no the OpenGL back face)
*
* PER_GLYPH : render all Charactere with the default StateSet
*/
/** Deprecated.*/
enum RenderMode
{
PER_FACE,
@@ -49,10 +43,10 @@ class OSGTEXT_EXPORT Text3D : public osgText::TextBase
/** Set the Charactere Depth of text. */
void setCharacterDepth(float characterDepth);
/** Get the render mode used to render the text. */
/** Deprecated, value is now ignored. */
RenderMode getRenderMode() const { return _renderMode; }
/** Set the render mode used to render the text. */
void setRenderMode(RenderMode renderMode) { _renderMode = renderMode; computeGlyphRepresentation(); }
/** Deprecated, value is now ignored. */
void setRenderMode(RenderMode renderMode) { _renderMode = renderMode; }
/** Get the wall StateSet */
@@ -120,13 +114,12 @@ class OSGTEXT_EXPORT Text3D : public osgText::TextBase
virtual ~Text3D() {}
void renderPerGlyph(osg::State & state) const;
void renderPerFace(osg::State & state) const;
String::iterator computeLastCharacterOnLine(osg::Vec2& cursor, String::iterator first,String::iterator last);
void computeGlyphRepresentation();
void copyAndOffsetPrimitiveSets(osg::Geometry::PrimitiveSetList& dest_PrimitiveSetList, osg::Geometry::PrimitiveSetList& src_PrimitiveSetList, unsigned int offset);
osg::Geometry::PrimitiveSetList _frontPrimitiveSetList;
osg::Geometry::PrimitiveSetList _wallPrimitiveSetList;
osg::Geometry::PrimitiveSetList _backPrimitiveSetList;
@@ -147,7 +140,7 @@ class OSGTEXT_EXPORT Text3D : public osgText::TextBase
TextRenderInfo _textRenderInfo;
// deprecated value no longer used.
RenderMode _renderMode;
osg::ref_ptr<osg::StateSet> _wallStateSet;