Moved Style and Bevel classes out into their own include/osgText/Style header.

Introduced GlyphGeometry class for handling the geometry data for rendering 3D text
This commit is contained in:
Robert Osfield
2010-09-24 12:57:55 +00:00
parent d9a133476a
commit c006c75615
8 changed files with 362 additions and 212 deletions

View File

@@ -21,88 +21,13 @@
#include <osgText/Font>
#include <osgText/String>
#include <osgText/Glyph>
#include <osgText/Style>
namespace osgText {
// forward declare
class TextNode;
class Glyph;
class OSGTEXT_EXPORT Bevel : public osg::Object
{
public:
Bevel();
Bevel(const Bevel& bevel, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgText, Bevel)
void setBevelThickness(float thickness) { _thickness = thickness; }
float getBevelThickness() const { return _thickness; }
void flatBevel(float width=0.25f);
void roundedBevel(float width=0.5f, unsigned int numSteps=10);
void roundedBevel2(float width=0.5f, unsigned int numSteps=10);
typedef std::vector<osg::Vec2> Vertices;
void setVertices(const Vertices& vertices) { _vertices = vertices; }
Vertices& getVertices() { return _vertices; }
const Vertices& getVertices() const { return _vertices; }
void print(std::ostream& fout);
protected:
float _thickness;
Vertices _vertices;
};
class OSGTEXT_EXPORT Style : public osg::Object
{
public:
Style();
Style(const Style& style, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgText, Style)
/// default Layout implementation used if no other is specified on TextNode
static osg::ref_ptr<Style>& getDefaultStyle();
/// NULL is no bevel
void setBevel(Bevel* bevel) { _bevel = bevel; }
const Bevel* getBevel() const { return _bevel.get(); }
/// 1 is the default width of the text
void setWidthRatio(float widthRatio) { _widthRatio = widthRatio; }
float getWidthRatio() const { return _widthRatio; }
/// 0 is 2D text
void setThicknessRatio(float thicknessRatio) { _thicknessRatio = thicknessRatio; }
float getThicknessRatio() const { return _thicknessRatio; }
/// 0 is off
void setOutlineRatio(float outlineRatio) { _outlineRatio = outlineRatio; }
float getOutlineRatio() const { return _outlineRatio; }
/// 1.0 is default number of samples
void setSampleDensity(float sd) { _sampleDensity = sd; }
float getSampleDensity() const { return _sampleDensity; }
protected:
osg::ref_ptr<Bevel> _bevel;
float _widthRatio;
float _thicknessRatio;
float _outlineRatio;
float _sampleDensity;
};
class OSGTEXT_EXPORT Layout : public osg::Object
{