Open Inventor Reference
|
3D text shape node. More...
#include <Inventor/nodes/SoText3.h>
Public Types | |
enum | Justification { LEFT = 0x01, RIGHT = 0x02, CENTER = 0x03 } |
Justification types. More... | |
enum | Part { FRONT = 0x01, SIDES = 0x02, BACK = 0x04, ALL = 0x07 } |
Justification types. More... | |
Public Member Functions | |
SoText3 () | |
Creates a 3D text node with default settings. | |
SbBox3f | getCharacterBounds (SoState *state, int stringIndex, int charIndex) |
Method to get the bounds of the given character in the given string. | |
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. | |
SoSFBitMask | parts |
Which parts of text are visible. | |
SoSFEnum | justification |
Indicates placement and alignment of strings. | |
Protected Member Functions | |
virtual void | computeBBox (SoAction *action, SbBox3f &box, SbVec3f ¢er) |
Computes bounding box of text. | |
virtual void | generatePrimitives (SoAction *) |
Generates primitives. | |
virtual | ~SoText3 () |
This node defines one or more strings of 3D text. In contrast with SoText2, 3D text can be rotated, scaled, lighted, and textured, just like all other 3D shapes. Each character in a 3D text string is created by extruding an outlined version of the character (in the current typeface) along the current profile, as defined by nodes derived from SoProfile. The default text profile, if none is specified, is a straight line segment one unit long.
The text origin is at (0,0,0) after applying the current transformation. The scale of the text is affected by the size field of the current SoFont as well as the current transformation.
SoText3 uses the current set of materials when rendering. If the material binding is OVERALL
, then the whole text is drawn with the first material. If it is PER_PART
or PER_PART_INDEXED
, the front part of the text is drawn with the first material, the sides with the second, and the back with the third.
Textures are applied to 3D text as follows. On the front and back faces of the text, the texture origin is at the base point of the first string; the base point is at the lower left for justification LEFT
, at the lower right for RIGHT
, and at the lower center for CENTER
. The texture is scaled equally in both S and T dimensions, with the font height representing 1 unit. S increases to the right on the front faces and to the left on the back faces. On the sides, the texture is scaled the same as on the front and back. S is equal to 0 at the rear edge of the side faces. The T origin can occur anywhere along each character, depending on how that character's outline is defined.
Text3 { string "" spacing 1 justification LEFT parts FRONT }
enum SoText3::Part |
SoText3::SoText3 | ( | ) |
virtual SoText3::~SoText3 | ( | ) | [protected, virtual] |
virtual void SoText3::computeBBox | ( | SoAction * | action, |
SbBox3f & | box, | ||
SbVec3f & | center | ||
) | [protected, virtual] |
Implements SoShape.
This must be called during the application of an action; use a callbackAction applied to a Path to the text node if you have to (this is really designed to be used in a Text3 manipulator, which will have direct access to the state). The bounds are based on the font metric information, not the geometric bounding box of the character. So, for example, while a space character has an empty bounding box, getCharacterBounds() will return a box as high as the font height, as wide as a space, and as deep as the profile.
virtual void SoText3::GLRender | ( | SoGLRenderAction * | action | ) | [virtual] |
May be overridden in subclass.
Reimplemented from SoShape.
static void SoText3::initClass | ( | ) | [static] |
Reimplemented from SoShape.
virtual void SoText3::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.