vcText2DSet
vcText2DSet is a geometry set used for generating 2D text. Unlike 3D text, 2D text is rendered directly on screen by converting a position vector to screen coordinates. Furthermore, 2D text supports an inherited Billboard property, thereby text can always face camera and be right-side up in 3D world.
Inherits: vcGeometrySet
Properties
Name | Type | Access | Description |
DepthBuffered | Boolean | RW | Turns on/off the obstruction of text by other objects that are in front of it on screen.
If False, text is always set to front of foreground. |
OffsetX | Integer | RW | Defines an offset (in pixels) for horizontal axis when text is projected on screen. |
OffsetY | Integer | RW | Defines an offset (in pixels) for vertical axis when text is projected on screen. |
Position | vcVector | RW | Defines the position vector of text in 3D world.
Text is rendered in which left end of its baseline coincides with Position on screen. If OffsetX or OffsetY are non-zero values, position is shifted by those values. |
Text | String | RW | Defines a string of characters to render as one line of text. |
Methods
Name | Return Type | Parameters | Description |
getTextHeight | Integer | None | Returns the calculated height of text in pixels. |
getTextWidth | Integer | None | Returns the calculated width of text in pixels. |
update | None | None | Updates the geometry of text in 3D world. |
Examples
Example. Create 2D text in component
from vcScript import * app = getApplication() comp = getComponent() comp.Name = "Example" #simple demo that clears geometry sets in root node comp.Geometry.clear() gs = comp.Geometry.createGeometrySet(VC_TEXT2DSET) #display component name offset = 30 gs.FixedSize = True gs.BillBoard = True gs.OffsetX = 5 gs.OffsetY = offset gs.Text = "Name: " + comp.Name gs.update() app.render() |