Pass:text
EditDraws text. The font can be changed using Pass:setFont
.
Arguments
Name | Type | Default | Description |
text | string | The text to render. | |
x | number | 0 | The x coordinate of the text origin. |
y | number | 0 | The y coordinate of the text origin. |
z | number | 0 | The z coordinate of the text origin. |
scale | number | 1 | The scale of the text (with the default pixel density, units are meters). |
angle | number | 0 | The rotation of the text around its rotation axis, in radians. |
ax | number | 0 | The x component of the axis of rotation. |
ay | number | 1 | The y component of the axis of rotation. |
az | number | 0 | The z component of the axis of rotation. |
wrap | number | 0 | The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap. |
halign | HorizontalAlign | 'center' | The horizontal alignment relative to the text origin. |
valign | VerticalAlign | 'middle' | The vertical alignment relative to the text origin. |
Returns
Nothing
Arguments
Name | Type | Default | Description |
text | string | The text to render. | |
position | Vec3 | The position of the text. | |
scale | number | 1 | The scale of the text (with the default pixel density, units are meters). |
orientation | Quat | The orientation of the text. | |
wrap | number | 0 | The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap. |
halign | HorizontalAlign | 'center' | The horizontal alignment relative to the text origin. |
valign | VerticalAlign | 'middle' | The vertical alignment relative to the text origin. |
Returns
Nothing
Arguments
Name | Type | Default | Description |
text | string | The text to render. | |
transform | Mat4 | The transform of the text. | |
wrap | number | 0 | The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap. |
halign | HorizontalAlign | 'center' | The horizontal alignment relative to the text origin. |
valign | VerticalAlign | 'middle' | The vertical alignment relative to the text origin. |
Returns
Nothing
Renders multicolor text.
Arguments
Name | Type | Default | Description |
colortext | table |
A table of strings with colors to render, in the form { color1, string1, color2, string2 } , where color is a Vec3 , Vec4 , hexcode, or table of numbers.
| |
x | number | 0 | The x coordinate of the text origin. |
y | number | 0 | The y coordinate of the text origin. |
z | number | 0 | The z coordinate of the text origin. |
scale | number | 1 | The scale of the text (with the default pixel density, units are meters). |
angle | number | 0 | The rotation of the text around its rotation axis, in radians. |
ax | number | 0 | The x component of the axis of rotation. |
ay | number | 1 | The y component of the axis of rotation. |
az | number | 0 | The z component of the axis of rotation. |
wrap | number | 0 | The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap. |
halign | HorizontalAlign | 'center' | The horizontal alignment relative to the text origin. |
valign | VerticalAlign | 'middle' | The vertical alignment relative to the text origin. |
Returns
Nothing
Renders multicolor text.
Arguments
Name | Type | Default | Description |
colortext | table |
A table of strings with colors to render, in the form { color1, string1, color2, string2 } , where color is a Vec3 , Vec4 , hexcode, or table of numbers.
| |
position | Vec3 | The position of the text. | |
scale | number | 1 | The scale of the text (with the default pixel density, units are meters). |
orientation | Quat | The orientation of the text. | |
wrap | number | 0 | The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap. |
halign | HorizontalAlign | 'center' | The horizontal alignment relative to the text origin. |
valign | VerticalAlign | 'middle' | The vertical alignment relative to the text origin. |
Returns
Nothing
Renders multicolor text.
Arguments
Name | Type | Default | Description |
colortext | table |
A table of strings with colors to render, in the form { color1, string1, color2, string2 } , where color is a Vec3 , Vec4 , hexcode, or table of numbers.
| |
transform | Mat4 | The transform of the text. | |
wrap | number | 0 | The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap. |
halign | HorizontalAlign | 'center' | The horizontal alignment relative to the text origin. |
valign | VerticalAlign | 'middle' | The vertical alignment relative to the text origin. |
Returns
Nothing
Notes
UTF-8 encoded strings are supported.
Newlines will start a new line of text. Tabs will be rendered as four spaces. Carriage returns are ignored.
With the default font pixel density, a scale of 1.0 makes the text height 1 meter.
The wrap value does not take into account the text's scale.
Text rendering requires a special shader, which will only be automatically used when the active shader is set to nil
.
Blending should be enabled when rendering text (it's on by default).
This function can draw up to 16384 visible characters at a time, and will currently throw an error if the string is too long.