Enumerationmigueldeicaza.swiftgodot 0.46.0SwiftGodot
DefaultCanvasItemTextureFilter
Viewport.swift:275enum DefaultCanvasItemTextureFilter
Cases
case nearest
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).
case linear
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).
case linearWithMipmaps
The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps (or uses the nearest mipmap if
ProjectSettings/rendering/textures/defaultFilters/useNearestMipmapFilter
istrue
). This makes the texture look smooth from up close, and smooth from a distance.case nearestWithMipmaps
The texture filter reads from the nearest pixel and blends between the nearest 2 mipmaps (or uses the nearest mipmap if
ProjectSettings/rendering/textures/defaultFilters/useNearestMipmapFilter
istrue
). This makes the texture look pixelated from up close, and smooth from a distance.case max
Represents the size of the
DefaultCanvasItemTextureFilter
enum.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (89) members.
Types
enum DebugDraw
enum DefaultCanvasItemTextureRepeat
enum MSAA
enum PositionalShadowAtlasQuadrantSubdiv
enum RenderInfo
enum RenderInfoType
enum SDFOversize
enum SDFScale
enum Scaling3DMode
enum ScreenSpaceAA
class Signal1
Signal support.
enum VRSMode
enum VRSUpdateMode
Type members
Instance members
var audioListenerEnable2d: Bool
If
true
, the viewport will process 2D audio streams.var audioListenerEnable3d: Bool
If
true
, the viewport will process 3D audio streams.var canvasCullMask: UInt32
The rendering layers in which this
Viewport
rendersCanvasItem
nodes.var canvasItemDefaultTextureFilter: Viewport.DefaultCanvasItemTextureFilter
Sets the default filter mode used by
CanvasItem
s in this Viewport. SeeDefaultCanvasItemTextureFilter
for options.var canvasItemDefaultTextureRepeat: Viewport.DefaultCanvasItemTextureRepeat
Sets the default repeat mode used by
CanvasItem
s in this Viewport. SeeDefaultCanvasItemTextureRepeat
for options.var canvasTransform: Transform2D
The canvas transform of the viewport, useful for changing the on-screen positions of all child
CanvasItem
s. This is relative to the global canvas transform of the viewport.var debugDraw: Viewport.DebugDraw
The overlay mode for test rendered geometry in debug purposes.
var disable3d: Bool
Disable 3D rendering (but keep 2D rendering).
var fsrSharpness: Double
Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won’t make a visible difference.
var globalCanvasTransform: Transform2D
The global canvas transform of the viewport. The canvas transform is relative to this.
var guiDisableInput: Bool
If
true
, the viewport will not receive input events.var guiEmbedSubwindows: Bool
If
true
, sub-windows (popups and dialogs) will be embedded inside application window as control-like nodes. Iffalse
, they will appear as separate windows handled by the operating system.var guiFocusChanged: Signal1
Emitted when a Control node grabs keyboard focus.
var guiSnapControlsToPixels: Bool
If
true
, the GUI controls on the viewport will lay pixel perfectly.var handleInputLocally: Bool
If
true
, this viewport will mark incoming input events as handled by itself. Iffalse
, this is instead done by the first parent viewport that is set to handle input locally.var meshLodThreshold: Double
The automatic LOD bias to use for meshes rendered within the
Viewport
(this is analogous tomeshLodThreshold
). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to0.0
, automatic LOD is disabled. IncreasemeshLodThreshold
to improve performance at the cost of geometry detail.var msaa2d: Viewport.MSAA
The multisample anti-aliasing mode for 2D/Canvas rendering. A higher number results in smoother edges at the cost of significantly worse performance. A value of 2 or 4 is best unless targeting very high-end systems. This has no effect on shader-induced aliasing or texture aliasing.
var msaa3d: Viewport.MSAA
The multisample anti-aliasing mode for 3D rendering. A higher number results in smoother edges at the cost of significantly worse performance. A value of 2 or 4 is best unless targeting very high-end systems. See also bilinear scaling 3d
scaling3dMode
for supersampling, which provides higher quality but is much more expensive. This has no effect on shader-induced aliasing or texture aliasing.var ownWorld3d: Bool
If
true
, the viewport will use a unique copy of theWorld3D
defined inworld3d
.var physicsObjectPicking: Bool
If
true
, the objects rendered by viewport become subjects of mouse picking process.var physicsObjectPickingFirstOnly: Bool
If
true
, the input_event signal will only be sent to one physics object in the mouse picking process. If you want to get the top object only, you must also enablephysicsObjectPickingSort
.var physicsObjectPickingSort: Bool
If
true
, objects receive mouse picking events sorted primarily by theirzIndex
and secondarily by their position in the scene tree. Iffalse
, the order is undetermined.var positionalShadowAtlas16Bits: Bool
Use 16 bits for the omni/spot shadow depth map. Enabling this results in shadows having less precision and may result in shadow acne, but can lead to performance improvements on some devices.
var positionalShadowAtlasQuad0: Viewport.PositionalShadowAtlasQuadrantSubdiv
The subdivision amount of the first quadrant on the shadow atlas.
var positionalShadowAtlasQuad1: Viewport.PositionalShadowAtlasQuadrantSubdiv
The subdivision amount of the second quadrant on the shadow atlas.
var positionalShadowAtlasQuad2: Viewport.PositionalShadowAtlasQuadrantSubdiv
The subdivision amount of the third quadrant on the shadow atlas.
var positionalShadowAtlasQuad3: Viewport.PositionalShadowAtlasQuadrantSubdiv
The subdivision amount of the fourth quadrant on the shadow atlas.
var positionalShadowAtlasSize: Int32
The shadow atlas’ resolution (used for omni and spot lights). The value is rounded up to the nearest power of 2.
var scaling3dMode: Viewport.Scaling3DMode
Sets scaling 3d mode. Bilinear scaling renders at different resolution to either undersample or supersample the viewport. FidelityFX Super Resolution 1.0, abbreviated to FSR, is an upscaling technology that produces high quality images at fast framerates by using a spatially aware upscaling algorithm. FSR is slightly more expensive than bilinear, but it produces significantly higher image quality. FSR should be used where possible.
var scaling3dScale: Double
Scales the 3D render buffer based on the viewport size uses an image filter specified in
ProjectSettings/rendering/scaling3d/mode
to scale the output image to the full viewport size. Values lower than1.0
can be used to speed up 3D rendering at the cost of quality (undersampling). Values greater than1.0
are only valid for bilinear mode and can be used to improve 3D rendering quality at a high performance cost (supersampling). See alsoProjectSettings/rendering/antiAliasing/quality/msaa3d
for multi-sample antialiasing, which is significantly cheaper but only smooths the edges of polygons.var screenSpaceAa: Viewport.ScreenSpaceAA
Sets the screen-space antialiasing method used. Screen-space antialiasing works by selectively blurring edges in a post-process shader. It differs from MSAA which takes multiple coverage samples while rendering objects. Screen-space AA methods are typically faster than MSAA and will smooth out specular aliasing, but tend to make scenes appear blurry.
var sdfOversize: Viewport.SDFOversize
Controls how much of the original viewport’s size should be covered by the 2D signed distance field. This SDF can be sampled in
CanvasItem
shaders and is also used forGPUParticles2D
collision. Higher values allow portions of occluders located outside the viewport to still be taken into account in the generated signed distance field, at the cost of performance. If you notice particles falling throughLightOccluder2D
s as the occluders leave the viewport, increase this setting.var sdfScale: Viewport.SDFScale
The resolution scale to use for the 2D signed distance field. Higher values lead to a more precise and more stable signed distance field as the camera moves, at the cost of performance.
var sizeChanged: SimpleSignal
Emitted when the size of the viewport is changed, whether by resizing of window, or some other means.
var snap2dTransformsToPixel: Bool
If
true
,CanvasItem
nodes will internally snap to full pixels. Their position can still be sub-pixel, but the decimals will not have effect. This can lead to a crisper appearance at the cost of less smooth movement, especially whenCamera2D
smoothing is enabled.var snap2dVerticesToPixel: Bool
If
true
, vertices ofCanvasItem
nodes will snap to full pixels. Only affects the final vertex positions, not the transforms. This can lead to a crisper appearance at the cost of less smooth movement, especially whenCamera2D
smoothing is enabled.var textureMipmapBias: Double
Affects the final texture sharpness by reading from a lower or higher mipmap (also called “texture LOD bias”). Negative values make mipmapped textures sharper but grainier when viewed at a distance, while positive values make mipmapped textures blurrier (even when up close).
var transparentBg: Bool
If
true
, the viewport should render its background as transparent.var useDebanding: Bool
If
true
, uses a fast post-processing filter to make banding significantly less visible in 3D. 2D rendering is not affected by debanding unless thebackgroundMode
isEnvironment/BGMode/bgCanvas
. See alsoProjectSettings/rendering/antiAliasing/quality/useDebanding
.var useHdr2d: Bool
If
true
, 2D rendering will use an high dynamic range (HDR) format framebuffer matching the bit depth of the 3D framebuffer. When using the Forward+ renderer this will be anRGBA16
framebuffer, while when using the Mobile renderer it will be anRGB10_A2
framebuffer. Additionally, 2D rendering will take place in linear color space and will be converted to sRGB space immediately before blitting to the screen (if the Viewport is attached to the screen). Practically speaking, this means that the end result of the Viewport will not be clamped into the0-1
range and can be used in 3D rendering without color space adjustments. This allows 2D rendering to take advantage of effects requiring high dynamic range (e.g. 2D glow) as well as substantially improves the appearance of effects requiring highly detailed gradients.var useOcclusionCulling: Bool
If
true
,OccluderInstance3D
nodes will be usable for occlusion culling in 3D for this viewport. For the root viewport,ProjectSettings/rendering/occlusionCulling/useOcclusionCulling
must be set totrue
instead.var useTaa: Bool
Enables Temporal Anti-Aliasing for this viewport. TAA works by jittering the camera and accumulating the images of the last rendered frames, motion vector rendering is used to account for camera and object motion.
var useXr: Bool
If
true
, the viewport will use the primary XR interface to render XR output. When applicable this can result in a stereoscopic image and the resulting render being output to a headset.var vrsMode: Viewport.VRSMode
The Variable Rate Shading (VRS) mode that is used for this viewport. Note, if hardware does not support VRS this property is ignored.
var vrsTexture: Texture2D?
Texture to use when
vrsMode
is set toViewport/VRSMode/vrsTexture
.var vrsUpdateMode: Viewport.VRSUpdateMode
Sets the update mode for Variable Rate Shading (VRS) for the viewport. VRS requires the input texture to be converted to the format usable by the VRS method supported by the hardware. The update mode defines how often this happens. If the GPU does not support VRS, or VRS is not enabled, this property is ignored.
var world2d: World2D?
The custom
World2D
which can be used as 2D environment source.var world3d: World3D?
The custom
World3D
which can be used as 3D environment source.func findWorld2d(
) -> World2D? Returns the first valid
World2D
for this viewport, searching theworld2d
property of itself and any Viewport ancestor.func findWorld3d(
) -> World3D? Returns the first valid
World3D
for this viewport, searching theworld3d
property of itself and any Viewport ancestor.func getCamera2d(
) -> Camera2D? Returns the currently active 2D camera. Returns null if there are no active cameras.
func getCamera3d(
) -> Camera3D? Returns the currently active 3D camera.
func getCanvasCullMaskBit(layer: UInt32
) -> Bool Returns an individual bit on the rendering layer mask.
func getEmbeddedSubwindows(
) -> ObjectCollection<Window> Returns a list of the visible embedded
Window
s inside the viewport.func getFinalTransform(
) -> Transform2D Returns the transform from the viewport’s coordinate system to the embedder’s coordinate system.
func getMousePosition(
) -> Vector2 Returns the mouse’s position in this
Viewport
using the coordinate system of thisViewport
.func getRenderInfo(type: Viewport.RenderInfoType, info: Viewport.RenderInfo
) -> Int32 Returns rendering statistics of the given type. See
RenderInfoType
andRenderInfo
for options.func getScreenTransform(
) -> Transform2D Returns the transform from the Viewport’s coordinates to the screen coordinates of the containing window manager window.
func getTexture(
) -> ViewportTexture? Returns the viewport’s texture.
func getViewportRid(
) -> RID Returns the viewport’s RID from the
RenderingServer
.func getVisibleRect(
) -> Rect2 Returns the visible rectangle in global screen coordinates.
func guiGetDragData(
) -> Variant Returns the drag data from the GUI, that was previously returned by
_getDragData(atPosition:)
.func guiGetFocusOwner(
) -> Control? Returns the
Control
having the focus within this viewport. If noControl
has the focus, returns null.func guiGetHoveredControl(
) -> Control? Returns the
Control
that the mouse is currently hovering over in this viewport. If noControl
has the cursor, returns null.func guiIsDragSuccessful(
) -> Bool Returns
true
if the drag operation is successful.func guiIsDragging(
) -> Bool Returns
true
if the viewport is currently performing a drag operation.func guiReleaseFocus(
) Removes the focus from the currently focused
Control
within this viewport. If noControl
has the focus, does nothing.func isInputHandled(
) -> Bool Returns whether the current
InputEvent
has been handled. Input events are not handled untilsetInputAsHandled
has been called during the lifetime of anInputEvent
.func pushInput(event: InputEvent?, inLocalCoords: Bool
) Triggers the given
event
in thisViewport
. This can be used to pass anInputEvent
between viewports, or to locally apply inputs that were sent over the network or saved to a file.func pushTextInput(text: String
) Helper method which calls the
set_text()
method on the currently focusedControl
, provided that it is defined (e.g. if the focused Control isButton
orLineEdit
).func pushUnhandledInput(event: InputEvent?, inLocalCoords: Bool
) Triggers the given
event
in thisViewport
. This can be used to pass anInputEvent
between viewports, or to locally apply inputs that were sent over the network or saved to a file.func setCanvasCullMaskBit(layer: UInt32, enable: Bool
) Set/clear individual bits on the rendering layer mask. This simplifies editing this
Viewport
’s layers.func setInputAsHandled(
) Stops the input from propagating further down the
SceneTree
.func 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 warpMouse(position: Vector2
) Moves the mouse pointer to the specified position in this
Viewport
using the coordinate system of thisViewport
.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.