Text2dNode

lumin. Text2dNode

Node type that uses fonts loaded with Font2dResource to render 2D text.

Constructor

new Text2dNode()

Extends

Methods

addChild(a_pChild) → {boolean}

Inherited From:

Adds a child to the current Node, removing it from its current parent.

A child can only have a single Parent

Parameters:
Name Type Description
a_pChild lumin.Node

The Node to add as a child to this Node.

Returns:

true if successful, false if failed

Type
boolean

addMoveCallback(trackopt)

Inherited From:

Adds a client-side callback event to the move list. When the event is reached during the
animation playback, the ServerEventCallback function set in Client will be called
with an event TransformAnimationEventData.

Parameters:
Name Type Attributes Default Description
track number <optional>
0

addToLayer(a_layer)

Inherited From:

Adds this node to the specified node layer. Nodes can be members of multiple layers.

Parameters:
Name Type Description
a_layer BigInt

delayMove(durationSecs, trackopt)

Inherited From:

Adds a delay to the current move sequence.

Parameters:
Name Type Attributes Default Description
durationSecs number

How long to delay, in seconds.

track number <optional>
0

which animation track to add the delay to.

enableVisualState(value)

Inherited From:

Enable//Disable the Prism Visual state changes

Parameters:
Name Type Description
value boolean

Enable/Disable the state changing

findChild(name) → {lumin.Node}

Inherited From:

Find the first named child in the node hierarchy, including this Node.

Does a breadth-first search of the child node hierarchy
for the specified named Node and will return the first encountered match,
or nullptr if no named Node found.

Parameters:
Name Type Description
name string

The name to search for.

Returns:
Type
lumin.Node

findChildren(a_type, a_bExactTypeopt, a_bIncludeSelfopt) → {Array.<lumin.Node>}

Inherited From:

Does a breadth-first search of the child node hierarchy
for the specified Node type.

Parameters:
Name Type Attributes Default Description
a_type number

The type of Node to find in the child hierarchy.

a_bExactType boolean <optional>
false

Flag to indicate if the child node must be the exact type or can be derived from the type (default false).

a_bIncludeSelf boolean <optional>
false

Flag to indicate if the search should include this Node (default false).

Returns:

A vector of Node pointers containing the results.

Type
Array.<lumin.Node>

findParent(a_type, a_bExactTypeopt) → {lumin.Node}

Inherited From:

Searches up the tree parentage for the specific Node type.

Parameters:
Name Type Attributes Default Description
a_type number

The type of Node to find in the parent hierarchy.

a_bExactType boolean <optional>
false

Flag to indicate if the parent node must be the exact type or can be derived from the type (default false).

Returns:

The parent node, if found, null if not found.

Type
lumin.Node

getAABB() → {lumin.math.AABB}

Inherited From:

Get the AABB of this Node's full hierarchy, including all descendants,
with all Node transforms applied.

The returned AABB encompasses this Node and all descendant Nodes
and is aligned to the coordinate system the Node resides within,
i.e. the Node's parent coordinate system.
Note, the returned AABB is not guaranteed to be the minimal,
tightest fitting AABB to encompass the Node's descendant hierarchy,
but it will fully enlose the Node's hierarchy.

Returns:

The bounding box

Type
lumin.math.AABB

getAdvanceDirection() → {lumin.glyph.AdvanceDirection}

Get the advance direction, which comes from the font if
not overridden with setAdvanceDirection().

Returns:

The advance direction.

Type
lumin.glyph.AdvanceDirection

getAnchorPosition() → {vec3}

Inherited From:

Returns the anchor position of the node.

Returns:

The anchor position.

Type
vec3

getCharacterSpacing() → {number}

Gets the current value of the additional character spacing.

Returns:

the value of the additional character spacing (as a
multiplier of the glyph height).

Type
number

getChild(a_iIndex) → {lumin.Node}

Inherited From:

Gets the n'th child from this Node's children

