A text display that always faces the camera. More...
#include <sceneview/text_billboard.hpp>
Public Types | |
enum | HAlignment { kLeft = 4, kHCenter = 5, kRight = 6 } |
enum | VAlignment { kBottom, kVCenter, kTop } |
enum | YDirection { kNegative = -1, kPositive = 1 } |
typedef std::shared_ptr < TextBillboard > | Ptr |
Public Member Functions | |
void | SetText (const QString &text) |
void | SetFont (const QFont &font) |
Sets the font. More... | |
void | SetLineHeight (float height) |
Control text size by varying nominal line height. More... | |
void | SetTextColor (const QColor &color) |
Sets the foreground text color. | |
void | SetBackgroundColor (const QColor &color) |
Sets the background color. More... | |
void | SetAlignment (HAlignment horizontal, VAlignment vertical) |
Sets the text alignment. More... | |
void | SetYDirection (YDirection direction) |
GroupNode * | Node () |
Static Public Member Functions | |
static Ptr | Create (Viewport *viewport, GroupNode *parent) |
A text display that always faces the camera.
The text display is anchored to a point in the 3D scene, and the size of the text is relative to the scene. If a perspective camera is far from the text, then the text appears smaller.
The following attributes of the text can be varied:
void sv::TextBillboard::SetAlignment | ( | HAlignment | horizontal, |
VAlignment | vertical | ||
) |
Sets the text alignment.
The specified portion of the rendered text is anchored to the billboard's scene node. For example, if the scene node is positioned at (10, 11, 12) in world coordinates, and the alignment is (kRight, kTop), then the top right corner of the text is positioned at (10, 11, 12) in world coordinates.
void sv::TextBillboard::SetBackgroundColor | ( | const QColor & | color | ) |
Sets the background color.
To remove the background color, pass in a QColor with the alpha value set to 0.
void sv::TextBillboard::SetFont | ( | const QFont & | font | ) |
Sets the font.
The following attributes of the font are used:
The font size is ignored, and is determined by SetLineHeight().
void sv::TextBillboard::SetLineHeight | ( | float | height | ) |
Control text size by varying nominal line height.
The height is in units of the Cartesian coordinate frame for the scene node.