summaryrefslogtreecommitdiff
path: root/doc/classes/Viewport.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Viewport.xml')
-rw-r--r--doc/classes/Viewport.xml200
1 files changed, 88 insertions, 112 deletions
diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml
index 0632be28e1..3b52c80c9a 100644
--- a/doc/classes/Viewport.xml
+++ b/doc/classes/Viewport.xml
@@ -4,9 +4,9 @@
Creates a sub-view into the screen.
</brief_description>
<description>
- A Viewport creates a different view into the screen, or a sub-view inside another viewport. Children 2D Nodes will display on it, and children Camera 3D nodes will render on it too.
+ A Viewport creates a different view into the screen, or a sub-view inside another viewport. Children 2D Nodes will display on it, and children Camera3D 3D nodes will render on it too.
Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports.
- If a viewport is a child of a [ViewportContainer], it will automatically take up its size, otherwise it must be set manually.
+ If a viewport is a child of a [SubViewportContainer], it will automatically take up its size, otherwise it must be set manually.
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.
@@ -16,22 +16,22 @@
<link>https://docs.godotengine.org/en/latest/tutorials/viewports/index.html</link>
</tutorials>
<methods>
- <method name="find_world" qualifiers="const">
- <return type="World">
+ <method name="find_world_2d" qualifiers="const">
+ <return type="World2D">
</return>
<description>
- Returns the 3D world of the viewport, or if none the world of the parent viewport.
+ Returns the 2D world of the viewport.
</description>
</method>
- <method name="find_world_2d" qualifiers="const">
- <return type="World2D">
+ <method name="find_world_3d" qualifiers="const">
+ <return type="World3D">
</return>
<description>
- Returns the 2D world of the viewport.
+ Returns the 3D world of the viewport, or if none the world of the parent viewport.
</description>
</method>
<method name="get_camera" qualifiers="const">
- <return type="Camera">
+ <return type="Camera3D">
</return>
<description>
Returns the active 3D camera.
@@ -44,13 +44,6 @@
Returns the total transform of the viewport.
</description>
</method>
- <method name="get_modal_stack_top" qualifiers="const">
- <return type="Control">
- </return>
- <description>
- Returns the topmost modal in the stack.
- </description>
- </method>
<method name="get_mouse_position" qualifiers="const">
<return type="Vector2">
</return>
@@ -76,13 +69,6 @@
Returns the [enum ShadowAtlasQuadrantSubdiv] of the specified quadrant.
</description>
</method>
- <method name="get_size_override" qualifiers="const">
- <return type="Vector2">
- </return>
- <description>
- Returns the size override set with [method set_size_override].
- </description>
- </method>
<method name="get_texture" qualifiers="const">
<return type="ViewportTexture">
</return>
@@ -99,7 +85,7 @@
<return type="RID">
</return>
<description>
- Returns the viewport's RID from the [VisualServer].
+ Returns the viewport's RID from the [RenderingServer].
</description>
</method>
<method name="get_visible_rect" qualifiers="const">
@@ -116,13 +102,6 @@
Returns the drag data from the GUI, that was previously returned by [method Control.get_drag_data].
</description>
</method>
- <method name="gui_has_modal_stack" qualifiers="const">
- <return type="bool">
- </return>
- <description>
- Returns [code]true[/code] if there are visible modals on-screen.
- </description>
- </method>
<method name="gui_is_dragging" qualifiers="const">
<return type="bool">
</return>
@@ -133,31 +112,31 @@
<method name="input">
<return type="void">
</return>
- <argument index="0" name="local_event" type="InputEvent">
+ <argument index="0" name="event" type="InputEvent">
+ </argument>
+ <argument index="1" name="in_local_coords" type="bool" default="false">
</argument>
<description>
</description>
</method>
- <method name="is_input_handled" qualifiers="const">
- <return type="bool">
+ <method name="input_text">
+ <return type="void">
</return>
+ <argument index="0" name="text" type="String">
+ </argument>
<description>
</description>
</method>
- <method name="is_size_override_enabled" qualifiers="const">
+ <method name="is_embedding_subwindows" qualifiers="const">
<return type="bool">
</return>
<description>
- Returns [code]true[/code] if the size override is enabled. See [method set_size_override].
</description>
</method>
- <method name="set_attach_to_screen_rect">
- <return type="void">
+ <method name="is_input_handled" qualifiers="const">
+ <return type="bool">
</return>
- <argument index="0" name="rect" type="Rect2">
- </argument>
<description>
- Attaches this [Viewport] to the root [Viewport] with the specified rectangle. This bypasses the need for another node to display this [Viewport] but makes you responsible for updating the position of this [Viewport] manually.
</description>
</method>
<method name="set_input_as_handled">
@@ -178,23 +157,12 @@
Sets the number of subdivisions to use in the specified quadrant. A higher number of subdivisions allows you to have more shadows in the scene at once, but reduces the quality of the shadows. A good practice is to have quadrants with a varying number of subdivisions and to have as few subdivisions as possible.
</description>
</method>
- <method name="set_size_override">
- <return type="void">
- </return>
- <argument index="0" name="enable" type="bool">
- </argument>
- <argument index="1" name="size" type="Vector2" default="Vector2( -1, -1 )">
- </argument>
- <argument index="2" name="margin" type="Vector2" default="Vector2( 0, 0 )">
- </argument>
- <description>
- Sets the size override of the viewport. If the [code]enable[/code] parameter is [code]true[/code] the override is used, otherwise it uses the default size. If the size parameter is [code](-1, -1)[/code], it won't update the size.
- </description>
- </method>
<method name="unhandled_input">
<return type="void">
</return>
- <argument index="0" name="local_event" type="InputEvent">
+ <argument index="0" name="event" type="InputEvent">
+ </argument>
+ <argument index="1" name="in_local_coords" type="bool" default="false">
</argument>
<description>
</description>
@@ -217,9 +185,6 @@
</method>
</methods>
<members>
- <member name="arvr" type="bool" setter="set_use_arvr" getter="use_arvr" default="false">
- If [code]true[/code], the viewport will be used in AR/VR process.
- </member>
<member name="audio_listener_enable_2d" type="bool" setter="set_as_audio_listener_2d" getter="is_audio_listener_2d" default="false">
If [code]true[/code], the viewport will process 2D audio streams.
</member>
@@ -227,8 +192,10 @@
If [code]true[/code], the viewport will process 3D audio streams.
</member>
<member name="canvas_item_default_texture_filter" type="int" setter="set_default_canvas_item_texture_filter" getter="get_default_canvas_item_texture_filter" enum="Viewport.DefaultCanvasItemTextureFilter" default="1">
+ Sets the default filter mode used by [CanvasItem]s in this Viewport. See [enum DefaultCanvasItemTextureFilter] for options.
</member>
<member name="canvas_item_default_texture_repeat" type="int" setter="set_default_canvas_item_texture_repeat" getter="get_default_canvas_item_texture_repeat" enum="Viewport.DefaultCanvasItemTextureRepeat" default="0">
+ Sets the default repeat mode used by [CanvasItem]s in this Viewport. See [enum DefaultCanvasItemTextureRepeat] for options.
</member>
<member name="canvas_transform" type="Transform2D" setter="set_canvas_transform" getter="get_canvas_transform">
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.
@@ -242,6 +209,8 @@
<member name="gui_disable_input" type="bool" setter="set_disable_input" getter="is_input_disabled" default="false">
If [code]true[/code], the viewport will not receive input event.
</member>
+ <member name="gui_embed_subwindows" type="bool" setter="set_embed_subwindows_hint" getter="get_embed_subwindows_hint" default="false">
+ </member>
<member name="gui_snap_controls_to_pixels" type="bool" setter="set_snap_controls_to_pixels" getter="is_snap_controls_to_pixels_enabled" default="true">
If [code]true[/code], the GUI controls on the viewport will lay pixel perfectly.
</member>
@@ -250,20 +219,14 @@
<member name="msaa" type="int" setter="set_msaa" getter="get_msaa" enum="Viewport.MSAA" default="0">
The multisample anti-aliasing mode. A higher number results in smoother edges at the cost of significantly worse performance. A value of 4 is best unless targeting very high-end systems.
</member>
- <member name="own_world" type="bool" setter="set_use_own_world" getter="is_using_own_world" default="false">
- If [code]true[/code], the viewport will use [World] defined in [code]world[/code] property.
+ <member name="own_world_3d" type="bool" setter="set_use_own_world_3d" getter="is_using_own_world_3d" default="false">
+ If [code]true[/code], the viewport will use the [World3D] defined in [member world_3d].
</member>
<member name="physics_object_picking" type="bool" setter="set_physics_object_picking" getter="get_physics_object_picking" default="false">
If [code]true[/code], the objects rendered by viewport become subjects of mouse picking process.
</member>
- <member name="render_direct_to_screen" type="bool" setter="set_use_render_direct_to_screen" getter="is_using_render_direct_to_screen" default="false">
- If [code]true[/code], renders the Viewport directly to the screen instead of to the root viewport. Only available in GLES2. This is a low-level optimization and should not be used in most cases. If used, reading from the Viewport or from [code]SCREEN_TEXTURE[/code] becomes unavailable. For more information see [method VisualServer.viewport_set_render_direct_to_screen].
- </member>
- <member name="render_target_clear_mode" type="int" setter="set_clear_mode" getter="get_clear_mode" enum="Viewport.ClearMode" default="0">
- The clear mode when viewport used as a render target.
- </member>
- <member name="render_target_update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="Viewport.UpdateMode" default="2">
- The update mode when viewport used as a render target.
+ <member name="screen_space_aa" type="int" setter="set_screen_space_aa" getter="get_screen_space_aa" enum="Viewport.ScreenSpaceAA" default="0">
+ 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.
</member>
<member name="shadow_atlas_quad_0" type="int" setter="set_shadow_atlas_quadrant_subdiv" getter="get_shadow_atlas_quadrant_subdiv" enum="Viewport.ShadowAtlasQuadrantSubdiv" default="2">
The subdivision amount of the first quadrant on the shadow atlas.
@@ -281,21 +244,15 @@
The shadow atlas' resolution (used for omni and spot lights). The value will be rounded up to the nearest power of 2.
[b]Note:[/b] If this is set to 0, shadows won't be visible. Since user-created viewports default to a value of 0, this value must be set above 0 manually.
</member>
- <member name="size" type="Vector2" setter="set_size" getter="get_size" default="Vector2( 0, 0 )">
- The width and height of viewport.
- </member>
- <member name="size_override_stretch" type="bool" setter="set_size_override_stretch" getter="is_size_override_stretch_enabled" default="false">
- If [code]true[/code], the size override affects stretch as well.
- </member>
<member name="transparent_bg" type="bool" setter="set_transparent_background" getter="has_transparent_background" default="false">
If [code]true[/code], the viewport should render its background as transparent.
</member>
- <member name="world" type="World" setter="set_world" getter="get_world">
- The custom [World] which can be used as 3D environment source.
- </member>
<member name="world_2d" type="World2D" setter="set_world_2d" getter="get_world_2d">
The custom [World2D] which can be used as 2D environment source.
</member>
+ <member name="world_3d" type="World3D" setter="set_world_3d" getter="get_world_3d">
+ The custom [World3D] which can be used as 3D environment source.
+ </member>
</members>
<signals>
<signal name="gui_focus_changed">
@@ -307,23 +264,11 @@
</signal>
<signal name="size_changed">
<description>
- Emitted when the size of the viewport is changed, whether by [method set_size_override], resize of window, or some other means.
+ Emitted when the size of the viewport is changed, whether by resizing of window, or some other means.
</description>
</signal>
</signals>
<constants>
- <constant name="UPDATE_DISABLED" value="0" enum="UpdateMode">
- Do not update the render target.
- </constant>
- <constant name="UPDATE_ONCE" value="1" enum="UpdateMode">
- Update the render target once, then switch to [constant UPDATE_DISABLED].
- </constant>
- <constant name="UPDATE_WHEN_VISIBLE" value="2" enum="UpdateMode">
- Update the render target only when it is visible. This is the default value.
- </constant>
- <constant name="UPDATE_ALWAYS" value="3" enum="UpdateMode">
- Always update the render target.
- </constant>
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED" value="0" enum="ShadowAtlasQuadrantSubdiv">
This quadrant will not be used.
</constant>
@@ -348,6 +293,33 @@
<constant name="SHADOW_ATLAS_QUADRANT_SUBDIV_MAX" value="7" enum="ShadowAtlasQuadrantSubdiv">
Represents the size of the [enum ShadowAtlasQuadrantSubdiv] enum.
</constant>
+ <constant name="MSAA_DISABLED" value="0" enum="MSAA">
+ Multisample antialiasing mode disabled. This is the default value, and also the fastest setting.
+ </constant>
+ <constant name="MSAA_2X" value="1" enum="MSAA">
+ Use 2x Multisample Antialiasing.
+ </constant>
+ <constant name="MSAA_4X" value="2" enum="MSAA">
+ Use 4x Multisample Antialiasing.
+ </constant>
+ <constant name="MSAA_8X" value="3" enum="MSAA">
+ Use 8x Multisample Antialiasing. Likely unsupported on low-end and older hardware.
+ </constant>
+ <constant name="MSAA_16X" value="4" enum="MSAA">
+ Use 16x Multisample Antialiasing. Likely unsupported on medium and low-end hardware.
+ </constant>
+ <constant name="MSAA_MAX" value="5" enum="MSAA">
+ Represents the size of the [enum MSAA] enum.
+ </constant>
+ <constant name="SCREEN_SPACE_AA_DISABLED" value="0" enum="ScreenSpaceAA">
+ Do not perform any antialiasing in the full screen post-process.
+ </constant>
+ <constant name="SCREEN_SPACE_AA_FXAA" value="1" enum="ScreenSpaceAA">
+ Use fast approximate antialiasing. FXAA is a popular screen-space antialising 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.
+ </constant>
+ <constant name="SCREEN_SPACE_AA_MAX" value="2" enum="ScreenSpaceAA">
+ Represents the size of the [enum ScreenSpaceAA] enum.
+ </constant>
<constant name="RENDER_INFO_OBJECTS_IN_FRAME" value="0" enum="RenderInfo">
Amount of objects in frame.
</constant>
@@ -375,67 +347,71 @@
<constant name="DEBUG_DRAW_UNSHADED" value="1" enum="DebugDraw">
Objects are displayed without light information.
</constant>
+ <constant name="DEBUG_DRAW_LIGHTING" value="2" enum="DebugDraw">
+ </constant>
<constant name="DEBUG_DRAW_OVERDRAW" value="3" enum="DebugDraw">
- Objected are displayed semi-transparent with additive blending so you can see where they intersect.
+ 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.
</constant>
<constant name="DEBUG_DRAW_WIREFRAME" value="4" enum="DebugDraw">
Objects are displayed in wireframe style.
</constant>
+ <constant name="DEBUG_DRAW_NORMAL_BUFFER" value="5" enum="DebugDraw">
+ </constant>
<constant name="DEBUG_DRAW_GI_PROBE_ALBEDO" value="6" enum="DebugDraw">
+ Objects are displayed with only the albedo value from [GIProbe]s.
</constant>
<constant name="DEBUG_DRAW_GI_PROBE_LIGHTING" value="7" enum="DebugDraw">
+ Objects are displayed with only the lighting value from [GIProbe]s.
</constant>
<constant name="DEBUG_DRAW_GI_PROBE_EMISSION" value="8" enum="DebugDraw">
+ Objects are displayed with only the emission color from [GIProbe]s.
</constant>
<constant name="DEBUG_DRAW_SHADOW_ATLAS" value="9" enum="DebugDraw">
+ Draws the shadow atlas that stores shadows from [OmniLight3D]s and [SpotLight3D]s in the upper left quadrant of the [Viewport].
</constant>
<constant name="DEBUG_DRAW_DIRECTIONAL_SHADOW_ATLAS" value="10" enum="DebugDraw">
+ Draws the shadow atlas that stores shadows from [DirectionalLight3D]s in the upper left quadrant of the [Viewport].
</constant>
<constant name="DEBUG_DRAW_SCENE_LUMINANCE" value="11" enum="DebugDraw">
</constant>
<constant name="DEBUG_DRAW_SSAO" value="12" enum="DebugDraw">
+ 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].
</constant>
- <constant name="MSAA_DISABLED" value="0" enum="MSAA">
- Multisample anti-aliasing mode disabled. This is the default value.
- </constant>
- <constant name="MSAA_2X" value="1" enum="MSAA">
- Use 2x Multisample Antialiasing.
- </constant>
- <constant name="MSAA_4X" value="2" enum="MSAA">
- Use 4x Multisample Antialiasing.
- </constant>
- <constant name="MSAA_8X" value="3" enum="MSAA">
- Use 8x Multisample Antialiasing. Likely unsupported on low-end and older hardware.
- </constant>
- <constant name="MSAA_16X" value="4" enum="MSAA">
- Use 16x Multisample Antialiasing. Likely unsupported on medium and low-end hardware.
- </constant>
- <constant name="CLEAR_MODE_ALWAYS" value="0" enum="ClearMode">
- Always clear the render target before drawing.
+ <constant name="DEBUG_DRAW_ROUGHNESS_LIMITER" value="13" enum="DebugDraw">
+ Draws the roughness limiter post process over the Viewport so you can see where it has an effect. It must be enabled in [member ProjectSettings.rendering/quality/screen_filters/screen_space_roughness_limiter] to work.
</constant>
- <constant name="CLEAR_MODE_NEVER" value="1" enum="ClearMode">
- Never clear the render target.
+ <constant name="DEBUG_DRAW_PSSM_SPLITS" value="14" enum="DebugDraw">
+ 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.
</constant>
- <constant name="CLEAR_MODE_ONLY_NEXT_FRAME" value="2" enum="ClearMode">
- Clear the render target next frame, then switch to [constant CLEAR_MODE_NEVER].
+ <constant name="DEBUG_DRAW_DECAL_ATLAS" value="15" enum="DebugDraw">
+ Draws the decal atlas used by [Decal]s and light projector textures in the upper left quadrant of the [Viewport].
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST" value="0" enum="DefaultCanvasItemTextureFilter">
+ The texture filter reads from the nearest pixel only. The simplest and fastest method of filtering, but the texture will look pixelized.
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR" value="1" enum="DefaultCanvasItemTextureFilter">
+ The texture filter blends between the nearest 4 pixels. Use this when you want to avoid a pixelated style, but do not want mipmaps.
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS" value="2" enum="DefaultCanvasItemTextureFilter">
+ The texture filter reads from the nearest pixel in the nearest mipmap. The fastest way to read from textures with mipmaps.
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS" value="3" enum="DefaultCanvasItemTextureFilter">
+ The texture filter blends between the nearest 4 pixels and between the nearest 2 mipmaps.
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_MAX" value="4" enum="DefaultCanvasItemTextureFilter">
+ Max value for [enum DefaultCanvasItemTextureFilter] enum.
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED" value="0" enum="DefaultCanvasItemTextureRepeat">
+ 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.
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED" value="1" enum="DefaultCanvasItemTextureRepeat">
+ 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.
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR" value="2" enum="DefaultCanvasItemTextureRepeat">
+ Flip the texture when repeating so that the edge lines up instead of abruptly changing.
</constant>
<constant name="DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MAX" value="3" enum="DefaultCanvasItemTextureRepeat">
+ Max value for [enum DefaultCanvasItemTextureRepeat] enum.
</constant>
</constants>
</class>