Parameters:
Name Type Description
a_iIndex number

The index of the child.

Returns:

Child Node

Type
lumin.Node

getChildCount() → {number}

Inherited From:

Gets the number of immediate children this Node has

Returns:

Count of immediate child Nodes

Type
number

getColor() → {vec4}

Inherited From:

Get the custom color, which is by default white: { 1, 1, 1, 1 }.

Returns:

The color.

Type
vec4

getCurrentPrismTransform() → {mat4}

Inherited From:

Get the Cached Prism Transform of this Node

Returns:

Transform Matrix

Type
mat4

getCurrentWorldTransform() → {mat4}

Inherited From:

Get the Cached World Transform of this Node

Returns:

Transform Matrix

Type
mat4

getCursorHoverState() → {lumin.CursorHoverState}

Inherited From:

Get the cursor hover state for this Node.

Returns:

the cursor state.

Type
lumin.CursorHoverState

getCursorPositions() → {Array.<vec2>}

Retrieves cursor positions for each character in the
displayed text when in edit mode. The list will be
empty if not in edit mode.

The very first position index represents the cursor home
position (where the cursor would be without any text)
and all subsequent position indices are offset by +1
to their respective character in the text.

Returns:

the cursor position list.

Type
Array.<vec2>

getEditMode() → {boolean}

Gets whether the Text2dNode is in edit mode.

Returns:

true if in edit mode, false otherwise.

Type
boolean

getFixedBounds() → {lumin.text.FixedBoundsData}

Returns:

the fixed bounds of the text node or else nullptr
if fixed bounds have not been set; see setFixedBounds.
Note: the caller must not delete the returned pointer.

Type
lumin.text.FixedBoundsData

getFlowDirection() → {lumin.text.FlowDirection}

Get the text-flow direction, which comes from the font if
not overridden with setFlowDirection().

Returns:

The flow direction.

Type
lumin.text.FlowDirection

getFontResource() → {lumin.Font2dResource}

Get the font resource or nullptr if no font has been set.

Returns:

The FontResource.

Type
lumin.Font2dResource

getGlyphHeight() → {number}

Get the height of the tallest glyph, which is provided
by the associated font resource if not overridden with
setGlyphHeight(); see FontResource::getGlyphHeight().

Returns:

The glyph height.

Type
number

getJustification() → {lumin.text.Justification}

Get the text justification, which is kStart by default.

Returns:

The justification.

Type
lumin.text.Justification

getLineSpacing() → {number}

Get the line spacing for the text, which is by default 1 (i.e.,
single-spaced). Spacing can be adjusted with setLineSpacing.

Returns:

The line spacing.

Type
number

getLocalAABB() → {lumin.math.AABB}

Inherited From:

Get the local AABB of this Node only, not including children,
aligned to this Node's local coordinate system.

A local AABB of math::AABB::EMPTY indicates the Node either
has no visual information or that local AABB is not supported
for the Node.

Note: The local AABB for ModelNodes is currently not supported
and will report math::AABB::EMPTY.

Returns:

The bounding box.

Type
lumin.math.AABB

getLocalPosition() → {vec3}

Inherited From:

Get the Local Position of this Node

Returns:

Position

Type
vec3

getLocalRotation() → {quat}

Inherited From:

Get the Local Rotation of this Node

Returns:

Rotation

Type
quat

getLocalScale() → {vec3}

Inherited From:

Get the Local Scale of this Node

Returns:

Scale

Type
vec3

getLocalTransform() → {mat4}

Inherited From:

Get the Local Transform of this Node

Returns:

Transform Matrix

Type
mat4

getMaxGlyphsPerLine() → {number}

Returns 0 by default, which means no maximum value; see
setMaxGlyphsPerLine().

Returns:

Number of gylphs before a line break.

Type
number

getName() → {string}

Inherited From:

Get the name of the Node.

This call returns EMPTY_STRING if the Node's
name has not been set.

Returns:

