Pass:text

Edit

Draws text. The font can be changed using Pass:setFont.







Arguments

NameTypeDefaultDescription
textstring The text to render.
xnumber0 The x coordinate of the text origin.
ynumber0 The y coordinate of the text origin.
znumber0 The z coordinate of the text origin.
scalenumber1 The scale of the text (with the default pixel density, units are meters).
anglenumber0 The rotation of the text around its rotation axis, in radians.
axnumber0 The x component of the axis of rotation.
aynumber1 The y component of the axis of rotation.
aznumber0 The z component of the axis of rotation.
wrapnumber0 The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap.
halignHorizontalAlign'center' The horizontal alignment relative to the text origin.
valignVerticalAlign'middle' The vertical alignment relative to the text origin.

Returns

Nothing

Arguments

NameTypeDefaultDescription
textstring The text to render.
positionVec3 The position of the text.
scalenumber1 The scale of the text (with the default pixel density, units are meters).
orientationQuat The orientation of the text.
wrapnumber0 The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap.
halignHorizontalAlign'center' The horizontal alignment relative to the text origin.
valignVerticalAlign'middle' The vertical alignment relative to the text origin.

Returns

Nothing

Arguments

NameTypeDefaultDescription
textstring The text to render.
transformMat4 The transform of the text.
wrapnumber0 The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap.
halignHorizontalAlign'center' The horizontal alignment relative to the text origin.
valignVerticalAlign'middle' The vertical alignment relative to the text origin.

Returns

Nothing

Renders multicolor text.

Arguments

NameTypeDefaultDescription
colortexttable 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.
xnumber0 The x coordinate of the text origin.
ynumber0 The y coordinate of the text origin.
znumber0 The z coordinate of the text origin.
scalenumber1 The scale of the text (with the default pixel density, units are meters).
anglenumber0 The rotation of the text around its rotation axis, in radians.
axnumber0 The x component of the axis of rotation.
aynumber1 The y component of the axis of rotation.
aznumber0 The z component of the axis of rotation.
wrapnumber0 The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap.
halignHorizontalAlign'center' The horizontal alignment relative to the text origin.
valignVerticalAlign'middle' The vertical alignment relative to the text origin.

Returns

Nothing

Renders multicolor text.

Arguments

NameTypeDefaultDescription
colortexttable 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.
positionVec3 The position of the text.
scalenumber1 The scale of the text (with the default pixel density, units are meters).
orientationQuat The orientation of the text.
wrapnumber0 The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap.
halignHorizontalAlign'center' The horizontal alignment relative to the text origin.
valignVerticalAlign'middle' The vertical alignment relative to the text origin.

Returns

Nothing

Renders multicolor text.

Arguments

NameTypeDefaultDescription
colortexttable 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.
transformMat4 The transform of the text.
wrapnumber0 The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap.
halignHorizontalAlign'center' The horizontal alignment relative to the text origin.
valignVerticalAlign'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.

See also