1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
15#define OSGTEXT_STYLE 1
19#include <osgText/Export>
27class OSGTEXT_EXPORT Bevel : public osg::Object
32 Bevel(const Bevel& bevel, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
34 META_Object(osgText, Bevel)
36 bool operator == (const Bevel& rhs) const
38 if (_smoothConcaveJunctions != rhs._smoothConcaveJunctions) return false;
39 if (_thickness != rhs._thickness) return false;
40 return _vertices==rhs._vertices;
43 void setSmoothConcaveJunctions(bool flag) { _smoothConcaveJunctions = flag; }
44 bool getSmoothConcaveJunctions() const { return _smoothConcaveJunctions; }
46 void setBevelThickness(float thickness) { _thickness = thickness; }
47 float getBevelThickness() const { return _thickness; }
49 void flatBevel(float width=0.25f);
51 void roundedBevel(float width=0.5f, unsigned int numSteps=10);
53 void roundedBevel2(float width=0.5f, unsigned int numSteps=10);
55 typedef std::vector<osg::Vec2> Vertices;
57 void setVertices(const Vertices& vertices) { _vertices = vertices; }
58 Vertices& getVertices() { return _vertices; }
59 const Vertices& getVertices() const { return _vertices; }
61 void print(std::ostream& fout);
65 bool _smoothConcaveJunctions;
71class OSGTEXT_EXPORT Style : public osg::Object
76 Style(const Style& style, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
78 META_Object(osgText, Style);
80 /// default Layout implementation used if no other is specified on TextNode
81 static osg::ref_ptr<Style>& getDefaultStyle();
83 bool operator == (const Style& style) const;
86 void setBevel(Bevel* bevel) { _bevel = bevel; }
87 const Bevel* getBevel() const { return _bevel.get(); }
90 /// 1 is the default width of the text
91 void setWidthRatio(float widthRatio) { _widthRatio = widthRatio; }
92 float getWidthRatio() const { return _widthRatio; }
95 void setThicknessRatio(float thicknessRatio) { _thicknessRatio = thicknessRatio; }
96 float getThicknessRatio() const { return _thicknessRatio; }
99 void setOutlineRatio(float outlineRatio) { _outlineRatio = outlineRatio; }
100 float getOutlineRatio() const { return _outlineRatio; }
102 /// 1.0 is default number of samples
103 void setSampleDensity(float sd) { _sampleDensity = sd; }
104 float getSampleDensity() const { return _sampleDensity; }
108 osg::ref_ptr<Bevel> _bevel;
111 float _thicknessRatio;
113 float _sampleDensity;