The name of the Node, if set.

Type
string

getNodeId() → {BigInt}

Inherited From:

Gets the Node Id of this Node

Every Node is assigned a unique ID per Prism

Returns:

Node id of the current Node

Type
BigInt

getParent() → {lumin.Node}

Inherited From:

Gets this Node's immediate parent

Returns:

Parent Node, nullptr = no parent

Type
lumin.Node

getParentedBoneName() → {string}

Inherited From:

When parented to a parents bone with setParentedBoneName

Returns:

Parents bone name we are attached to

Type
string

getPrismBounds() → {Pair.<vec3, vec3>}

The comments for getWorldBounds() apply to this function as well.

Returns:
Type
Pair.<vec3, vec3>

getPrismId() → {BigInt}

Inherited From:

Returns the id of the prism the node belongs to.

Returns:

the prism id (0 = invalid prism)

Type
BigInt

getPrismPosition() → {vec3}

Inherited From:

Get the Prism Position of this Node

Returns:

Position

Type
vec3

getRenderingLayer() → {BigInt}

Inherited From:

Get the rendering layer of this node.

Returns:

: the uint16_t value of the layer.

Type
BigInt

getRigidBody() → {lumin.PhysicsRigidBody}

Inherited From:

Returns the PhysicsRigidBody attached to the node, if the node is participating in the physics
system.

Returns:

the rigid body

Type
lumin.PhysicsRigidBody

getRoot() → {lumin.RootNode}

Inherited From:

Gets the root node of the node tree this node belongs to.

Returns:

The root node, or nullptr if none.

Type
lumin.RootNode

getShader() → {lumin.utils.ShaderType}

Inherited From:

Returns shader type that is currently used

Returns:
Type
lumin.utils.ShaderType

getTabWidth() → {number}

Get the number of spaces to use for '\t' characters in
the string to render with setText. The default is 4.

Returns:

The tab width.

Type
number

getText() → {string}

Get the text currently set to be rendered by this node.

Returns:

The text.

Type
string

getUtf8Text() → {string}

Convert from Unicode and return the UTF-8 encoded text.

Returns:

The UTF-8 encoded text.

Type
string

getWorldBounds() → {Pair.<vec3, vec3>}

Get the world-space rectangle surrounding the text in the node.
Note the corners rotate with the node; this is an "oriented
bounding box". Per the comment for getLocalAABB, this function
can be slow if redoing the typesetting is required.

Returns:
Type
Pair.<vec3, vec3>

getWorldPosition() → {vec3}

Inherited From:

Get the World Position of this Node

Returns:

Position

Type
vec3

isDrmContent() → {boolean}

Inherited From:

Check if this Render Node is marked for DRM

Returns:

True = Marked as DRM Content

Type
boolean

isInLayer(a_layer) → {boolean}

Inherited From:

Checks to see if node subscribes to the specified node layer.

Parameters:
Name Type Description
a_layer BigInt

The layer to test if this node is a member of.

Returns:

True if this node subscribes to the specified layer.

Type
boolean

isInSubtree(pParent) → {boolean}

Inherited From:

Determines if this Node is within the subtree.

Parameters:
Name Type Description
pParent lumin.Node
Returns:

true if this Node is within the subtree, false if not.

Type
boolean

isSkipRaycast() → {boolean}

Inherited From:

Returns the skip raycast state of the node.

Returns:

True if the node is skipped during raycasting.

Type
boolean

isTriggerable() → {boolean}

Inherited From:

Returns true if this node should handle trigger presses directly.

Returns:

true if this node will handle trigger presses directly when focused,
false if trigger press will instead enter prism placement mode.

Type
boolean

isVisibilityInherited() → {boolean}

Inherited From:

Returns whether this Node's visibility is inherited by its children or not.

Returns:

True if the Node's visiblity is inherited.

Type
boolean

isVisible() → {boolean}

Inherited From:

