Viewport

package
v0.0.0-...-ad02d68 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2025 License: MIT Imports: 36 Imported by: 0

Documentation

Overview

A [Viewport] creates a different view into the screen, or a sub-view inside another viewport. Child 2D nodes will display on it, and child Camera3D 3D nodes will render on it too. Optionally, a viewport can have its own 2D or 3D world, so it doesn't share what it draws with other viewports. Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it. Also, viewports can be assigned to different screens in case the devices have multiple screens. Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.

Index

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 AnisotropicFiltering

type AnisotropicFiltering int //gd:Viewport.AnisotropicFiltering
const (
	/*Anisotropic filtering is disabled.*/
	AnisotropyDisabled AnisotropicFiltering = 0
	/*Use 2× anisotropic filtering.*/
	Anisotropy2x AnisotropicFiltering = 1
	/*Use 4× anisotropic filtering. This is the default value.*/
	Anisotropy4x AnisotropicFiltering = 2
	/*Use 8× anisotropic filtering.*/
	Anisotropy8x AnisotropicFiltering = 3
	/*Use 16× anisotropic filtering.*/
	Anisotropy16x AnisotropicFiltering = 4
	/*Represents the size of the [enum AnisotropicFiltering] enum.*/
	AnisotropyMax AnisotropicFiltering = 5
)

type Any

type Any interface {
	gd.IsClass
	AsViewport() Instance
}

type DebugDraw

type DebugDraw int //gd:Viewport.DebugDraw
const (
	/*Objects are displayed normally.*/
	DebugDrawDisabled DebugDraw = 0
	/*Objects are displayed without light information.*/
	DebugDrawUnshaded DebugDraw = 1
	/*Objects are displayed without textures and only with lighting information.*/
	DebugDrawLighting DebugDraw = 2
	/*Objects are displayed semi-transparent with additive blending so you can see where they are drawing over top of one another. A higher overdraw means you are wasting performance on drawing pixels that are being hidden behind others.*/
	DebugDrawOverdraw DebugDraw = 3
	/*Objects are displayed as wireframe models.
	  [b]Note:[/b] [method RenderingServer.set_debug_generate_wireframes] must be called before loading any meshes for wireframes to be visible when using the Compatibility renderer.*/
	DebugDrawWireframe DebugDraw = 4
	/*Objects are displayed without lighting information and their textures replaced by normal mapping.*/
	DebugDrawNormalBuffer DebugDraw = 5
	/*Objects are displayed with only the albedo value from [VoxelGI]s.*/
	DebugDrawVoxelGiAlbedo DebugDraw = 6
	/*Objects are displayed with only the lighting value from [VoxelGI]s.*/
	DebugDrawVoxelGiLighting DebugDraw = 7
	/*Objects are displayed with only the emission color from [VoxelGI]s.*/
	DebugDrawVoxelGiEmission DebugDraw = 8
	/*Draws the shadow atlas that stores shadows from [OmniLight3D]s and [SpotLight3D]s in the upper left quadrant of the [Viewport].*/
	DebugDrawShadowAtlas DebugDraw = 9
	/*Draws the shadow atlas that stores shadows from [DirectionalLight3D]s in the upper left quadrant of the [Viewport].*/
	DebugDrawDirectionalShadowAtlas DebugDraw = 10
	/*Draws the scene luminance buffer (if available) in the upper left quadrant of the [Viewport].*/
	DebugDrawSceneLuminance DebugDraw = 11
	/*Draws the screen-space ambient occlusion texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have [member Environment.ssao_enabled] set in your [WorldEnvironment].*/
	DebugDrawSsao DebugDraw = 12
	/*Draws the screen-space indirect lighting texture instead of the scene so that you can clearly see how it is affecting objects. In order for this display mode to work, you must have [member Environment.ssil_enabled] set in your [WorldEnvironment].*/
	DebugDrawSsil DebugDraw = 13
	/*Colors each PSSM split for the [DirectionalLight3D]s in the scene a different color so you can see where the splits are. In order, they will be colored red, green, blue, and yellow.*/
	DebugDrawPssmSplits DebugDraw = 14
	/*Draws the decal atlas used by [Decal]s and light projector textures in the upper left quadrant of the [Viewport].*/
	DebugDrawDecalAtlas DebugDraw = 15
	/*Draws the cascades used to render signed distance field global illumination (SDFGI).
	  Does nothing if the current environment's [member Environment.sdfgi_enabled] is [code]false[/code] or SDFGI is not supported on the platform.*/
	DebugDrawSdfgi DebugDraw = 16
	/*Draws the probes used for signed distance field global illumination (SDFGI).
	  Does nothing if the current environment's [member Environment.sdfgi_enabled] is [code]false[/code] or SDFGI is not supported on the platform.*/
	DebugDrawSdfgiProbes DebugDraw = 17
	/*Draws the buffer used for global illumination (GI).*/
	DebugDrawGiBuffer DebugDraw = 18
	/*Draws all of the objects at their highest polycount, without low level of detail (LOD).*/
	DebugDrawDisableLod DebugDraw = 19
	/*Draws the cluster used by [OmniLight3D] nodes to optimize light rendering.*/
	DebugDrawClusterOmniLights DebugDraw = 20
	/*Draws the cluster used by [SpotLight3D] nodes to optimize light rendering.*/
	DebugDrawClusterSpotLights DebugDraw = 21
	/*Draws the cluster used by [Decal] nodes to optimize decal rendering.*/
	DebugDrawClusterDecals DebugDraw = 22
	/*Draws the cluster used by [ReflectionProbe] nodes to optimize decal rendering.*/
	DebugDrawClusterReflectionProbes DebugDraw = 23
	/*Draws the buffer used for occlusion culling.*/
	DebugDrawOccluders DebugDraw = 24
	/*Draws vector lines over the viewport to indicate the movement of pixels between frames.*/
	DebugDrawMotionVectors DebugDraw = 25
	/*Draws the internal resolution buffer of the scene before post-processing is applied.*/
	DebugDrawInternalBuffer DebugDraw = 26
)

