14#ifndef OSGTEXT_TEXTBASE
15#define OSGTEXT_TEXTBASE 1
37 virtual const char*
className()
const {
return "TextBase"; }
53 virtual void setFont(
const std::string& fontfile);
309 typedef std::vector< osg::ref_ptr<osg::DrawElements> >
Primitives;
Vec2f Vec2
Definition Vec2:21
Vec3f Vec3
Definition Vec3:21
BoundingBoxd BoundingBox
Definition BoundingBox:257
Matrixd Matrix
Definition Matrix:27
Vec4f Vec4
Definition Vec4:21
The osgText library is a NodeKit that extends the core scene graph to support high quality text.
std::pair< unsigned int, unsigned int > FontResolution
Definition KerningType:20
KerningType
Definition KerningType:23
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Pure virtual base class for drawable geometry.
Definition Drawable:89
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
A quaternion class.
Definition Quat:30
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Stores a set of modes and attributes which represent a set of OpenGL state.
Definition StateSet:46
void set(value_type x, value_type y)
Definition Vec2f:61
value_type & x()
Definition Vec2f:67
value_type & y()
Definition Vec2f:68
Definition VertexArrayState:25
Pure virtual base class for fonts.
Definition Font:68
Encoding
Types of string encodings supported.
Definition String:53
void setRotation(const osg::Quat &quat)
osg::ref_ptr< Style > _style
Definition TextBase:316
KerningType _kerningType
Definition TextBase:334
AlignmentType
Definition TextBase:169
@ CENTER_CENTER
Definition TextBase:175
@ LEFT_CENTER
Definition TextBase:171
@ LEFT_BASE_LINE
Definition TextBase:182
@ RIGHT_BASE_LINE
Definition TextBase:184
@ RIGHT_BOTTOM
Definition TextBase:180
@ RIGHT_TOP
Definition TextBase:178
@ LEFT_TOP
Definition TextBase:170
@ LEFT_BOTTOM
Definition TextBase:172
@ CENTER_TOP
Definition TextBase:174
@ LEFT_BOTTOM_BASE_LINE
Definition TextBase:186
@ CENTER_BOTTOM_BASE_LINE
Definition TextBase:187
@ BASE_LINE
Definition TextBase:190
@ CENTER_BASE_LINE
Definition TextBase:183
@ CENTER_BOTTOM
Definition TextBase:176
@ RIGHT_CENTER
Definition TextBase:179
@ RIGHT_BOTTOM_BASE_LINE
Definition TextBase:188
void update()
update internal glyph respresentation used for rendering, and bounding volume.
Definition TextBase:106
float _maximumWidth
Definition TextBase:320
bool getAutoRotateToScreen() const
Definition TextBase:217
float getCharacterHeight() const
Definition TextBase:115
osg::BoundingBox _textBBWithMargin
Definition TextBase:341
void getCoord(unsigned int i, osg::Vec3 &c) const
Definition TextBase:280
virtual void setFont(Font *font=0)
Set the Font to use to render the text.
Definition TextBase:45
Layout
Definition TextBase:220
@ VERTICAL
Definition TextBase:223
@ RIGHT_TO_LEFT
default
Definition TextBase:222
@ LEFT_TO_RIGHT
Definition TextBase:221
AxisAlignment
Definition TextBase:199
@ REVERSED_XY_PLANE
Definition TextBase:201
@ SCREEN
Definition TextBase:206
@ REVERSED_XZ_PLANE
Definition TextBase:203
@ YZ_PLANE
Definition TextBase:204
@ XY_PLANE
Definition TextBase:200
@ XZ_PLANE
Definition TextBase:202
@ USER_DEFINED_ROTATION
Definition TextBase:207
@ REVERSED_YZ_PLANE
Definition TextBase:205
float _textBBMargin
Definition TextBase:332
osg::ref_ptr< osg::VertexBufferObject > _vbo
Definition TextBase:349
const osg::Vec4 & getBoundingBoxColor() const
Definition TextBase:249
String & getText()
Get the text string.
Definition TextBase:99
float _maximumHeight
Definition TextBase:321
virtual void assignStateSet()
void setColor(const osg::Vec4 &color)
float getMaximumHeight() const
Get the maximum height of the text box.
Definition TextBase:148
osg::ref_ptr< osg::Vec3Array > Coords
Definition TextBase:275
virtual void setFont(const std::string &fontfile)
Set the font, loaded from the specified front file, to use to render the text, setFont("") sets the u...
CharacterSizeMode getCharacterSizeMode() const
Get the CharacterSizeMode.
Definition TextBase:129
Layout _layout
Definition TextBase:330
osg::Vec3 _position
Definition TextBase:325
const String & getText() const
Get the const text string.
Definition TextBase:102
unsigned int addCoord(const osg::Vec2 &c)
Definition TextBase:357
Style * getOrCreateStyle()
Get or create the text style.
Definition TextBase:70
bool _glyphNormalized
Definition TextBase:336
AlignmentType getAlignment() const
Definition TextBase:195
void setBoundingBoxColor(const osg::Vec4 &color)
Definition TextBase:247
const Style * getStyle() const
Get the const text style.
Definition TextBase:67
void setAxisAlignment(AxisAlignment axis)
float getLineSpacing() const
Get the line spacing of the text box.
Definition TextBase:157
Coords & getCoords()
Definition TextBase:276
void setText(const std::string &text, String::Encoding encoding)
Set the text using a Unicode encoded std::string, which is converted to an internal TextString.
AxisAlignment _axisAlignment
Definition TextBase:327
unsigned int _drawMode
Definition TextBase:331
Coords _coords
Definition TextBase:352
osg::ref_ptr< Font > _fontFallback
Definition TextBase:315
void setAlignment(AlignmentType alignment)
virtual void releaseGLObjects(osg::State *state=0) const
If State is non-zero, this function releases OpenGL objects for the specified graphics context.
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
virtual osg::BoundingBox computeBoundingBox() const
Compute the bounding box around Drawables's geometry.
virtual void compileGLObjects(osg::RenderInfo &renderInfo) const
Immediately compile this Drawable into an OpenGL Display List/VertexBufferObjects.
void setLayout(Layout layout)
osg::VertexArrayState * createVertexArrayStateImplementation(osg::RenderInfo &renderInfo) const
Implementation of Create the VertexArrayState object.
unsigned int _lineCount
Definition TextBase:335
osg::Vec4 _textBBColor
Definition TextBase:333
void setFontResolution(unsigned int width, unsigned int height)
Set the Font reference width and height resolution in texels.
float getMaximumWidth() const
Get the maximim width of the text box.
Definition TextBase:139
void setCharacterSizeMode(CharacterSizeMode mode)
Set how the CharacterSize value relates to the final rendered character.
Definition TextBase:126
float _characterHeight
Definition TextBase:318
void setLineSpacing(float lineSpacing)
Set the line spacing of the text box, given as a percentage of the character height.
Coords _normals
Definition TextBase:353
bool _autoRotateToScreen
Definition TextBase:329
ColorCoords _colorCoords
Definition TextBase:354
CharacterSizeMode
Definition TextBase:119
@ SCREEN_COORDS
default
Definition TextBase:121
@ OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT
internally scale the characters to be constant screen size.
Definition TextBase:122
@ OBJECT_COORDS
Definition TextBase:120
String::iterator computeLastCharacterOnLine(osg::Vec2 &cursor, String::iterator first, String::iterator last)
bool computeMatrix(osg::Matrix &matrix, osg::State *state=0) const
compute the matrix that positions the text in model space for the given viewpoint.
unsigned int addCoord(const osg::Vec3 &c)
Definition TextBase:358
void setCharacterSize(float height, float aspectRatio)
Set the rendered character size in object coordinates.
void setStyle(Style *style)
Set the text style.
Definition TextBase:63
virtual const char * className() const
return the name of the node's class type.
Definition TextBase:37
TextBase(const TextBase &text, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
void setCharacterSize(float height)
Set the rendered character size in object coordinates.
Primitives _decorationPrimitives
Definition TextBase:345
void setText(const std::string &text)
Set the text using a std::string, which is converted to an internal TextString.
Style * getStyle()
Get the text style.
Definition TextBase:65
TexCoords _texcoords
Definition TextBase:355
float getBoundingBoxMargin() const
Definition TextBase:245
void addTexCoord(const osg::Vec2 &tc)
Definition TextBase:361
osg::BoundingBox _textBB
Definition TextBase:340
KerningType getKerningType() const
Definition TextBase:254
void setKerningType(KerningType kerningType)
Definition TextBase:252
void setMaximumWidth(float maximumWidth)
Set the maximum width of the text box.
unsigned int getFontHeight() const
Definition TextBase:78
osg::Matrix _matrix
Definition TextBase:343
virtual bool isSameKindAs(const osg::Object *obj) const
return true if this and obj are of the same kind of object.
Definition TextBase:36
Layout getLayout() const
Definition TextBase:228
void setAutoRotateToScreen(bool autoRotateToScreen)
virtual osg::StateSet * createStateSet()
DrawModeMask
Definition TextBase:232
@ TEXT
Definition TextBase:233
@ FILLEDBOUNDINGBOX
Definition TextBase:235
@ BOUNDINGBOX
default
Definition TextBase:234
@ ALIGNMENT
Definition TextBase:236
void setBoundingBoxMargin(float margin)
osg::ref_ptr< osg::ElementBufferObject > _ebo
Definition TextBase:350
osg::Vec3 _normal
Definition TextBase:339
unsigned int getLineCount() const
Get the number of wrapped lines - only valid after computeGlyphRepresentation() has been called,...
Definition TextBase:257
osg::ref_ptr< Font > _font
Definition TextBase:314
float _lineSpacing
Definition TextBase:322
FontResolution _fontSize
Definition TextBase:317
Font * getFont()
Get the font.
Definition TextBase:56
AlignmentType _alignment
Definition TextBase:326
osg::Vec3 _offset
Definition TextBase:338
void setDrawMode(unsigned int mode)
void positionCursor(const osg::Vec2 &endOfLine_coords, osg::Vec2 &cursor, unsigned int linelength)
String _text
Definition TextBase:324
void getCoord(unsigned int i, osg::Vec2 &c) const
Definition TextBase:279
virtual const char * libraryName() const
return the name of the node's library.
Definition TextBase:38
unsigned int getDrawMode() const
Definition TextBase:241
osg::ref_ptr< osg::Vec2Array > TexCoords
Definition TextBase:307
void setText(const wchar_t *text)
Set the text using a wchar_t string, which is converted to an internal TextString.
osg::Quat _rotation
Definition TextBase:328
const osg::Vec4 & getColor() const
Definition TextBase:41
void setText(const String &text)
Set the text using a osgText::String.
CharacterSizeMode _characterSizeMode
Definition TextBase:319
const osg::Quat & getRotation() const
Definition TextBase:214
void setMaximumHeight(float maximumHeight)
Set the maximum height of the text box.
AxisAlignment getAxisAlignment() const
Definition TextBase:211
void setPosition(const osg::Vec3 &pos)
Set the position of text.
const osg::Matrix & getMatrix() const
Get the cached internal matrix used to provide positioning of text.
Definition TextBase:283
virtual void setFont(osg::ref_ptr< Font > font)
Set the Font to use to render the text.
void initArraysAndBuffers()
std::vector< osg::ref_ptr< osg::DrawElements > > Primitives
Definition TextBase:309
const Coords & getCoords() const
Definition TextBase:277
float getCharacterAspectRatio() const
Definition TextBase:116
osg::Vec4 _color
Definition TextBase:313
virtual void computeGlyphRepresentation()=0
virtual void computePositionsImplementation()
const Font * getFont() const
Get the const font.
Definition TextBase:59
unsigned int getFontWidth() const
Definition TextBase:77
const osg::Vec3 & getPosition() const
Get the position of text.
Definition TextBase:165
osg::ref_ptr< osg::Vec4Array > ColorCoords
Definition TextBase:308
#define NULL
Definition Export:55
#define OSGTEXT_EXPORT
Definition Export:39