Returns the visibility state of the node. Note that only the local state is checked, the
effect of a parent's visibility is ignored.

Returns:

True if the Node is visible.

Type
boolean

isVisibleInPrism() → {boolean}

Inherited From:

Returns the visibility of the Node in the hierarchy based on self visibility and any
potential inherited visibility.

Returns:

True if the Node is visible in the Prism.

Type
boolean

removeChild(a_pChild)

Inherited From:

Remove a child from the current Node

Parameters:
Name Type Description
a_pChild lumin.Node

The child Node to remove.

removeFromLayer(a_layer)

Inherited From:

Removes this node from the specified node layer.

Parameters:
Name Type Description
a_layer BigInt

The layer this node will be removed from.

setAdvanceDirection(direction)

Set this to override the value specified by the font to lay
out the text differently than the default for the language.

Parameters:
Name Type Description
direction lumin.glyph.AdvanceDirection

The text direction.

setAnchorPosition(a_position)

Inherited From:

Sets the anchor position of the Node's transform. Rotations, scaling, and translations of the
transform will take place around this point. Changing the anchor point will recalculate
the transform to the new anchor point.

Parameters:
Name Type Description
a_position vec3

Anchor position. This is relative to the default 0,0,0 position of the
transform.

setBackFaceCulls(a_on, a_renderStateIndexopt)

Inherited From:

Sets the back-face-cull setting for one or more render states.

Parameters:
Name Type Attributes Default Description
a_on boolean

The desired flag setting.

a_renderStateIndex number <optional>
-1

The index of the corresponding render state whose
flag will be changed. Note that the default value
will cause all states to have the required setting.

setBlooms(a_on, a_renderStateIndexopt)

Inherited From:

Flags whether or not the indicated render state will bloom

Parameters:
Name Type Attributes Default Description
a_on boolean

The desired flag setting.

a_renderStateIndex number <optional>
-1

The index of the corresponding render state whose
flag will be changed. Note that the default value
will cause all states to have the required setting.

setBloomStrength(a_bloomStrength)

Inherited From:

Set Bloom strength for this Render Node. If a material exists, the material bloom
will superseed this value. By Default the Bloom Strength is 0 for this node.

Parameters:
Name Type Description
a_bloomStrength number

the Bloom Strength

setCastsShadows(a_on, a_renderStateIndexopt)

Inherited From:

Flags whether or not the indicated render state will cast shadows.

Parameters:
Name Type Attributes Default Description
a_on boolean

The desired flag setting.

a_renderStateIndex number <optional>
-1

The index of the corresponding render state whose
flag will be changed. Note that the default value
will cause all states to have the required setting.

setCharacterSpacing(spacing)

Sets the additional character spacing that is applied
between characters. Note a spacing of 0 is the default
spacing.

Parameters:
Name Type Description
spacing number

the additional distance between characters
as a multiplier of the glyph height.

setColor(a_color)

Inherited From:

Sets the color to be used for every sub mesh within the render node.

Parameters:
Name Type Description
a_color vec4

The color to be used for every sub mesh within the render node.

setCursorHoverState(state)

Inherited From:

Set the cursor hover state for this Node.

Setting this will set the cursor state when this Node
or any descendant Nodes, that are not explicitly set,
are hovered over.

Parameters:
Name Type Description
state lumin.CursorHoverState

The cursor state

setDrmContent(a_on)

Inherited From:

Flags If this renderable node is using DRM Content

Parameters:
Name Type Description
a_on boolean

The desired flag setting.

setEditMode(editFlag)

Sets whether the Text2dNode should be in edit mode
or not. Edit mode allows the Text2dNode to be
used to enter and edit text, turning off white-space
trimming and providing cursor positions for each
character.

Parameters:
Name Type Description
editFlag boolean

The flag to set edit mode or not.

setFixedBounds(pDataopt)