type DefaultCanvasItemTextureFilter

type DefaultCanvasItemTextureFilter int //gd:Viewport.DefaultCanvasItemTextureFilter
const (
	/*The texture filter reads from the nearest pixel only. This makes the texture look pixelated from up close, and grainy from a distance (due to mipmaps not being sampled).*/
	DefaultCanvasItemTextureFilterNearest DefaultCanvasItemTextureFilter = 0
	/*The texture filter blends between the nearest 4 pixels. This makes the texture look smooth from up close, and grainy from a distance (due to mipmaps not being sampled).*/
	DefaultCanvasItemTextureFilterLinear DefaultCanvasItemTextureFilter = 1
	/*The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps (or uses the nearest mipmap if [member ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter] is [code]true[/code]). This makes the texture look smooth from up close, and smooth from a distance.
	  Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to [Camera2D] zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than on-screen pixels.*/
	DefaultCanvasItemTextureFilterLinearWithMipmaps DefaultCanvasItemTextureFilter = 2
	/*The texture filter reads from the nearest pixel and blends between the nearest 2 mipmaps (or uses the nearest mipmap if [member ProjectSettings.rendering/textures/default_filters/use_nearest_mipmap_filter] is [code]true[/code]). This makes the texture look pixelated from up close, and smooth from a distance.
	  Use this for non-pixel art textures that may be viewed at a low scale (e.g. due to [Camera2D] zoom or sprite scaling), as mipmaps are important to smooth out pixels that are smaller than on-screen pixels.*/
	DefaultCanvasItemTextureFilterNearestWithMipmaps DefaultCanvasItemTextureFilter = 3
	/*Represents the size of the [enum DefaultCanvasItemTextureFilter] enum.*/
	DefaultCanvasItemTextureFilterMax DefaultCanvasItemTextureFilter = 4
)

type DefaultCanvasItemTextureRepeat

type DefaultCanvasItemTextureRepeat int //gd:Viewport.DefaultCanvasItemTextureRepeat
const (
	/*Disables textures repeating. Instead, when reading UVs outside the 0-1 range, the value will be clamped to the edge of the texture, resulting in a stretched out look at the borders of the texture.*/
	DefaultCanvasItemTextureRepeatDisabled DefaultCanvasItemTextureRepeat = 0
	/*Enables the texture to repeat when UV coordinates are outside the 0-1 range. If using one of the linear filtering modes, this can result in artifacts at the edges of a texture when the sampler filters across the edges of the texture.*/
	DefaultCanvasItemTextureRepeatEnabled DefaultCanvasItemTextureRepeat = 1
	/*Flip the texture when repeating so that the edge lines up instead of abruptly changing.*/
	DefaultCanvasItemTextureRepeatMirror DefaultCanvasItemTextureRepeat = 2
	/*Represents the size of the [enum DefaultCanvasItemTextureRepeat] enum.*/
	DefaultCanvasItemTextureRepeatMax DefaultCanvasItemTextureRepeat = 3
)

type Expanded

type Expanded [1]gdclass.Viewport

func (Expanded) PushInput

func (self Expanded) PushInput(event InputEvent.Instance, in_local_coords bool)

Triggers the given 'event' in this [Viewport]. This can be used to pass an [InputEvent] between viewports, or to locally apply inputs that were sent over the network or saved to a file. If 'in_local_coords' is false, the event's position is in the embedder's coordinates and will be converted to viewport coordinates. If 'in_local_coords' is true, the event's position is in viewport coordinates. While this method serves a similar purpose as [Instance.Input.ParseInputEvent], it does not remap the specified 'event' based on project settings like [member ProjectSettings.input_devices/pointing/emulate_touch_from_mouse]. Calling this method will propagate calls to child nodes for following methods in the given order: - [Instance.Node.Input] - [Instance.Control.GuiInput] for [Control] nodes - [Instance.Node.ShortcutInput] - [Instance.Node.UnhandledKeyInput] - [Instance.Node.UnhandledInput] If an earlier method marks the input as handled via Instance.SetInputAsHandled, any later method in this list will not be called. If none of the methods handle the event and [member physics_object_picking] is true, the event is used for physics object picking.

func (Expanded) PushUnhandledInput

func (self Expanded) PushUnhandledInput(event InputEvent.Instance, in_local_coords bool)

Triggers the given 'event' in this [Viewport]. This can be used to pass an [InputEvent] between viewports, or to locally apply inputs that were sent over the network or saved to a file. If 'in_local_coords' is false, the event's position is in the embedder's coordinates and will be converted to viewport coordinates. If 'in_local_coords' is true, the event's position is in viewport coordinates. Calling this method will propagate calls to child nodes for following methods in the given order: - [Instance.Node.ShortcutInput] - [Instance.Node.UnhandledKeyInput] - [Instance.Node.UnhandledInput] If an earlier method marks the input as handled via Instance.SetInputAsHandled, any later method in this list will not be called. If none of the methods handle the event and [member physics_object_picking] is true, the event is used for physics object picking. Note: This method doesn't propagate input events to embedded [Window]s or [SubViewport]s.

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsViewport

func (self *Extension[T]) AsViewport() Instance

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.Viewport

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 Get

func Get(peer Node.Instance) Instance

Returns the node's closest [Viewport] ancestor, if the node is inside the tree. Otherwise, returns [code]null[/code].

func New

func New() Instance

func (Instance) AnisotropicFilteringLevel

func (self Instance) AnisotropicFilteringLevel() AnisotropicFiltering

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsViewport

func (self Instance) AsViewport() Instance

func (Instance) AudioListenerEnable2d

func (self Instance) AudioListenerEnable2d() bool

func (Instance) AudioListenerEnable3d

func (self Instance) AudioListenerEnable3d() bool

func (Instance) CanvasCullMask

func (self Instance) CanvasCullMask() int

func (Instance) CanvasItemDefaultTextureFilter

func (self Instance) CanvasItemDefaultTextureFilter() DefaultCanvasItemTextureFilter

func (Instance) CanvasItemDefaultTextureRepeat

func (self Instance) CanvasItemDefaultTextureRepeat() DefaultCanvasItemTextureRepeat

func (Instance) CanvasTransform

func (self Instance) CanvasTransform() Transform2D.OriginXY

func (Instance) DebugDraw

func (self Instance) DebugDraw() DebugDraw

func (Instance) Disable3d

func (self Instance) Disable3d() bool

func (Instance) FindWorld2d

func (self Instance) FindWorld2d() World2D.Instance

Returns the first valid [World2D] for this viewport, searching the [member world_2d] property of itself and any Viewport ancestor.

func (Instance) FindWorld3d

func (self Instance) FindWorld3d() World3D.Instance

Returns the first valid [World3D] for this viewport, searching the [member world_3d] property of itself and any Viewport ancestor.

func (Instance) FsrSharpness

func (self Instance) FsrSharpness() Float.X

func (Instance) GetAudioListener2d

func (self Instance) GetAudioListener2d() AudioListener2D.Instance

Returns the currently active 2D audio listener. Returns null if there are no active 2D audio listeners, in which case the active 2D camera will be treated as listener.

func (Instance) GetAudioListener3d

func (self Instance) GetAudioListener3d() AudioListener3D.Instance

Returns the currently active 3D audio listener. Returns null if there are no active 3D audio listeners, in which case the active 3D camera will be treated as listener.

func (Instance) GetCamera2d

func (self Instance) GetCamera2d() Camera2D.Instance

Returns the currently active 2D camera. Returns null if there are no active cameras.

func (Instance) GetCamera3d

func (self Instance) GetCamera3d() Camera3D.Instance

Returns the currently active 3D camera.

func (Instance) GetCanvasCullMaskBit

func (self Instance) GetCanvasCullMaskBit(layer int) bool

Returns an individual bit on the rendering layer mask.

func (Instance) GetFinalTransform

func (self Instance) GetFinalTransform() Transform2D.OriginXY

Returns the transform from the viewport's coordinate system to the embedder's coordinate system.

func (Instance) GetMousePosition

func (self Instance) GetMousePosition() Vector2.XY

Returns the mouse's position in this [Viewport] using the coordinate system of this [Viewport].

func (Instance) GetRenderInfo

func (self Instance) GetRenderInfo(atype RenderInfoType, info RenderInfo) int

Returns rendering statistics of the given type. See RenderInfoType and RenderInfo for options.

func (Instance) GetScreenTransform

func (self Instance) GetScreenTransform() Transform2D.OriginXY

Returns the transform from the Viewport's coordinates to the screen coordinates of the containing window manager window.

func (Instance) GetStretchTransform

func (self Instance) GetStretchTransform() Transform2D.OriginXY

Returns the automatically computed 2D stretch transform, taking the [Viewport]'s stretch settings into account. The final value is multiplied by [member Window.content_scale_factor], but only for the root viewport. If this method is called on a [SubViewport] (e.g., in a scene tree with [SubViewportContainer] and [SubViewport]), the scale factor of the root window will not be applied. Using [Instance.Transform2d.GetScale] on the returned value, this can be used to compensate for scaling when zooming a [Camera2D] node, or to scale down a [TextureRect] to be pixel-perfect regardless of the automatically computed scale factor. Note: Due to how pixel scaling works, the returned transform's X and Y scale may differ slightly, even when [member Window.content_scale_aspect] is set to a mode that preserves the pixels' aspect ratio. If [member Window.content_scale_aspect] is [Window.ContentScaleAspectIgnore], the X and Y scale may differ [i]significantly[/i].

func (Instance) GetTexture

func (self Instance) GetTexture() ViewportTexture.Instance

Returns the viewport's texture. Note: When trying to store the current texture (e.g. in a file), it might be completely black or outdated if used too early, especially when used in e.g. [Instance.Node.Ready]. To make sure the texture you get is correct, you can await [signal RenderingServer.frame_post_draw] signal. [codeblock] func _ready():

await RenderingServer.frame_post_draw
$Viewport.get_texture().get_image().save_png("user://Screenshot.png")

