Open Inventor Reference
|
Internal class. More...
#include <Inventor/nodes/SoText2.h>
Public Types | |
enum | Justification { LEFT = 0x01, RIGHT = 0x02, CENTER = 0x03 } |
Justification types. More... | |
Public Member Functions | |
SoText2 () | |
Creates a 2D text node with default settings. | |
virtual void | GLRender (SoGLRenderAction *action) |
Implements rendering by rendering each primitive generated by subclass. | |
virtual void | rayPick (SoRayPickAction *action) |
Implements picking along a ray by intersecting the ray with each primitive generated by subclass. | |
Static Public Member Functions | |
static void | initClass () |
Initializes base node class. | |
Public Attributes | |
Fields | |
SoMFString | string |
The text string(s) to display. | |
SoSFFloat | spacing |
Defines the distance (in the negative y direction) between the base points of successive strings, measured with respect to the current font height. | |
SoSFEnum | justification |
Indicates placement and alignment of strings. | |
Protected Member Functions | |
virtual void | generatePrimitives (SoAction *action) |
This method is a no-op for SoText2, since there are no primitives it can generate. | |
virtual void | computeBBox (SoAction *action, SbBox3f &box, SbVec3f ¢er) |
Computes bounding box of text. | |
virtual | ~SoText2 () |
Screen-aligned 2D text shape node.
This node defines one or more strings of 2D text. The text is always aligned horizontally with the screen and does not change size with distance in a perspective projection. The text origin is at (0,0,0) after applying the current transformation. Rotations and scales have no effect on the orientation or size of 2D text, just the location.
SoText2 uses the current font to determine the typeface and size. The text is always drawn with the diffuse color of the current material; it is not lit, regardless of the lighting model. Furthermore, 2D text can not be textured, and it ignores the current drawing style and complexity.
Because 2D text is screen-aligned, it has some unusual characteristics. For example, the 3D bounding box surrounding a 2D text string depends on the current camera and the current viewport size, since changing the field of view or the mapping onto the window changes the relative size of the text with respect to the rest of the scene. This has implications for caching as well, since a render cache in an SoSeparator that contains an SoText2 node depends on the current camera.
Text2 { string "" spacing 1 justification LEFT }
SoText2::SoText2 | ( | ) |
virtual SoText2::~SoText2 | ( | ) | [protected, virtual] |
virtual void SoText2::computeBBox | ( | SoAction * | action, |
SbBox3f & | box, | ||
SbVec3f & | center | ||
) | [protected, virtual] |
Implements SoShape.
virtual void SoText2::generatePrimitives | ( | SoAction * | action | ) | [protected, virtual] |
Implements SoShape.
virtual void SoText2::GLRender | ( | SoGLRenderAction * | action | ) | [virtual] |
May be overridden in subclass.
Reimplemented from SoShape.
static void SoText2::initClass | ( | ) | [static] |
Reimplemented from SoShape.
virtual void SoText2::rayPick | ( | SoRayPickAction * | action | ) | [virtual] |
May be overridden in subclass.
Reimplemented from SoShape.
With LEFT
justification, the left edge of the first line is at the (transformed) origin, and all left edges are aligned. RIGHT
justification is similar. CENTER
justification places the center of the first string at the (transformed) origin, with the centers of all remaining strings aligned under it.