Set a fixed region in which to render the text in the node.
setMaxGlyphsPerLine can still be used in conjunction with
setFixedBounds if wrapping is enabled. Justification
will be performed with respect to the width of the given
area rather than the node's local bounding box, which is
the default behavior if fixed bounds are not set.

Parameters:
Name Type Attributes Default Description
pData lumin.text.FixedBoundsData <optional>
null

a pointer to the description of the text area
to set or nullptr to disable rendering in fixed bounds and
revert to the default behavior of Text2dNode. If either
the width or height of the data are not both positive,
this function will have no effect, and the previous value
will remain unchanged.

setFlowDirection(flowDir)

Set this to override the value specified by the font for
the direction of text flow (from one line to the next).

Parameters:
Name Type Description
flowDir lumin.text.FlowDirection

The flow direction.

setFont(fontResourceId)

Set the font resource from a resource id. The font resource ID must be of a Font2dResource
object.

Parameters:
Name Type Description
fontResourceId BigInt

The resource id.

setFont(fontResource)

Set the font resource directly.

Parameters:
Name Type Description
fontResource lumin.Font2dResource

The resource.

setFrontFaceCulls(a_on, a_renderStateIndexopt)

Inherited From:

Sets the front-face-cull setting for one or more render states.

Parameters:
Name Type Attributes Default Description
a_on boolean

The desired flag setting.

a_renderStateIndex number <optional>
-1

The index of the corresponding render state whose
flag will be changed. Note that the default value
will cause all states to have the required setting.

setGlyphHeight(height)

Control the size of glyphs independently of the node transform
by overriding the global glyph height of the font. Glyph lines
will grow or shrink to conform to this constraint but always
retain their proportional baseline positions (ascent and descent)
and horizontal-to-vertical aspect ratio.

Parameters:
Name Type Description
height number

A positive value to which the tallest glyph will
be adjusted to equal, with other glyphs adjusted proportionally.

setIsOpaque(a_on, a_renderStateIndexopt)

Inherited From:

Sets the opacity setting for one or more render states.

Parameters:
Name Type Attributes Default Description
a_on boolean

The desired flag setting.

a_renderStateIndex number <optional>
-1

The index of the corresponding render state whose
flag will be changed. Note that the default value
will cause all states to have the required setting.

setIsUI(a_on, a_renderStateIndexopt)

Inherited From:

Sets if this should be rendered on the UI Layer.
Note: UI Layer is always rendered on top of everything else.

Parameters:
Name Type Attributes Default Description
a_on boolean

The desired flag setting.

a_renderStateIndex number <optional>
-1

The index of the corresponding render state whose
flag will be changed. Note that the default value
will cause all states to have the required setting.

setJustification(justification)

Set the justification for multi-line text.

Parameters:
Name Type Description
justification lumin.text.Justification

setLineSpacing(spacing)

Set the line spacing to adjust the distance between lines
of text; e.g., use 1 for single-spaced text, 2 for double-
spaced text.

Parameters:
Name Type Description
spacing number

The line spacing.

setLocalPosition(aPos)

Inherited From:

Set the local position of this Node

Parameters:
Name Type Description
aPos vec3

new position

setLocalRotation(aRot)

Inherited From:

Set the local rotation of this Node

Parameters:
Name Type Description
aRot quat

new rotation

setLocalScale(aScale)

Inherited From:

Set the local scale of this Node

Parameters:
Name Type Description
aScale vec3

new scale

setLocalTransform(aTransform)

Inherited From:

Set the local transform of this Node

Parameters:
Name Type Description
aTransform mat4

transform matrix

setMaxGlyphsPerLine(max)

If 0, the default, no limit will be enforced on the line
length. If positive, line breaks will be added so this
limit is not exceeded.

Parameters:
Name Type Description
max number

Number of glyphs before a line break.

setName(a_name) → {boolean}

Inherited From:

Set the name of the Node

By default a Node has no name.

Parameters:
Name Type Description
a_name string

The new name of the Node.

Returns:

true if the name of the Node was successfully set, false otherwise.