[/codeblock] Note: When [member use_hdr_2d] is true the returned texture will be an HDR image encoded in linear space.

func (Instance) GetViewportRid

func (self Instance) GetViewportRid() RID.Viewport

Returns the viewport's RID from the [RenderingServer].

func (Instance) GetVisibleRect

func (self Instance) GetVisibleRect() Rect2.PositionSize

Returns the visible rectangle in global screen coordinates.

func (Instance) GlobalCanvasTransform

func (self Instance) GlobalCanvasTransform() Transform2D.OriginXY

func (Instance) GuiCancelDrag

func (self Instance) GuiCancelDrag()

Cancels the drag operation that was previously started through [Instance.Control.GetDragData] or forced with [Instance.Control.ForceDrag].

func (Instance) GuiDisableInput

func (self Instance) GuiDisableInput() bool

func (Instance) GuiEmbedSubwindows

func (self Instance) GuiEmbedSubwindows() bool

func (Instance) GuiGetDragData

func (self Instance) GuiGetDragData() any

Returns the drag data from the GUI, that was previously returned by [Instance.Control.GetDragData].

func (Instance) GuiGetFocusOwner

func (self Instance) GuiGetFocusOwner() Control.Instance

Returns the currently focused [Control] within this viewport. If no [Control] is focused, returns null.

func (Instance) GuiGetHoveredControl

func (self Instance) GuiGetHoveredControl() Control.Instance

Returns the [Control] that the mouse is currently hovering over in this viewport. If no [Control] has the cursor, returns null. Typically the leaf [Control] node or deepest level of the subtree which claims hover. This is very useful when used together with [Instance.Node.IsAncestorOf] to find if the mouse is within a control tree.

func (Instance) GuiIsDragSuccessful

func (self Instance) GuiIsDragSuccessful() bool

Returns true if the drag operation is successful.

func (Instance) GuiIsDragging

func (self Instance) GuiIsDragging() bool

Returns true if a drag operation is currently ongoing and where the drop action could happen in this viewport. Alternative to [Node.NotificationDragBegin] and [Node.NotificationDragEnd] when you prefer polling the value.

func (Instance) GuiReleaseFocus

func (self Instance) GuiReleaseFocus()

Removes the focus from the currently focused [Control] within this viewport. If no [Control] has the focus, does nothing.

func (Instance) GuiSnapControlsToPixels

func (self Instance) GuiSnapControlsToPixels() bool

func (Instance) HandleInputLocally

func (self Instance) HandleInputLocally() bool

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsInputHandled

func (self Instance) IsInputHandled() bool

Returns whether the current [InputEvent] has been handled. Input events are not handled until Instance.SetInputAsHandled has been called during the lifetime of an [InputEvent]. This is usually done as part of input handling methods like [Instance.Node.Input], [Instance.Control.GuiInput] or others, as well as in corresponding signal handlers. If [member handle_input_locally] is set to false, this method will try finding the first parent viewport that is set to handle input locally, and return its value for Instance.IsInputHandled instead.

func (Instance) MeshLodThreshold

func (self Instance) MeshLodThreshold() Float.X

func (Instance) Msaa2d

func (self Instance) Msaa2d() MSAA

func (Instance) Msaa3d

func (self Instance) Msaa3d() MSAA

func (Instance) NotifyMouseEntered

func (self Instance) NotifyMouseEntered()

Inform the Viewport that the mouse has entered its area. Use this function before sending an [InputEventMouseButton] or [InputEventMouseMotion] to the [Viewport] with [Instance.Viewport.PushInput]. See also Instance.NotifyMouseExited. Note: In most cases, it is not necessary to call this function because [SubViewport] nodes that are children of [SubViewportContainer] are notified automatically. This is only necessary when interacting with viewports in non-default ways, for example as textures in [TextureRect] or with an [Area3D] that forwards input events.

func (Instance) NotifyMouseExited

func (self Instance) NotifyMouseExited()

Inform the Viewport that the mouse has left its area. Use this function when the node that displays the viewport notices the mouse has left the area of the displayed viewport. See also Instance.NotifyMouseEntered. Note: In most cases, it is not necessary to call this function because [SubViewport] nodes that are children of [SubViewportContainer] are notified automatically. This is only necessary when interacting with viewports in non-default ways, for example as textures in [TextureRect] or with an [Area3D] that forwards input events.

func (Instance) OnGuiFocusChanged

func (self Instance) OnGuiFocusChanged(cb func(node Control.Instance), flags ...Signal.Flags)

func (Instance) OnSizeChanged

func (self Instance) OnSizeChanged(cb func(), flags ...Signal.Flags)

func (Instance) OwnWorld3d

func (self Instance) OwnWorld3d() bool

func (Instance) PhysicsObjectPicking

func (self Instance) PhysicsObjectPicking() bool

func (Instance) PhysicsObjectPickingFirstOnly

func (self Instance) PhysicsObjectPickingFirstOnly() bool

func (Instance) PhysicsObjectPickingSort

func (self Instance) PhysicsObjectPickingSort() bool

func (Instance) PositionalShadowAtlas16Bits

func (self Instance) PositionalShadowAtlas16Bits() bool

func (Instance) PositionalShadowAtlasQuad0

func (self Instance) PositionalShadowAtlasQuad0() PositionalShadowAtlasQuadrantSubdiv

func (Instance) PositionalShadowAtlasQuad1

