#include <sglTextSet.hpp>
Inheritance diagram for sglTextSet::
Public Methods | |
sglTextSet () | |
virtual | ~sglTextSet () |
void | setString (const string &str) |
const string& | getString () const |
void | setFont (sglBitmapFont *font) |
sglBitmapFont* | getFont () const |
void | setColor (const sglVec4f &color) |
void | setColor (float r, float g, float b, float a) |
const sglVec4f& | getColor () const |
void | setPosition (const sglVec3f &pos) |
void | setPosition (float x, float y, float z) |
const sglVec3f& | getPosition () const |
virtual void | addStats (sglStats &stats) const |
virtual void | drawGeometry (const vector< sglTexCoords > &) const |
virtual void | printInfo (ostream &ostrm, const char *indent_string) const |
Protected Methods | |
virtual bool | computeBounds () |
sglTextSet supports the rendering (rasterization really) of a 2D bitmap type font at a position relative to the origin of the parent sglGeode's local coordinate system in the 3D scene. The user specifies a single line of text (determining the raster position of the text after a carriage return for multiline text is an task on the TODO list), the color of the text, the font (via an sglBitmapFont object), and the position. Note that a default font is provided which is platform-specific if the user does not specify one. See sglBitMapFont (and its subclasses) for more information. This node also manages its own default statelet vector that includes an sglTransparency statelet which is set to true when the alpha component of the color is not 1.0. The user can override this state vector by calling setState(0, ...) on this drawable.
As a subclass of sglDrawable, the user also has the option of enabling or disabling the generation of an OpenGL display list for this drawable. The rule of thumb is that if the string is not going to change, it is more efficient to enable the display list generation (this is the default). The string will change often, it may be more efficient to explicitly disable this feature.
{\bf Example:}
\begin{verbatim} sglTextSet *text_node = new sglTextSet; text_node->setColor(1.0f, 1.0f, 0.0f, 0.3f); // translucent text_node->setPosition(10.0f, 0.0f, 0.0f); // offset along the X axis text_node->setString("This text is in the scene graph"); text_node->enableDisplayList(false); // disable display listing
sglGeode *geode = new sglGeode; geode->addGeometry(text_node); \end{verbatim}
Definition at line 73 of file sglTextSet.hpp.
|
Constructor.
|
|
Destructor.
|
|
Set the string to render.
|
|
Get the string to render.
Definition at line 91 of file sglTextSet.hpp. |
|
Set the font to use.
|
|
Get the font to use.
Definition at line 102 of file sglTextSet.hpp. |
|
Set the text color.
|
|
Set the text color (default is white opaque).
|
|
Get the text color.
Definition at line 121 of file sglTextSet.hpp. |
|
Set the offset vector.
|
|
Set the offset vector.
|
|
Get the current offset vector.
Definition at line 138 of file sglTextSet.hpp. |
|
Add this drawable's stats to the given sglStats.
Reimplemented from sglDrawable. Definition at line 142 of file sglTextSet.hpp. |
|
Output the state of this node to the specified ostream.
Reimplemented from sglDrawable. |
|
Compute the bounding box for this geometry and fill in the member variable, m_bbox, in this class.
Reimplemented from sglDrawable. |