Documentation
¶
Overview ¶
A node for displaying plain text in 3D space. By adjusting various properties of this node, you can configure things such as the text's appearance and whether it always faces the camera.
Index ¶
- type Advanced
- type AlphaCutMode
- type Any
- type DrawFlags
- type Extension
- func (self *Extension[T]) AsGeometryInstance3D() GeometryInstance3D.Instance
- func (self *Extension[T]) AsLabel3D() Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsNode3D() Node3D.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
- type ID
- type Instance
- func (self Instance) AlphaAntialiasingEdge() Float.X
- func (self Instance) AlphaAntialiasingMode() BaseMaterial3D.AlphaAntiAliasing
- func (self Instance) AlphaCut() AlphaCutMode
- func (self Instance) AlphaHashScale() Float.X
- func (self Instance) AlphaScissorThreshold() Float.X
- func (self Instance) AsGeometryInstance3D() GeometryInstance3D.Instance
- func (self Instance) AsLabel3D() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
- func (self Instance) AutowrapMode() TextServer.AutowrapMode
- func (self Instance) AutowrapTrimFlags() TextServer.LineBreakFlag
- func (self Instance) Billboard() BaseMaterial3D.BillboardMode
- func (self Instance) DoubleSided() bool
- func (self Instance) FixedSize() bool
- func (self Instance) Font() Font.Instance
- func (self Instance) FontSize() int
- func (self Instance) GenerateTriangleMesh() TriangleMesh.Instance
- func (self Instance) HorizontalAlignment() GUI.HorizontalAlignment
- func (self Instance) ID() ID
- func (self Instance) JustificationFlags() TextServer.JustificationFlag
- func (self Instance) Language() string
- func (self Instance) LineSpacing() Float.X
- func (self Instance) Modulate() Color.RGBA
- func (self Instance) NoDepthTest() bool
- func (self Instance) Offset() Vector2.XY
- func (self Instance) OutlineModulate() Color.RGBA
- func (self Instance) OutlineRenderPriority() int
- func (self Instance) OutlineSize() int
- func (self Instance) PixelSize() Float.X
- func (self Instance) RenderPriority() int
- func (self Instance) SetAlphaAntialiasingEdge(value Float.X)
- func (self Instance) SetAlphaAntialiasingMode(value BaseMaterial3D.AlphaAntiAliasing)
- func (self Instance) SetAlphaCut(value AlphaCutMode)
- func (self Instance) SetAlphaHashScale(value Float.X)
- func (self Instance) SetAlphaScissorThreshold(value Float.X)
- func (self Instance) SetAutowrapMode(value TextServer.AutowrapMode)
- func (self Instance) SetAutowrapTrimFlags(value TextServer.LineBreakFlag)
- func (self Instance) SetBillboard(value BaseMaterial3D.BillboardMode)
- func (self Instance) SetDoubleSided(value bool)
- func (self Instance) SetFixedSize(value bool)
- func (self Instance) SetFont(value Font.Instance)
- func (self Instance) SetFontSize(value int)
- func (self Instance) SetHorizontalAlignment(value GUI.HorizontalAlignment)
- func (self Instance) SetJustificationFlags(value TextServer.JustificationFlag)
- func (self Instance) SetLanguage(value string)
- func (self Instance) SetLineSpacing(value Float.X)
- func (self Instance) SetModulate(value Color.RGBA)
- func (self Instance) SetNoDepthTest(value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetOffset(value Vector2.XY)
- func (self Instance) SetOutlineModulate(value Color.RGBA)
- func (self Instance) SetOutlineRenderPriority(value int)
- func (self Instance) SetOutlineSize(value int)
- func (self Instance) SetPixelSize(value Float.X)
- func (self Instance) SetRenderPriority(value int)
- func (self Instance) SetShaded(value bool)
- func (self Instance) SetStructuredTextBidiOverride(value TextServer.StructuredTextParser)
- func (self Instance) SetStructuredTextBidiOverrideOptions(value []any)
- func (self Instance) SetText(value string)
- func (self Instance) SetTextDirection(value TextServer.Direction)
- func (self Instance) SetTextureFilter(value BaseMaterial3D.TextureFilter)
- func (self Instance) SetUppercase(value bool)
- func (self Instance) SetVerticalAlignment(value GUI.VerticalAlignment)
- func (self Instance) SetWidth(value Float.X)
- func (self Instance) Shaded() bool
- func (self Instance) StructuredTextBidiOverride() TextServer.StructuredTextParser
- func (self Instance) StructuredTextBidiOverrideOptions() []any
- func (self Instance) Text() string
- func (self Instance) TextDirection() TextServer.Direction
- func (self Instance) TextureFilter() BaseMaterial3D.TextureFilter
- func (self Instance) Uppercase() bool
- func (self Instance) VerticalAlignment() GUI.VerticalAlignment
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) Width() Float.X
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type AlphaCutMode ¶
type AlphaCutMode int //gd:Label3D.AlphaCutMode
const ( // This mode performs standard alpha blending. It can display translucent areas, but transparency sorting issues may be visible when multiple transparent materials are overlapping. [GeometryInstance3D.CastShadow] has no effect when this transparency mode is used; the [Label3D] will never cast shadows. // // [GeometryInstance3D.CastShadow]: https://pkg.go.dev/graphics.gd/classdb/GeometryInstance3D#Instance.CastShadow // [Label3D]: https://pkg.go.dev/graphics.gd/classdb/Label3D AlphaCutDisabled AlphaCutMode = 0 // This mode only allows fully transparent or fully opaque pixels. Harsh edges will be visible unless some form of screen-space antialiasing is enabled (see [ProjectSettings] "rendering/anti_aliasing/quality/screen_space_aa"). This mode is also known as alpha testing or 1-bit transparency. // // Note: This mode might have issues with anti-aliased fonts and outlines, try adjusting [AlphaScissorThreshold] or using MSDF font. // // Note: When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline. // // [AlphaScissorThreshold]: https://pkg.go.dev/graphics.gd/classdb/#Instance.AlphaScissorThreshold // [ProjectSettings]: https://pkg.go.dev/graphics.gd/classdb/ProjectSettings AlphaCutDiscard AlphaCutMode = 1 // This mode draws fully opaque pixels in the depth prepass. This is slower than [AlphaCutDisabled] or [AlphaCutDiscard], but it allows displaying translucent areas and smooth edges while using proper sorting. // // Note: When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline. AlphaCutOpaquePrepass AlphaCutMode = 2 // This mode draws cuts off all values below a spatially-deterministic threshold, the rest will remain opaque. AlphaCutHash AlphaCutMode = 3 )
type DrawFlags ¶
type DrawFlags int //gd:Label3D.DrawFlags
const ( // If set, lights in the environment affect the label. FlagShaded DrawFlags = 0 // If set, text can be seen from the back as well. If not, the text is invisible when looking at it from behind. FlagDoubleSided DrawFlags = 1 // Disables the depth test, so this object is drawn on top of all others. However, objects drawn after it in the draw order may cover it. FlagDisableDepthTest DrawFlags = 2 // Label is scaled by depth so that it always appears the same size on screen. FlagFixedSize DrawFlags = 3 // Represents the size of the [DrawFlags] enum. FlagMax DrawFlags = 4 )
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsGeometryInstance3D ¶
func (self *Extension[T]) AsGeometryInstance3D() GeometryInstance3D.Instance
func (*Extension[T]) AsVisualInstance3D ¶
func (self *Extension[T]) AsVisualInstance3D() VisualInstance3D.Instance
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AlphaAntialiasingEdge ¶
Threshold at which antialiasing will be applied on the alpha channel.
func (Instance) AlphaAntialiasingMode ¶
func (self Instance) AlphaAntialiasingMode() BaseMaterial3D.AlphaAntiAliasing
The type of alpha antialiasing to apply.
func (Instance) AlphaCut ¶
func (self Instance) AlphaCut() AlphaCutMode
The alpha cutting mode to use for the sprite.
func (Instance) AlphaHashScale ¶
The hashing scale for Alpha Hash. Recommended values between 0 and 2.
func (Instance) AlphaScissorThreshold ¶
Threshold at which the alpha scissor will discard values.
func (Instance) AsGeometryInstance3D ¶
func (self Instance) AsGeometryInstance3D() GeometryInstance3D.Instance
func (Instance) AsVisualInstance3D ¶
func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
func (Instance) AutowrapMode ¶
func (self Instance) AutowrapMode() TextServer.AutowrapMode
If set to something other than [Textserver.AutowrapOff], the text gets wrapped inside the node's bounding rectangle. If you resize the node, it will change its height automatically to show all the text.
func (Instance) AutowrapTrimFlags ¶
func (self Instance) AutowrapTrimFlags() TextServer.LineBreakFlag
Autowrap space trimming flags. See [Textserver.BreakTrimStartEdgeSpaces] and [Textserver.BreakTrimEndEdgeSpaces] for more info.
func (Instance) Billboard ¶
func (self Instance) Billboard() BaseMaterial3D.BillboardMode
The billboard mode to use for the label.
func (Instance) DoubleSided ¶
If true, text can be seen from the back as well, if false, it is invisible when looking at it from behind.
func (Instance) FixedSize ¶
If true, the label is rendered at the same size regardless of distance. The label's size on screen is the same as if the camera was 1.0 units away from the label's origin, regardless of the actual distance from the camera. The Camera3D's field of view (or Camera3D.Size when in orthogonal/frustum mode) still affects the size the label is drawn at.
func (Instance) FontSize ¶
Font size of the Label3D's text. To make the font look more detailed when up close, increase FontSize while decreasing PixelSize at the same time.
Higher font sizes require more time to render new characters, which can cause stuttering during gameplay.
func (Instance) GenerateTriangleMesh ¶
func (self Instance) GenerateTriangleMesh() TriangleMesh.Instance
Returns a TriangleMesh with the label's vertices following its current configuration (such as its PixelSize).
func (Instance) HorizontalAlignment ¶
func (self Instance) HorizontalAlignment() GUI.HorizontalAlignment
Controls the text's horizontal alignment. Supports left, center, right, and fill (also known as justify).
func (Instance) JustificationFlags ¶
func (self Instance) JustificationFlags() TextServer.JustificationFlag
Line fill alignment rules.
func (Instance) Language ¶
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
func (Instance) LineSpacing ¶
Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative.
func (Instance) Modulate ¶
Text Color.RGBA of the Label3D.
func (Instance) NoDepthTest ¶
If true, depth testing is disabled and the object will be drawn in render order.
func (Instance) OutlineModulate ¶
The tint of text outline.
func (Instance) OutlineRenderPriority ¶
Sets the render priority for the text outline. Higher priority objects will be sorted in front of lower priority objects.
Note: This only applies if AlphaCut is set to AlphaCutDisabled (default value).
Note: This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
func (Instance) PixelSize ¶
The size of one pixel's width on the label to scale it in 3D. To make the font look more detailed when up close, increase FontSize while decreasing PixelSize at the same time.
func (Instance) RenderPriority ¶
Sets the render priority for the text. Higher priority objects will be sorted in front of lower priority objects.
Note: This only applies if AlphaCut is set to AlphaCutDisabled (default value).
Note: This only applies to sorting of transparent objects. This will not impact how transparent objects are sorted relative to opaque objects. This is because opaque objects are not sorted, while transparent objects are sorted from back to front (subject to priority).
func (Instance) SetAlphaAntialiasingEdge ¶
SetAlphaAntialiasingEdge sets the property returned by [GetAlphaAntialiasingEdge].
func (Instance) SetAlphaAntialiasingMode ¶
func (self Instance) SetAlphaAntialiasingMode(value BaseMaterial3D.AlphaAntiAliasing)
SetAlphaAntialiasingMode sets the property returned by [GetAlphaAntialiasing].
func (Instance) SetAlphaCut ¶
func (self Instance) SetAlphaCut(value AlphaCutMode)
SetAlphaCut sets the property returned by [GetAlphaCutMode].
func (Instance) SetAlphaHashScale ¶
SetAlphaHashScale sets the property returned by [GetAlphaHashScale].
func (Instance) SetAlphaScissorThreshold ¶
SetAlphaScissorThreshold sets the property returned by [GetAlphaScissorThreshold].
func (Instance) SetAutowrapMode ¶
func (self Instance) SetAutowrapMode(value TextServer.AutowrapMode)
SetAutowrapMode sets the property returned by [GetAutowrapMode].
func (Instance) SetAutowrapTrimFlags ¶
func (self Instance) SetAutowrapTrimFlags(value TextServer.LineBreakFlag)
SetAutowrapTrimFlags sets the property returned by [GetAutowrapTrimFlags].
func (Instance) SetBillboard ¶
func (self Instance) SetBillboard(value BaseMaterial3D.BillboardMode)
SetBillboard sets the property returned by [GetBillboardMode].
func (Instance) SetDoubleSided ¶
SetDoubleSided sets the property returned by [GetDrawFlag].
func (Instance) SetFixedSize ¶
SetFixedSize sets the property returned by [GetDrawFlag].
func (Instance) SetFontSize ¶
SetFontSize sets the property returned by [GetFontSize].
func (Instance) SetHorizontalAlignment ¶
func (self Instance) SetHorizontalAlignment(value GUI.HorizontalAlignment)
SetHorizontalAlignment sets the property returned by [GetHorizontalAlignment].
func (Instance) SetJustificationFlags ¶
func (self Instance) SetJustificationFlags(value TextServer.JustificationFlag)
SetJustificationFlags sets the property returned by [GetJustificationFlags].
func (Instance) SetLanguage ¶
SetLanguage sets the property returned by [GetLanguage].
func (Instance) SetLineSpacing ¶
SetLineSpacing sets the property returned by [GetLineSpacing].
func (Instance) SetModulate ¶
SetModulate sets the property returned by [GetModulate].
func (Instance) SetNoDepthTest ¶
SetNoDepthTest sets the property returned by [GetDrawFlag].
func (Instance) SetOutlineModulate ¶
SetOutlineModulate sets the property returned by [GetOutlineModulate].
func (Instance) SetOutlineRenderPriority ¶
SetOutlineRenderPriority sets the property returned by [GetOutlineRenderPriority].
func (Instance) SetOutlineSize ¶
SetOutlineSize sets the property returned by [GetOutlineSize].
func (Instance) SetPixelSize ¶
SetPixelSize sets the property returned by [GetPixelSize].
func (Instance) SetRenderPriority ¶
SetRenderPriority sets the property returned by [GetRenderPriority].
func (Instance) SetStructuredTextBidiOverride ¶
func (self Instance) SetStructuredTextBidiOverride(value TextServer.StructuredTextParser)
SetStructuredTextBidiOverride sets the property returned by [GetStructuredTextBidiOverride].
func (Instance) SetStructuredTextBidiOverrideOptions ¶
SetStructuredTextBidiOverrideOptions sets the property returned by [GetStructuredTextBidiOverrideOptions].
func (Instance) SetTextDirection ¶
func (self Instance) SetTextDirection(value TextServer.Direction)
SetTextDirection sets the property returned by [GetTextDirection].
func (Instance) SetTextureFilter ¶
func (self Instance) SetTextureFilter(value BaseMaterial3D.TextureFilter)
SetTextureFilter sets the property returned by [GetTextureFilter].
func (Instance) SetUppercase ¶
SetUppercase sets the property returned by [IsUppercase].
func (Instance) SetVerticalAlignment ¶
func (self Instance) SetVerticalAlignment(value GUI.VerticalAlignment)
SetVerticalAlignment sets the property returned by [GetVerticalAlignment].
func (Instance) Shaded ¶
If true, the Light3D in the Environment has effects on the label.
func (Instance) StructuredTextBidiOverride ¶
func (self Instance) StructuredTextBidiOverride() TextServer.StructuredTextParser
Set BiDi algorithm override for the structured text.
func (Instance) StructuredTextBidiOverrideOptions ¶
Set additional options for BiDi override.
func (Instance) TextDirection ¶
func (self Instance) TextDirection() TextServer.Direction
Base text writing direction.
func (Instance) TextureFilter ¶
func (self Instance) TextureFilter() BaseMaterial3D.TextureFilter
Filter flags for the texture.
func (Instance) VerticalAlignment ¶
func (self Instance) VerticalAlignment() GUI.VerticalAlignment
Controls the text's vertical alignment. Supports top, center, and bottom.