Shifted set up of osgText related StateSet from osgText::Font into into osg::TextBase/Text to enable grater control over state required for specific Text implementations
This commit is contained in:
@@ -27,6 +27,7 @@ namespace osgText {
|
||||
|
||||
// forward declare Font
|
||||
class Font;
|
||||
class TextBase;
|
||||
|
||||
#ifdef OSG_PROVIDE_READFILE
|
||||
/** Read a font from specified file. The filename may contain a path.
|
||||
@@ -84,13 +85,9 @@ public:
|
||||
|
||||
static osg::ref_ptr<Font>& getDefaultFont();
|
||||
|
||||
void setTexEnv(osg::TexEnv* texenv) { if (texenv) _texenv = texenv; }
|
||||
inline osg::TexEnv* getTexEnv() { return _texenv.get(); }
|
||||
inline const osg::TexEnv* getTexEnv() const { return _texenv.get(); }
|
||||
|
||||
void setStateSet(osg::StateSet* stateset) { _stateset = stateset; }
|
||||
osg::StateSet* getStateSet() { return _stateset.get(); }
|
||||
const osg::StateSet* getStateSet() const { return _stateset.get(); }
|
||||
typedef std::vector< osg::ref_ptr<osg::StateSet> > StateSets;
|
||||
StateSets& getCachedStateSets() { return _statesets; }
|
||||
const StateSets& getCachedStateSets() const { return _statesets; }
|
||||
|
||||
|
||||
/** Get a kerning (adjustment of spacing of two adjacent character) for specified charcodes and a font resolution.*/
|
||||
@@ -188,7 +185,6 @@ protected:
|
||||
|
||||
void addGlyph(const FontResolution& fontRes, unsigned int charcode, Glyph* glyph);
|
||||
|
||||
typedef std::vector< osg::ref_ptr<osg::StateSet> > StateSetList;
|
||||
typedef std::map< unsigned int, osg::ref_ptr<Glyph> > GlyphMap;
|
||||
typedef std::map< unsigned int, osg::ref_ptr<Glyph3D> > Glyph3DMap;
|
||||
|
||||
@@ -197,8 +193,7 @@ protected:
|
||||
|
||||
mutable OpenThreads::Mutex _glyphMapMutex;
|
||||
|
||||
osg::ref_ptr<osg::TexEnv> _texenv;
|
||||
osg::ref_ptr<osg::StateSet> _stateset;
|
||||
StateSets _statesets;
|
||||
FontSizeGlyphMap _sizeGlyphMap;
|
||||
GlyphTextureList _glyphTextureList;
|
||||
|
||||
|
||||
@@ -36,16 +36,6 @@ public:
|
||||
virtual const char* className() const { return "Text"; }
|
||||
virtual const char* libraryName() const { return "osgText"; }
|
||||
|
||||
virtual void setFont(Font* font=0) { setFont(osg::ref_ptr<Font>(font)); };
|
||||
|
||||
/** Set the Font to use to render the text.*/
|
||||
virtual void setFont(osg::ref_ptr<Font> font);
|
||||
|
||||
/** Set the font, loaded from the specified front file, to use to render the text,
|
||||
* setFont("") sets the use of the default font.
|
||||
* See the osgText::readFontFile function for how the font file will be located. */
|
||||
virtual void setFont(const std::string& fontfile) { TextBase::setFont(fontfile); }
|
||||
|
||||
/**
|
||||
* Turns off writing to the depth buffer when rendering text. This only affects text
|
||||
* with no backdrop or text using the DELAYED_DEPTH_WRITES implementation, since
|
||||
@@ -92,7 +82,9 @@ public:
|
||||
* buffer. But if you don't need the depth buffer updated for
|
||||
* your, this extra pass can be disabled by calling
|
||||
* enableDepthWrites(false).*/
|
||||
DELAYED_DEPTH_WRITES
|
||||
DELAYED_DEPTH_WRITES,
|
||||
|
||||
USE_SHADERS
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -284,6 +276,8 @@ protected:
|
||||
|
||||
virtual ~Text();
|
||||
|
||||
virtual osg::StateSet* createStateSet();
|
||||
|
||||
Font* getActiveFont();
|
||||
const Font* getActiveFont() const;
|
||||
|
||||
|
||||
@@ -284,6 +284,10 @@ protected:
|
||||
|
||||
virtual ~TextBase();
|
||||
|
||||
virtual osg::StateSet* createStateSet();
|
||||
|
||||
virtual void assignStateSet();
|
||||
|
||||
void initArraysAndBuffers();
|
||||
|
||||
osg::VertexArrayState* createVertexArrayState(osg::RenderInfo& renderInfo) const;
|
||||
|
||||
Reference in New Issue
Block a user