Documentation
¶
Overview ¶
A node that displays 2D texture information in a 3D environment. See also Sprite3D where many other properties are defined.
Index ¶
- type Advanced
- type AlphaCutMode
- type Any
- type DrawFlags
- type Extension
- func (self *Extension[T]) AsGeometryInstance3D() GeometryInstance3D.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]) AsSpriteBase3D() Instance
- 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) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsSpriteBase3D() Instance
- func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
- func (self Instance) Axis() Vector3.Axis
- func (self Instance) Billboard() BaseMaterial3D.BillboardMode
- func (self Instance) Centered() bool
- func (self Instance) DoubleSided() bool
- func (self Instance) FixedSize() bool
- func (self Instance) FlipH() bool
- func (self Instance) FlipV() bool
- func (self Instance) GenerateTriangleMesh() TriangleMesh.Instance
- func (self Instance) GetItemRect() Rect2.PositionSize
- func (self Instance) ID() ID
- func (self Instance) Modulate() Color.RGBA
- func (self Instance) NoDepthTest() bool
- func (self Instance) Offset() Vector2.XY
- 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) SetAxis(value Vector3.Axis)
- func (self Instance) SetBillboard(value BaseMaterial3D.BillboardMode)
- func (self Instance) SetCentered(value bool)
- func (self Instance) SetDoubleSided(value bool)
- func (self Instance) SetFixedSize(value bool)
- func (self Instance) SetFlipH(value bool)
- func (self Instance) SetFlipV(value bool)
- 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) SetPixelSize(value Float.X)
- func (self Instance) SetRenderPriority(value int)
- func (self Instance) SetShaded(value bool)
- func (self Instance) SetTextureFilter(value BaseMaterial3D.TextureFilter)
- func (self Instance) SetTransparent(value bool)
- func (self Instance) Shaded() bool
- func (self Instance) TextureFilter() BaseMaterial3D.TextureFilter
- func (self Instance) Transparent() bool
- func (self Instance) Virtual(name string) reflect.Value
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:SpriteBase3D.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. 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"). On the bright side, this mode doesn't suffer from transparency sorting issues when multiple transparent materials are overlapping. This mode is also known as alpha testing or 1-bit transparency. // // [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. 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:SpriteBase3D.DrawFlags
const ( // If set, the texture's transparency and the opacity are used to make those parts of the sprite invisible. FlagTransparent DrawFlags = 0 // If set, lights in the environment affect the sprite. FlagShaded DrawFlags = 1 // If set, texture can be seen from the back as well. If not, the texture is invisible when looking at it from behind. FlagDoubleSided DrawFlags = 2 // 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 = 3 // Label is scaled by depth so that it always appears the same size on screen. FlagFixedSize DrawFlags = 4 // Represents the size of the [DrawFlags] enum. FlagMax DrawFlags = 5 )
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]) AsSpriteBase3D ¶
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 ¶
type Instance [1]gdclass.SpriteBase3D
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) AsSpriteBase3D ¶
func (Instance) AsVisualInstance3D ¶
func (self Instance) AsVisualInstance3D() VisualInstance3D.Instance
func (Instance) Billboard ¶
func (self Instance) Billboard() BaseMaterial3D.BillboardMode
The billboard mode to use for the sprite.
Note: When billboarding is enabled and the material also casts shadows, billboards will face the camera in the scene when rendering shadows. In scenes with multiple cameras, the intended shadow cannot be determined and this will result in undefined behavior. See GitHub Pull Request #72638 for details.
func (Instance) DoubleSided ¶
If true, texture 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 texture is rendered at the same size regardless of distance. The texture's size on screen is the same as if the camera was 1.0 units away from the texture'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 sprite is drawn at.
func (Instance) GenerateTriangleMesh ¶
func (self Instance) GenerateTriangleMesh() TriangleMesh.Instance
Returns a TriangleMesh with the sprite's vertices following its current configuration (such as its Axis and PixelSize).
func (Instance) GetItemRect ¶
func (self Instance) GetItemRect() Rect2.PositionSize
Returns the rectangle representing this sprite.
func (Instance) Modulate ¶
A color value used to multiply the texture's colors. Can be used for mood-coloring or to simulate the color of ambient light.
Note: Unlike CanvasItem.Modulate for 2D, colors with values above 1.0 (overbright) are not supported.
Note: If a GeometryInstance3D.MaterialOverride is defined on the SpriteBase3D, the material override must be configured to take vertex colors into account for albedo. Otherwise, the color defined in Modulate will be ignored. For a BaseMaterial3D, BaseMaterial3D.VertexColorUseAsAlbedo must be true. For a ShaderMaterial, ALBEDO *= COLOR.rgb; must be inserted in the shader's fragment() function.
func (Instance) NoDepthTest ¶
If true, depth testing is disabled and the object will be drawn in render order.
func (Instance) Offset ¶
The texture's drawing offset.
Note: When you increase Offset.y in Sprite3D, the sprite moves upward in world space (i.e., +Y is up).
func (Instance) RenderPriority ¶
Sets the render priority for the sprite. 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) SetBillboard ¶
func (self Instance) SetBillboard(value BaseMaterial3D.BillboardMode)
SetBillboard sets the property returned by [GetBillboardMode].
func (Instance) SetCentered ¶
SetCentered sets the property returned by [IsCentered].
func (Instance) SetDoubleSided ¶
SetDoubleSided sets the property returned by [GetDrawFlag].
func (Instance) SetFixedSize ¶
SetFixedSize sets the property returned by [GetDrawFlag].
func (Instance) SetModulate ¶
SetModulate sets the property returned by [GetModulate].
func (Instance) SetNoDepthTest ¶
SetNoDepthTest sets the property returned by [GetDrawFlag].
func (Instance) SetPixelSize ¶
SetPixelSize sets the property returned by [GetPixelSize].
func (Instance) SetRenderPriority ¶
SetRenderPriority sets the property returned by [GetRenderPriority].
func (Instance) SetTextureFilter ¶
func (self Instance) SetTextureFilter(value BaseMaterial3D.TextureFilter)
SetTextureFilter sets the property returned by [GetTextureFilter].
func (Instance) SetTransparent ¶
SetTransparent sets the property returned by [GetDrawFlag].
func (Instance) Shaded ¶
If true, the Light3D in the Environment has effects on the sprite.
func (Instance) TextureFilter ¶
func (self Instance) TextureFilter() BaseMaterial3D.TextureFilter
Filter flags for the texture.
Note: Linear filtering may cause artifacts around the edges, which are especially noticeable on opaque textures. To prevent this, use textures with transparent or identical colors around the edges.
func (Instance) Transparent ¶
If true, the texture's transparency and the opacity are used to make those parts of the sprite invisible.