func (self Instance) PositionalShadowAtlasQuad1() PositionalShadowAtlasQuadrantSubdiv

func (Instance) PositionalShadowAtlasQuad2

func (self Instance) PositionalShadowAtlasQuad2() PositionalShadowAtlasQuadrantSubdiv

func (Instance) PositionalShadowAtlasQuad3

func (self Instance) PositionalShadowAtlasQuad3() PositionalShadowAtlasQuadrantSubdiv

func (Instance) PositionalShadowAtlasSize

func (self Instance) PositionalShadowAtlasSize() int

func (Instance) PushInput

func (self Instance) PushInput(event InputEvent.Instance)

Triggers the given 'event' in this [Viewport]. This can be used to pass an [InputEvent] between viewports, or to locally apply inputs that were sent over the network or saved to a file. If 'in_local_coords' is false, the event's position is in the embedder's coordinates and will be converted to viewport coordinates. If 'in_local_coords' is true, the event's position is in viewport coordinates. While this method serves a similar purpose as [Instance.Input.ParseInputEvent], it does not remap the specified 'event' based on project settings like [member ProjectSettings.input_devices/pointing/emulate_touch_from_mouse]. Calling this method will propagate calls to child nodes for following methods in the given order: - [Instance.Node.Input] - [Instance.Control.GuiInput] for [Control] nodes - [Instance.Node.ShortcutInput] - [Instance.Node.UnhandledKeyInput] - [Instance.Node.UnhandledInput] If an earlier method marks the input as handled via Instance.SetInputAsHandled, any later method in this list will not be called. If none of the methods handle the event and [member physics_object_picking] is true, the event is used for physics object picking.

func (Instance) PushTextInput

func (self Instance) PushTextInput(text string)

Helper method which calls the set_text() method on the currently focused [Control], provided that it is defined (e.g. if the focused Control is [Button] or [LineEdit]).

func (Instance) PushUnhandledInput

func (self Instance) PushUnhandledInput(event InputEvent.Instance)

Triggers the given 'event' in this [Viewport]. This can be used to pass an [InputEvent] between viewports, or to locally apply inputs that were sent over the network or saved to a file. If 'in_local_coords' is false, the event's position is in the embedder's coordinates and will be converted to viewport coordinates. If 'in_local_coords' is true, the event's position is in viewport coordinates. Calling this method will propagate calls to child nodes for following methods in the given order: - [Instance.Node.ShortcutInput] - [Instance.Node.UnhandledKeyInput] - [Instance.Node.UnhandledInput] If an earlier method marks the input as handled via Instance.SetInputAsHandled, any later method in this list will not be called. If none of the methods handle the event and [member physics_object_picking] is true, the event is used for physics object picking. Note: This method doesn't propagate input events to embedded [Window]s or [SubViewport]s.

func (Instance) Scaling3dMode

func (self Instance) Scaling3dMode() Scaling3DMode

func (Instance) Scaling3dScale

func (self Instance) Scaling3dScale() Float.X

func (Instance) ScreenSpaceAa

func (self Instance) ScreenSpaceAa() ScreenSpaceAA

func (Instance) SdfOversize

func (self Instance) SdfOversize() SDFOversize

func (Instance) SdfScale

func (self Instance) SdfScale() SDFScale

func (Instance) SetAnisotropicFilteringLevel

func (self Instance) SetAnisotropicFilteringLevel(value AnisotropicFiltering)

func (Instance) SetAudioListenerEnable2d

func (self Instance) SetAudioListenerEnable2d(value bool)

func (Instance) SetAudioListenerEnable3d

func (self Instance) SetAudioListenerEnable3d(value bool)

func (Instance) SetCanvasCullMask

func (self Instance) SetCanvasCullMask(value int)

func (Instance) SetCanvasCullMaskBit

func (self Instance) SetCanvasCullMaskBit(layer int, enable bool)

Set/clear individual bits on the rendering layer mask. This simplifies editing this [Viewport]'s layers.

func (Instance) SetCanvasItemDefaultTextureFilter

func (self Instance) SetCanvasItemDefaultTextureFilter(value DefaultCanvasItemTextureFilter)

func (Instance) SetCanvasItemDefaultTextureRepeat

func (self Instance) SetCanvasItemDefaultTextureRepeat(value DefaultCanvasItemTextureRepeat)

func (Instance) SetCanvasTransform

func (self Instance) SetCanvasTransform(value Transform2D.OriginXY)

func (Instance) SetDebugDraw

func (self Instance) SetDebugDraw(value DebugDraw)

func (Instance) SetDisable3d

func (self Instance) SetDisable3d(value bool)

func (Instance) SetFsrSharpness

func (self Instance) SetFsrSharpness(value Float.X)

func (Instance) SetGlobalCanvasTransform

func (self Instance) SetGlobalCanvasTransform(value Transform2D.OriginXY)

func (Instance) SetGuiDisableInput

func (self Instance) SetGuiDisableInput(value bool)

func (Instance) SetGuiEmbedSubwindows

func (self Instance) SetGuiEmbedSubwindows(value bool)

func (Instance) SetGuiSnapControlsToPixels

func (self Instance) SetGuiSnapControlsToPixels(value bool)

func (Instance) SetHandleInputLocally

func (self Instance) SetHandleInputLocally(value bool)

func (Instance) SetInputAsHandled

func (self Instance) SetInputAsHandled()

