OpenSceneGraph 3.6.5
Text3D
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
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.
7 *
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.
12*/
13
14#ifndef OSGTEXT_TEXT3D
15#define OSGTEXT_TEXT3D 1
16
17
18#include <osgText/TextBase>
19#include <osgText/Style>
20
21namespace osgText {
22
23
25{
26 public:
27
34
37
39
40
41 float getCharacterDepth() const;
42
44 void setCharacterDepth(float characterDepth);
45
49 void setRenderMode(RenderMode renderMode) { _renderMode = renderMode; }
50
51
55 const osg::StateSet* getWallStateSet() const { return _wallStateSet.get(); }
58 {
59 if (_wallStateSet.valid() == false) _wallStateSet = new osg::StateSet;
60 return _wallStateSet.get();
61 }
62
63 void setWallStateSet(osg::StateSet* wallStateSet) { _wallStateSet = wallStateSet; }
64
68 osg::StateSet* getBackStateSet() const { return _backStateSet.get(); }
72 void setBackStateSet(osg::StateSet* backStateSet) { _backStateSet = backStateSet; }
73
74
75
77 virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
78
80 virtual bool supports(const osg::Drawable::AttributeFunctor&) const { return false; }
81
83 virtual bool supports(const osg::Drawable::ConstAttributeFunctor&) const { return false; }
84
87
89 virtual bool supports(const osg::PrimitiveFunctor&) const { return false; }
90
92 virtual void accept(osg::PrimitiveFunctor& pf) const;
93
95 virtual void resizeGLObjectBuffers(unsigned int maxSize);
96
100 virtual void releaseGLObjects(osg::State* state=0) const;
101
102 // make Font a friend to allow it set the _font to 0 if the font is
103 // forcefully unloaded.
104 friend class Font;
105
107
108
109 protected:
110
111 virtual ~Text3D() {}
112
113 String::iterator computeLastCharacterOnLine(osg::Vec2& cursor, String::iterator first,String::iterator last);
114
116
117 void copyAndOffsetPrimitiveSets(osg::Geometry::PrimitiveSetList& dest_PrimitiveSetList, osg::Geometry::PrimitiveSetList& src_PrimitiveSetList, unsigned int offset);
118
122
123 // ** glyph and other information to render the glyph
133
134 typedef std::vector<GlyphRenderInfo> LineRenderInfo;
135 typedef std::vector<LineRenderInfo> TextRenderInfo;
136
138
139 // deprecated value no longer used.
141
144};
145
146}
147
148
149#endif
Vec2f Vec2
Definition Vec2:21
Vec3f Vec3
Definition Vec3:21
BoundingBoxd BoundingBox
Definition BoundingBox:257
The osgText library is a NodeKit that extends the core scene graph to support high quality text.
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
Definition Drawable:426
std::vector< ref_ptr< PrimitiveSet > > PrimitiveSetList
Definition Geometry:102
A PrimitiveFunctor is used (in conjunction with osg::Drawable::accept (PrimitiveFunctor&)) to get acc...
Definition PrimitiveSet:54
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Definition RenderInfo:28
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
Definition Glyph:134
void setCharacterDepth(float characterDepth)
Set the Charactere Depth of text.
virtual void accept(osg::Drawable::ConstAttributeFunctor &af) const
accept an ConstAttributeFunctor and call its methods to tell it about the internal attributes that th...
osg::ref_ptr< osg::StateSet > _wallStateSet
Definition Text3D:142
std::vector< GlyphRenderInfo > LineRenderInfo
Definition Text3D:134
osg::Geometry::PrimitiveSetList _wallPrimitiveSetList
Definition Text3D:120
osg::StateSet * getOrCreateWallStateSet()
Get or create the wall StateSet.
Definition Text3D:57
virtual bool supports(const osg::Drawable::ConstAttributeFunctor &) const
return true, osgText::Text does support accept(ConstAttributeFunctor&).
Definition Text3D:83
void copyAndOffsetPrimitiveSets(osg::Geometry::PrimitiveSetList &dest_PrimitiveSetList, osg::Geometry::PrimitiveSetList &src_PrimitiveSetList, unsigned int offset)
virtual bool supports(const osg::PrimitiveFunctor &) const
return true, osgText::Text does support accept(PrimitiveFunctor&) .
Definition Text3D:89
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
Draw the text.
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
META_Object(osgText, Text3D) float getCharacterDepth() const
Get the Charactere Depth of text.
void setWallStateSet(osg::StateSet *wallStateSet)
Set the wall StateSet.
Definition Text3D:63
void setRenderMode(RenderMode renderMode)
Deprecated, value is now ignored.
Definition Text3D:49
virtual osg::BoundingBox computeBoundingBox() const
Compute the bounding box around Drawables's geometry.
osg::Geometry::PrimitiveSetList _backPrimitiveSetList
Definition Text3D:121
RenderMode getRenderMode() const
Deprecated, value is now ignored.
Definition Text3D:47
std::vector< LineRenderInfo > TextRenderInfo
Definition Text3D:135
RenderMode
Deprecated.
Definition Text3D:30
@ PER_GLYPH
Definition Text3D:32
@ PER_FACE
Definition Text3D:31
virtual void accept(osg::PrimitiveFunctor &pf) const
accept a PrimtiveFunctor and call its methods to tell it about the internal primtives that this Drawa...
const osg::StateSet * getWallStateSet() const
Get the wall StateSet.
Definition Text3D:55
RenderMode _renderMode
Definition Text3D:140
virtual ~Text3D()
Definition Text3D:111
void setBackStateSet(osg::StateSet *backStateSet)
Set the back StateSet.
Definition Text3D:72
osg::StateSet * getBackStateSet()
Get the back StateSet.
Definition Text3D:66
osg::StateSet * getOrCreateBackStateSet()
Get or create the back StateSet.
Definition Text3D:70
String::iterator computeLastCharacterOnLine(osg::Vec2 &cursor, String::iterator first, String::iterator last)
Text3D(const Text3D &text, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
void computeGlyphRepresentation()
osg::StateSet * getWallStateSet()
Get the wall StateSet.
Definition Text3D:53
osg::Geometry::PrimitiveSetList _frontPrimitiveSetList
Definition Text3D:119
virtual bool supports(const osg::Drawable::AttributeFunctor &) const
return false, osgText::Text does not support accept(AttributeFunctor&).
Definition Text3D:80
friend class Font
Definition Text3D:104
TextRenderInfo _textRenderInfo
Definition Text3D:137
virtual void releaseGLObjects(osg::State *state=0) const
If State is non-zero, this function releases OpenGL objects for the specified graphics context.
osg::ref_ptr< osg::StateSet > _backStateSet
Definition Text3D:143
osg::StateSet * getBackStateSet() const
Get the back StateSet.
Definition Text3D:68
osg::Vec3 _position
Definition Text3D:131
GlyphRenderInfo(GlyphGeometry *glyphGeometry, osg::Vec3 &pos)
Definition Text3D:126
osg::ref_ptr< GlyphGeometry > _glyphGeometry
Definition Text3D:130
Definition TextBase:28
#define OSGTEXT_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.