Type
boolean

setParentedBoneName(a_boneName) → {boolean}

Inherited From:

Set the bone in the parent by name that this child will attach to
This node must have a parent and the parent must be of type ModelNode.

Parameters:
Name Type Description
a_boneName string

bone name to attach to

Returns:

true if successful, false if failed

Type
boolean

setProperties(desc)

Set all text-node properties at once using the values in
the given data structure.

Parameters:
Name Type Description
desc lumin.Text2dDesc

Info about the text.

setPushesStencil(a_on, a_renderStateIndexopt)

Inherited From:

Sets the stencil push setting for one or more render states.

Parameters:
Name Type Attributes Default Description
a_on boolean

The desired flag setting.

a_renderStateIndex number <optional>
-1

The index of the corresponding render state whose
flag will be changed. Note that the default value
will cause all states to have the required setting.

setReadsClip(a_on, a_renderStateIndexopt)

Inherited From:

Sets the clip read setting for one or more render states.

Parameters:
Name Type Attributes Default Description
a_on boolean

The desired flag setting.

a_renderStateIndex number <optional>
-1

The index of the corresponding render state whose
flag will be changed. Note that the default value
will cause all states to have the required setting.

setReadsDepth(a_on, a_renderStateIndexopt)

Inherited From:

Sets the depth read setting for one or more render states.

Parameters:
Name Type Attributes Default Description
a_on boolean

The desired flag setting.

a_renderStateIndex number <optional>
-1

The index of the corresponding render state whose
flag will be changed. Note that the default value
will cause all states to have the required setting.

setReceivesLight(a_on, a_renderStateIndexopt)

Inherited From:

Flags whether or not the indicated render state will receive light.

Parameters:
Name Type Attributes Default Description
a_on boolean

The desired flag setting.

a_renderStateIndex number <optional>
-1

The index of the corresponding render state whose
flag will be changed. Note that the default value
will cause all states to have the required setting.

setReceivesShadows(a_on, a_renderStateIndexopt)

Inherited From:

Flags whether or not the indicated render state will receive shadows.

Parameters:
Name Type Attributes Default Description
a_on boolean

The desired flag setting.

a_renderStateIndex number <optional>
-1

The index of the corresponding render state whose
flag will be changed. Note that the default value
will cause all states to have the required setting.

setRenderingLayer(a_renderLayer)

Overrides:

Set Custom RenderLayer on which this renderNode will be rendered.

Parameters:
Name Type Description
a_renderLayer lumin.render.RenderingLayer

Of type uint16_t. Value will be clamped to kRenderingLayerMAX = 999, if more.

Note: Please use, "render::RenderingLayer" enum to set layers.
for eg. RenderNode->setRenderingLayer(render::RenderingLayer::kHUDLayer);
or you can also send in the layer value as well
eg. RenderNode->setRenderingLayer(static_cast<uint16_t>(render::RenderingLayer::kHUDLayer));

You can also create your own custom layering by using existing layers and your own.
eg. uint16_t customHUDLayer1 = static_cast<uint16_t>(render::RenderingLayer::kHUDLayer) + 1;
uint16_t customHUDLayer2 = static_cast<uint16_t>(render::RenderingLayer::kHUDLayer) + 2;
uint16_t customHUDLayer3 = static_cast<uint16_t>(render::RenderingLayer::kHUDLayer) + 3;

setShader(a_shaderType)

Inherited From:

Sets the shader to be used for every sub mesh within the model.

Parameters:
Name Type Description
a_shaderType lumin.utils.ShaderType

The shader type to be used for every sub mesh within the model.

setSkipRaycast(a_skipRaycast, a_propagateToChildrenopt)

Inherited From:

Sets the skip raycast state of the node.

Parameters:
Name Type Attributes Default Description
a_skipRaycast boolean

Raycast skip flag.

a_propagateToChildren boolean <optional>
false

Flag to also set the raycast state of any children