Stops the input from propagating further down the [SceneTree]. Note: This does not affect the methods in [Input], only the way events are propagated.

func (Instance) SetMeshLodThreshold

func (self Instance) SetMeshLodThreshold(value Float.X)

func (Instance) SetMsaa2d

func (self Instance) SetMsaa2d(value MSAA)

func (Instance) SetMsaa3d

func (self Instance) SetMsaa3d(value MSAA)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetOwnWorld3d

func (self Instance) SetOwnWorld3d(value bool)

func (Instance) SetPhysicsObjectPicking

func (self Instance) SetPhysicsObjectPicking(value bool)

func (Instance) SetPhysicsObjectPickingFirstOnly

func (self Instance) SetPhysicsObjectPickingFirstOnly(value bool)

func (Instance) SetPhysicsObjectPickingSort

func (self Instance) SetPhysicsObjectPickingSort(value bool)

func (Instance) SetPositionalShadowAtlas16Bits

func (self Instance) SetPositionalShadowAtlas16Bits(value bool)

func (Instance) SetPositionalShadowAtlasQuad0

func (self Instance) SetPositionalShadowAtlasQuad0(value PositionalShadowAtlasQuadrantSubdiv)

func (Instance) SetPositionalShadowAtlasQuad1

func (self Instance) SetPositionalShadowAtlasQuad1(value PositionalShadowAtlasQuadrantSubdiv)

func (Instance) SetPositionalShadowAtlasQuad2

func (self Instance) SetPositionalShadowAtlasQuad2(value PositionalShadowAtlasQuadrantSubdiv)

func (Instance) SetPositionalShadowAtlasQuad3

func (self Instance) SetPositionalShadowAtlasQuad3(value PositionalShadowAtlasQuadrantSubdiv)

func (Instance) SetPositionalShadowAtlasSize

func (self Instance) SetPositionalShadowAtlasSize(value int)

func (Instance) SetScaling3dMode

func (self Instance) SetScaling3dMode(value Scaling3DMode)

func (Instance) SetScaling3dScale

func (self Instance) SetScaling3dScale(value Float.X)

func (Instance) SetScreenSpaceAa

func (self Instance) SetScreenSpaceAa(value ScreenSpaceAA)

func (Instance) SetSdfOversize

func (self Instance) SetSdfOversize(value SDFOversize)

func (Instance) SetSdfScale

func (self Instance) SetSdfScale(value SDFScale)

func (Instance) SetSnap2dTransformsToPixel

func (self Instance) SetSnap2dTransformsToPixel(value bool)

func (Instance) SetSnap2dVerticesToPixel

func (self Instance) SetSnap2dVerticesToPixel(value bool)

func (Instance) SetTextureMipmapBias

func (self Instance) SetTextureMipmapBias(value Float.X)

func (Instance) SetTransparentBg

func (self Instance) SetTransparentBg(value bool)

func (Instance) SetUseDebanding

func (self Instance) SetUseDebanding(value bool)

func (Instance) SetUseHdr2d

func (self Instance) SetUseHdr2d(value bool)

func (Instance) SetUseOcclusionCulling

func (self Instance) SetUseOcclusionCulling(value bool)

func (Instance) SetUseTaa

func (self Instance) SetUseTaa(value bool)

func (Instance) SetUseXr

func (self Instance) SetUseXr(value bool)

func (Instance) SetVrsMode

func (self Instance) SetVrsMode(value VRSMode)

func (Instance) SetVrsTexture

func (self Instance) SetVrsTexture(value Texture2D.Instance)

func (Instance) SetVrsUpdateMode

func (self Instance) SetVrsUpdateMode(value VRSUpdateMode)

func (Instance) SetWorld2d

func (self Instance) SetWorld2d(value World2D.Instance)

func (Instance) SetWorld3d

func (self Instance) SetWorld3d(value World3D.Instance)

func (Instance) Snap2dTransformsToPixel

func (self Instance) Snap2dTransformsToPixel() bool

func (Instance) Snap2dVerticesToPixel

func (self Instance) Snap2dVerticesToPixel() bool

func (Instance) TextureMipmapBias

func (self Instance) TextureMipmapBias() Float.X

func (Instance) TransparentBg

func (self Instance) TransparentBg() bool

func (Instance) UpdateMouseCursorState

func (self Instance) UpdateMouseCursorState()

Force instantly updating the display based on the current mouse cursor position. This includes updating the mouse cursor shape and sending necessary [signal Control.mouse_entered], [signal CollisionObject2D.mouse_entered], [signal CollisionObject3D.mouse_entered] and [signal Window.mouse_entered] signals and their respective mouse_exited counterparts.

func (Instance) UseDebanding

func (self Instance) UseDebanding() bool

func (Instance) UseHdr2d

func (self Instance) UseHdr2d() bool

func (Instance) UseOcclusionCulling

func (self Instance) UseOcclusionCulling() bool

func (Instance) UseTaa

func (self Instance) UseTaa() bool

func (Instance) UseXr

func (self Instance) UseXr() bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

func (Instance) VrsMode

func (self Instance) VrsMode() VRSMode

func (Instance) VrsTexture

func (self Instance) VrsTexture() Texture2D.Instance

func (Instance) VrsUpdateMode

func (self Instance) VrsUpdateMode() VRSUpdateMode

func (Instance) WarpMouse

func (self Instance) WarpMouse(position Vector2.XY)

