osgText/Style
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGTEXT_STYLE
#define OSGTEXT_STYLE 1
#include <osg/Object>
#include <osg/Vec2>
#include <osgText/Export>
#include <iosfwd>
#include <vector>
namespace osgText
{
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)
bool operator == (const Bevel& rhs) const
{
if (_smoothConcaveJunctions != rhs._smoothConcaveJunctions) return false;
if (_thickness != rhs._thickness) return false;
return _vertices==rhs._vertices;
}
void setSmoothConcaveJunctions(bool flag) { _smoothConcaveJunctions = flag; }
bool getSmoothConcaveJunctions() const { return _smoothConcaveJunctions; }
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:
bool _smoothConcaveJunctions;
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);
static osg::ref_ptr<Style>& getDefaultStyle();
bool operator == (const Style& style) const;
void setBevel(Bevel* bevel) { _bevel = bevel; }
const Bevel* getBevel() const { return _bevel.get(); }
void setWidthRatio(float widthRatio) { _widthRatio = widthRatio; }
float getWidthRatio() const { return _widthRatio; }
void setThicknessRatio(float thicknessRatio) { _thicknessRatio = thicknessRatio; }
float getThicknessRatio() const { return _thicknessRatio; }
void setOutlineRatio(float outlineRatio) { _outlineRatio = outlineRatio; }
float getOutlineRatio() const { return _outlineRatio; }
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;
};
}
#endif
Object
Vec2
osgText::Bevel
Definition osgText/Style:28
osgText::Bevel::Vertices
std::vector< osg::Vec2 > Vertices
Definition osgText/Style:55
osgText::Bevel::Bevel
Bevel()
osgText::Bevel::setVertices
void setVertices(const Vertices &vertices)
Definition osgText/Style:57
osgText::Bevel::roundedBevel
void roundedBevel(float width=0.5f, unsigned int numSteps=10)
osgText::Bevel::print
void print(std::ostream &fout)
osgText::Bevel::_vertices
Vertices _vertices
Definition osgText/Style:67
osgText::Bevel::_smoothConcaveJunctions
bool _smoothConcaveJunctions
Definition osgText/Style:65
osgText::Bevel::getVertices
Vertices & getVertices()
Definition osgText/Style:58
osgText::Bevel::META_Object
META_Object(osgText, Bevel) bool operator
osgText::Bevel::getVertices
const Vertices & getVertices() const
Definition osgText/Style:59
osgText::Bevel::Bevel
Bevel(const Bevel &bevel, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgText::Bevel::roundedBevel2
void roundedBevel2(float width=0.5f, unsigned int numSteps=10)
osgText::Bevel::_thickness
float _thickness
Definition osgText/Style:66
osgText::Style::_sampleDensity
float _sampleDensity
Definition osgText/Style:113
osgText::Style::setOutlineRatio
void setOutlineRatio(float outlineRatio)
0 is off
Definition osgText/Style:99
osgText::Style::getBevel
const Bevel * getBevel() const
Definition osgText/Style:87
osgText::Style::_thicknessRatio
float _thicknessRatio
Definition osgText/Style:111
osgText::Style::_bevel
osg::ref_ptr< Bevel > _bevel
Definition osgText/Style:108
osgText::Style::getSampleDensity
float getSampleDensity() const
Definition osgText/Style:104
osgText::Style::setWidthRatio
void setWidthRatio(float widthRatio)
1 is the default width of the text
Definition osgText/Style:91
osgText::Style::getOutlineRatio
float getOutlineRatio() const
Definition osgText/Style:100
osgText::Style::getWidthRatio
float getWidthRatio() const
Definition osgText/Style:92
osgText::Style::Style
Style(const Style &style, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgText::Style::getThicknessRatio
float getThicknessRatio() const
Definition osgText/Style:96
osgText::Style::setBevel
void setBevel(Bevel *bevel)
NULL is no bevel.
Definition osgText/Style:86
osgText::Style::setThicknessRatio
void setThicknessRatio(float thicknessRatio)
0 is 2D text
Definition osgText/Style:95
osgText::Style::getDefaultStyle
static osg::ref_ptr< Style > & getDefaultStyle()
default Layout implementation used if no other is specified on TextNode
osgText::Style::_widthRatio
float _widthRatio
Definition osgText/Style:110
osgText::Style::setSampleDensity
void setSampleDensity(float sd)
1.0 is default number of samples
Definition osgText/Style:103
osgText::Style::_outlineRatio
float _outlineRatio
Definition osgText/Style:112
osgText::Style::Style
Style()
osgText::Style::META_Object
META_Object(osgText, Style)
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Object
Definition Object:61
osg::ref_ptr
Definition ref_ptr:32
osgText
Export
OSGTEXT_EXPORT
#define OSGTEXT_EXPORT
Definition osgText/Export:39