| 1 |
NAME SoText2 SoTxt2 SO_TXT2_ { screen-aligned 2D text shape node } |
| 2 |
|
| 3 |
INCLUDE nodes/SoText2.h |
| 4 |
|
| 5 |
DESC { |
| 6 |
This node defines one or more strings of 2D text. The text is always |
| 7 |
aligned horizontally with the screen and does not change size with |
| 8 |
distance in a perspective projection. The text origin is at (0,0,0) |
| 9 |
after applying the current transformation. Rotations and scales have |
| 10 |
no effect on the orientation or size of 2D text, just the location. |
| 11 |
\p |
| 12 |
\cSoText2\. uses the current font to determine the typeface and size. |
| 13 |
The text is always drawn with the diffuse color of the current |
| 14 |
material; it is not lit, regardless of the lighting model. |
| 15 |
Furthermore, 2D text can not be textured, and it ignores the current |
| 16 |
drawing style and complexity. |
| 17 |
\p |
| 18 |
Because 2D text is screen-aligned, it has some unusual |
| 19 |
characteristics. For example, the 3D bounding box surrounding a 2D |
| 20 |
text string depends on the current camera and the current viewport |
| 21 |
size, since changing the field of view or the mapping onto the window |
| 22 |
changes the relative size of the text with respect to the rest of the |
| 23 |
scene. This has implications for caching as well, since a render cache |
| 24 |
in an \cSoSeparator\. that contains an \cSoText2\. node depends on the |
| 25 |
current camera. |
| 26 |
} |
| 27 |
|
| 28 |
ENUM Justification { |
| 29 |
LEFT "Left edges of all strings are aligned", |
| 30 |
RIGHT "Right edges of all strings are aligned", |
| 31 |
CENTER "Centers of all strings are aligned" |
| 32 |
} |
| 33 |
|
| 34 |
FIELD string { |
| 35 |
The text string(s) to display. Each string will appear on its own line. |
| 36 |
The string(s) can be ascii or UTF-8. |
| 37 |
} |
| 38 |
|
| 39 |
FIELD spacing { |
| 40 |
Defines the distance (in the negative y direction) between the base |
| 41 |
points of successive strings, measured with respect to the current |
| 42 |
font height. A value of 1 indicates single spacing, a value of 2 |
| 43 |
indicates double spacing, and so on. |
| 44 |
} |
| 45 |
|
| 46 |
FIELD justification { |
| 47 |
Indicates placement and alignment of strings. With \kLEFT\. |
| 48 |
justification, the left edge of the first line is at the (transformed) |
| 49 |
origin, and all left edges are aligned. \kRIGHT\. justification is |
| 50 |
similar. \kCENTER\. justification places the center of the first |
| 51 |
string at the (transformed) origin, with the centers of all remaining |
| 52 |
strings aligned under it. |
| 53 |
} |
| 54 |
|
| 55 |
METHOD "" SoText2() { |
| 56 |
Creates a 2D text node with default settings. |
| 57 |
} |
| 58 |
|
| 59 |
METHOD "" static SoType getClassTypeId() { |
| 60 |
Returns type identifier for this class. |
| 61 |
} |
| 62 |
|
| 63 |
ACTION SoGLRenderAction { |
| 64 |
Draws text based on the current font, at a location based on the current |
| 65 |
transformation. |
| 66 |
} |
| 67 |
|
| 68 |
ACTION SoRayPickAction { |
| 69 |
Performs a pick on the text. Text will be picked if the picking ray |
| 70 |
intersects the bounding box of the strings. The string index and |
| 71 |
character position are available from the \cSoTextDetail\.. |
| 72 |
} |
| 73 |
|
| 74 |
ACTION SoGetBoundingBoxAction { |
| 75 |
Computes the bounding box that encloses the text. |
| 76 |
} |
| 77 |
|
| 78 |
ALSO { SoFont, SoText3, SoTextDetail } |