Moves the mouse pointer to the specified position in this [Viewport] using the coordinate system of this [Viewport]. Note: Instance.WarpMouse is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web.

func (Instance) World2d

func (self Instance) World2d() World2D.Instance

func (Instance) World3d

func (self Instance) World3d() World3D.Instance

type MSAA

type MSAA int //gd:Viewport.MSAA
const (
	/*Multisample antialiasing mode disabled. This is the default value, and is also the fastest setting.*/
	MsaaDisabled MSAA = 0
	/*Use 2× Multisample Antialiasing. This has a moderate performance cost. It helps reduce aliasing noticeably, but 4× MSAA still looks substantially better.*/
	Msaa2x MSAA = 1
	/*Use 4× Multisample Antialiasing. This has a significant performance cost, and is generally a good compromise between performance and quality.*/
	Msaa4x MSAA = 2
	/*Use 8× Multisample Antialiasing. This has a very high performance cost. The difference between 4× and 8× MSAA may not always be visible in real gameplay conditions. Likely unsupported on low-end and older hardware.*/
	Msaa8x MSAA = 3
	/*Represents the size of the [enum MSAA] enum.*/
	MsaaMax MSAA = 4
)

type PositionalShadowAtlasQuadrantSubdiv

type PositionalShadowAtlasQuadrantSubdiv int //gd:Viewport.PositionalShadowAtlasQuadrantSubdiv
const (
	/*This quadrant will not be used.*/
	ShadowAtlasQuadrantSubdivDisabled PositionalShadowAtlasQuadrantSubdiv = 0
	/*This quadrant will only be used by one shadow map.*/
	ShadowAtlasQuadrantSubdiv1 PositionalShadowAtlasQuadrantSubdiv = 1
	/*This quadrant will be split in 4 and used by up to 4 shadow maps.*/
	ShadowAtlasQuadrantSubdiv4 PositionalShadowAtlasQuadrantSubdiv = 2
	/*This quadrant will be split 16 ways and used by up to 16 shadow maps.*/
	ShadowAtlasQuadrantSubdiv16 PositionalShadowAtlasQuadrantSubdiv = 3
	/*This quadrant will be split 64 ways and used by up to 64 shadow maps.*/
	ShadowAtlasQuadrantSubdiv64 PositionalShadowAtlasQuadrantSubdiv = 4
	/*This quadrant will be split 256 ways and used by up to 256 shadow maps. Unless the [member positional_shadow_atlas_size] is very high, the shadows in this quadrant will be very low resolution.*/
	ShadowAtlasQuadrantSubdiv256 PositionalShadowAtlasQuadrantSubdiv = 5
	/*This quadrant will be split 1024 ways and used by up to 1024 shadow maps. Unless the [member positional_shadow_atlas_size] is very high, the shadows in this quadrant will be very low resolution.*/
	ShadowAtlasQuadrantSubdiv1024 PositionalShadowAtlasQuadrantSubdiv = 6
	/*Represents the size of the [enum PositionalShadowAtlasQuadrantSubdiv] enum.*/
	ShadowAtlasQuadrantSubdivMax PositionalShadowAtlasQuadrantSubdiv = 7
)

type RenderInfo

type RenderInfo int //gd:Viewport.RenderInfo
const (
	/*Amount of objects in frame.*/
	RenderInfoObjectsInFrame RenderInfo = 0
	/*Amount of vertices in frame.*/
	RenderInfoPrimitivesInFrame RenderInfo = 1
	/*Amount of draw calls in frame.*/
	RenderInfoDrawCallsInFrame RenderInfo = 2
	/*Represents the size of the [enum RenderInfo] enum.*/
	RenderInfoMax RenderInfo = 3
)

type RenderInfoType

type RenderInfoType int //gd:Viewport.RenderInfoType
const (
	/*Visible render pass (excluding shadows).*/
	RenderInfoTypeVisible RenderInfoType = 0
	/*Shadow render pass. Objects will be rendered several times depending on the number of amounts of lights with shadows and the number of directional shadow splits.*/
	RenderInfoTypeShadow RenderInfoType = 1
	/*Canvas item rendering. This includes all 2D rendering.*/
	RenderInfoTypeCanvas RenderInfoType = 2
	/*Represents the size of the [enum RenderInfoType] enum.*/
	RenderInfoTypeMax RenderInfoType = 3
)

type SDFOversize

type SDFOversize int //gd:Viewport.SDFOversize
const (
	/*The signed distance field only covers the viewport's own rectangle.*/
	SdfOversize100Percent SDFOversize = 0
	/*The signed distance field is expanded to cover 20% of the viewport's size around the borders.*/
	SdfOversize120Percent SDFOversize = 1
	/*The signed distance field is expanded to cover 50% of the viewport's size around the borders.*/
	SdfOversize150Percent SDFOversize = 2
	/*The signed distance field is expanded to cover 100% (double) of the viewport's size around the borders.*/
	SdfOversize200Percent SDFOversize = 3
	/*Represents the size of the [enum SDFOversize] enum.*/
	SdfOversizeMax SDFOversize = 4
)

type SDFScale

type SDFScale int //gd:Viewport.SDFScale
const (
	/*The signed distance field is rendered at full resolution.*/
	SdfScale100Percent SDFScale = 0
	/*The signed distance field is rendered at half the resolution of this viewport.*/
	SdfScale50Percent SDFScale = 1
	/*The signed distance field is rendered at a quarter the resolution of this viewport.*/
	SdfScale25Percent SDFScale = 2
	/*Represents the size of the [enum SDFScale] enum.*/
	SdfScaleMax SDFScale = 3
)

type Scaling3DMode

type Scaling3DMode int //gd:Viewport.Scaling3DMode
const (
	/*Use bilinear scaling for the viewport's 3D buffer. The amount of scaling can be set using [member scaling_3d_scale]. Values less than [code]1.0[/code] will result in undersampling while values greater than [code]1.0[/code] will result in supersampling. A value of [code]1.0[/code] disables scaling.*/
	Scaling3dModeBilinear Scaling3DMode = 0
	/*Use AMD FidelityFX Super Resolution 1.0 upscaling for the viewport's 3D buffer. The amount of scaling can be set using [member scaling_3d_scale]. Values less than [code]1.0[/code] will be result in the viewport being upscaled using FSR. Values greater than [code]1.0[/code] are not supported and bilinear downsampling will be used instead. A value of [code]1.0[/code] disables scaling.*/
	Scaling3dModeFsr Scaling3DMode = 1
	/*Use AMD FidelityFX Super Resolution 2.2 upscaling for the viewport's 3D buffer. The amount of scaling can be set using [member Viewport.scaling_3d_scale]. Values less than [code]1.0[/code] will be result in the viewport being upscaled using FSR2. Values greater than [code]1.0[/code] are not supported and bilinear downsampling will be used instead. A value of [code]1.0[/code] will use FSR2 at native resolution as a TAA solution.*/
	Scaling3dModeFsr2 Scaling3DMode = 2
	/*Use the [url=https://developer.apple.com/documentation/metalfx/mtlfxspatialscaler#overview]MetalFX spatial upscaler[/url] for the viewport's 3D buffer.
	  The amount of scaling can be set using [member scaling_3d_scale].
	  Values less than [code]1.0[/code] will be result in the viewport being upscaled using MetalFX. Values greater than [code]1.0[/code] are not supported and bilinear downsampling will be used instead. A value of [code]1.0[/code] disables scaling.
	  More information: [url=https://developer.apple.com/documentation/metalfx]MetalFX[/url].
	  [b]Note:[/b] Only supported when the Metal rendering driver is in use, which limits this scaling mode to macOS and iOS.*/
	Scaling3dModeMetalfxSpatial Scaling3DMode = 3
	/*Use the [url=https://developer.apple.com/documentation/metalfx/mtlfxtemporalscaler#overview]MetalFX temporal upscaler[/url] for the viewport's 3D buffer.
	  The amount of scaling can be set using [member scaling_3d_scale]. To determine the minimum input scale, use the [method RenderingDevice.limit_get] method with [constant RenderingDevice.LIMIT_METALFX_TEMPORAL_SCALER_MIN_SCALE].
	  Values less than [code]1.0[/code] will be result in the viewport being upscaled using MetalFX. Values greater than [code]1.0[/code] are not supported and bilinear downsampling will be used instead. A value of [code]1.0[/code] will use MetalFX at native resolution as a TAA solution.
	  More information: [url=https://developer.apple.com/documentation/metalfx]MetalFX[/url].
	  [b]Note:[/b] Only supported when the Metal rendering driver is in use, which limits this scaling mode to macOS and iOS.*/
	Scaling3dModeMetalfxTemporal Scaling3DMode = 4
	/*Represents the size of the [enum Scaling3DMode] enum.*/
	Scaling3dModeMax Scaling3DMode = 5
)

type ScreenSpaceAA

type ScreenSpaceAA int //gd:Viewport.ScreenSpaceAA
const (
	/*Do not perform any antialiasing in the full screen post-process.*/
	ScreenSpaceAaDisabled ScreenSpaceAA = 0
	/*Use fast approximate antialiasing. FXAA is a popular screen-space antialiasing method, which is fast but will make the image look blurry, especially at lower resolutions. It can still work relatively well at large resolutions such as 1440p and 4K.*/
	ScreenSpaceAaFxaa ScreenSpaceAA = 1
	/*Represents the size of the [enum ScreenSpaceAA] enum.*/
	ScreenSpaceAaMax ScreenSpaceAA = 2
)

type VRSMode

type VRSMode int //gd:Viewport.VRSMode
const (
	/*Variable Rate Shading is disabled.*/
	VrsDisabled VRSMode = 0
	/*Variable Rate Shading uses a texture. Note, for stereoscopic use a texture atlas with a texture for each view.*/
	VrsTexture VRSMode = 1
	/*Variable Rate Shading's texture is supplied by the primary [XRInterface].*/
	VrsXr VRSMode = 2
	/*Represents the size of the [enum VRSMode] enum.*/
	VrsMax VRSMode = 3
)

type VRSUpdateMode

type VRSUpdateMode int //gd:Viewport.VRSUpdateMode
const (
	/*The input texture for variable rate shading will not be processed.*/
	VrsUpdateDisabled VRSUpdateMode = 0
	/*The input texture for variable rate shading will be processed once.*/
	VrsUpdateOnce VRSUpdateMode = 1
	/*The input texture for variable rate shading will be processed each frame.*/
	VrsUpdateAlways VRSUpdateMode = 2
	/*Represents the size of the [enum VRSUpdateMode] enum.*/
	VrsUpdateMax VRSUpdateMode = 3
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL