class_viewport.rst 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/Viewport.xml.
  6. .. _class_Viewport:
  7. Viewport
  8. ========
  9. **Inherits:** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Creates a sub-view into the screen.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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.
  15. Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports.
  16. If a viewport is a child of a :ref:`ViewportContainer<class_ViewportContainer>`, the viewport will automatically take up the container's size, otherwise it must be set manually.
  17. Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it.
  18. Also, viewports can be assigned to different screens in case the devices have multiple screens.
  19. Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw.
  20. \ **Note:** By default, a newly created Viewport in Godot 3.x will appear to be upside down. Enabling :ref:`render_target_v_flip<class_Viewport_property_render_target_v_flip>` will display the Viewport with the correct orientation.
  21. .. rst-class:: classref-introduction-group
  22. Tutorials
  23. ---------
  24. - :doc:`Viewport and canvas transforms <../tutorials/2d/2d_transforms>`
  25. - :doc:`Viewports tutorial index <../tutorials/rendering/index>`
  26. - `GUI in 3D Demo <https://godotengine.org/asset-library/asset/127>`__
  27. - `3D in 2D Demo <https://godotengine.org/asset-library/asset/128>`__
  28. - `2D in 3D Demo <https://godotengine.org/asset-library/asset/129>`__
  29. - `Screen Capture Demo <https://godotengine.org/asset-library/asset/130>`__
  30. - `Dynamic Split Screen Demo <https://godotengine.org/asset-library/asset/541>`__
  31. - `3D Viewport Scaling Demo <https://godotengine.org/asset-library/asset/586>`__
  32. .. rst-class:: classref-reftable-group
  33. Properties
  34. ----------
  35. .. table::
  36. :widths: auto
  37. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  38. | :ref:`bool<class_bool>` | :ref:`arvr<class_Viewport_property_arvr>` | ``false`` |
  39. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  40. | :ref:`bool<class_bool>` | :ref:`audio_listener_enable_2d<class_Viewport_property_audio_listener_enable_2d>` | ``false`` |
  41. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  42. | :ref:`bool<class_bool>` | :ref:`audio_listener_enable_3d<class_Viewport_property_audio_listener_enable_3d>` | ``false`` |
  43. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  44. | :ref:`Transform2D<class_Transform2D>` | :ref:`canvas_transform<class_Viewport_property_canvas_transform>` | |
  45. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  46. | :ref:`bool<class_bool>` | :ref:`debanding<class_Viewport_property_debanding>` | ``false`` |
  47. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  48. | :ref:`DebugDraw<enum_Viewport_DebugDraw>` | :ref:`debug_draw<class_Viewport_property_debug_draw>` | ``0`` |
  49. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  50. | :ref:`bool<class_bool>` | :ref:`disable_3d<class_Viewport_property_disable_3d>` | ``false`` |
  51. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  52. | :ref:`bool<class_bool>` | :ref:`fxaa<class_Viewport_property_fxaa>` | ``false`` |
  53. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  54. | :ref:`Transform2D<class_Transform2D>` | :ref:`global_canvas_transform<class_Viewport_property_global_canvas_transform>` | |
  55. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  56. | :ref:`bool<class_bool>` | :ref:`gui_disable_input<class_Viewport_property_gui_disable_input>` | ``false`` |
  57. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  58. | :ref:`bool<class_bool>` | :ref:`gui_snap_controls_to_pixels<class_Viewport_property_gui_snap_controls_to_pixels>` | ``true`` |
  59. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  60. | :ref:`bool<class_bool>` | :ref:`handle_input_locally<class_Viewport_property_handle_input_locally>` | ``true`` |
  61. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  62. | :ref:`bool<class_bool>` | :ref:`hdr<class_Viewport_property_hdr>` | ``true`` |
  63. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  64. | :ref:`bool<class_bool>` | :ref:`keep_3d_linear<class_Viewport_property_keep_3d_linear>` | ``false`` |
  65. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  66. | :ref:`MSAA<enum_Viewport_MSAA>` | :ref:`msaa<class_Viewport_property_msaa>` | ``0`` |
  67. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  68. | :ref:`bool<class_bool>` | :ref:`own_world<class_Viewport_property_own_world>` | ``false`` |
  69. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  70. | :ref:`bool<class_bool>` | :ref:`physics_object_picking<class_Viewport_property_physics_object_picking>` | ``false`` |
  71. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  72. | :ref:`bool<class_bool>` | :ref:`render_direct_to_screen<class_Viewport_property_render_direct_to_screen>` | ``false`` |
  73. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  74. | :ref:`ClearMode<enum_Viewport_ClearMode>` | :ref:`render_target_clear_mode<class_Viewport_property_render_target_clear_mode>` | ``0`` |
  75. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  76. | :ref:`UpdateMode<enum_Viewport_UpdateMode>` | :ref:`render_target_update_mode<class_Viewport_property_render_target_update_mode>` | ``2`` |
  77. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  78. | :ref:`bool<class_bool>` | :ref:`render_target_v_flip<class_Viewport_property_render_target_v_flip>` | ``false`` |
  79. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  80. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_0<class_Viewport_property_shadow_atlas_quad_0>` | ``2`` |
  81. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  82. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_1<class_Viewport_property_shadow_atlas_quad_1>` | ``2`` |
  83. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  84. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_2<class_Viewport_property_shadow_atlas_quad_2>` | ``3`` |
  85. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  86. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`shadow_atlas_quad_3<class_Viewport_property_shadow_atlas_quad_3>` | ``4`` |
  87. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  88. | :ref:`int<class_int>` | :ref:`shadow_atlas_size<class_Viewport_property_shadow_atlas_size>` | ``0`` |
  89. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  90. | :ref:`float<class_float>` | :ref:`sharpen_intensity<class_Viewport_property_sharpen_intensity>` | ``0.0`` |
  91. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  92. | :ref:`Vector2<class_Vector2>` | :ref:`size<class_Viewport_property_size>` | ``Vector2( 0, 0 )`` |
  93. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  94. | :ref:`bool<class_bool>` | :ref:`size_override_stretch<class_Viewport_property_size_override_stretch>` | ``false`` |
  95. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  96. | :ref:`bool<class_bool>` | :ref:`transparent_bg<class_Viewport_property_transparent_bg>` | ``false`` |
  97. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  98. | :ref:`Usage<enum_Viewport_Usage>` | :ref:`usage<class_Viewport_property_usage>` | ``2`` |
  99. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  100. | :ref:`bool<class_bool>` | :ref:`use_32_bpc_depth<class_Viewport_property_use_32_bpc_depth>` | ``false`` |
  101. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  102. | :ref:`World<class_World>` | :ref:`world<class_Viewport_property_world>` | |
  103. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  104. | :ref:`World2D<class_World2D>` | :ref:`world_2d<class_Viewport_property_world_2d>` | |
  105. +---------------------------------------------------------------------------+-----------------------------------------------------------------------------------------+---------------------+
  106. .. rst-class:: classref-reftable-group
  107. Methods
  108. -------
  109. .. table::
  110. :widths: auto
  111. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`World<class_World>` | :ref:`find_world<class_Viewport_method_find_world>` **(** **)** |const| |
  113. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`World2D<class_World2D>` | :ref:`find_world_2d<class_Viewport_method_find_world_2d>` **(** **)** |const| |
  115. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`Camera<class_Camera>` | :ref:`get_camera<class_Viewport_method_get_camera>` **(** **)** |const| |
  117. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_final_transform<class_Viewport_method_get_final_transform>` **(** **)** |const| |
  119. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | :ref:`Control<class_Control>` | :ref:`get_modal_stack_top<class_Viewport_method_get_modal_stack_top>` **(** **)** |const| |
  121. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | :ref:`Vector2<class_Vector2>` | :ref:`get_mouse_position<class_Viewport_method_get_mouse_position>` **(** **)** |const| |
  123. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | :ref:`int<class_int>` | :ref:`get_render_info<class_Viewport_method_get_render_info>` **(** :ref:`RenderInfo<enum_Viewport_RenderInfo>` info **)** |
  125. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` | :ref:`get_shadow_atlas_quadrant_subdiv<class_Viewport_method_get_shadow_atlas_quadrant_subdiv>` **(** :ref:`int<class_int>` quadrant **)** |const| |
  127. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | :ref:`Vector2<class_Vector2>` | :ref:`get_size_override<class_Viewport_method_get_size_override>` **(** **)** |const| |
  129. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | :ref:`ViewportTexture<class_ViewportTexture>` | :ref:`get_texture<class_Viewport_method_get_texture>` **(** **)** |const| |
  131. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | :ref:`RID<class_RID>` | :ref:`get_viewport_rid<class_Viewport_method_get_viewport_rid>` **(** **)** |const| |
  133. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | :ref:`Rect2<class_Rect2>` | :ref:`get_visible_rect<class_Viewport_method_get_visible_rect>` **(** **)** |const| |
  135. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | :ref:`Variant<class_Variant>` | :ref:`gui_get_drag_data<class_Viewport_method_gui_get_drag_data>` **(** **)** |const| |
  137. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | :ref:`bool<class_bool>` | :ref:`gui_has_modal_stack<class_Viewport_method_gui_has_modal_stack>` **(** **)** |const| |
  139. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | :ref:`bool<class_bool>` | :ref:`gui_is_drag_successful<class_Viewport_method_gui_is_drag_successful>` **(** **)** |const| |
  141. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | :ref:`bool<class_bool>` | :ref:`gui_is_dragging<class_Viewport_method_gui_is_dragging>` **(** **)** |const| |
  143. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | void | :ref:`input<class_Viewport_method_input>` **(** :ref:`InputEvent<class_InputEvent>` local_event **)** |
  145. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | :ref:`bool<class_bool>` | :ref:`is_input_handled<class_Viewport_method_is_input_handled>` **(** **)** |const| |
  147. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | :ref:`bool<class_bool>` | :ref:`is_size_override_enabled<class_Viewport_method_is_size_override_enabled>` **(** **)** |const| |
  149. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. | void | :ref:`set_attach_to_screen_rect<class_Viewport_method_set_attach_to_screen_rect>` **(** :ref:`Rect2<class_Rect2>` rect **)** |
  151. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  152. | void | :ref:`set_input_as_handled<class_Viewport_method_set_input_as_handled>` **(** **)** |
  153. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  154. | void | :ref:`set_shadow_atlas_quadrant_subdiv<class_Viewport_method_set_shadow_atlas_quadrant_subdiv>` **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)** |
  155. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  156. | void | :ref:`set_size_override<class_Viewport_method_set_size_override>` **(** :ref:`bool<class_bool>` enable, :ref:`Vector2<class_Vector2>` size=Vector2( -1, -1 ), :ref:`Vector2<class_Vector2>` margin=Vector2( 0, 0 ) **)** |
  157. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  158. | void | :ref:`unhandled_input<class_Viewport_method_unhandled_input>` **(** :ref:`InputEvent<class_InputEvent>` local_event **)** |
  159. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  160. | void | :ref:`update_worlds<class_Viewport_method_update_worlds>` **(** **)** |
  161. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  162. | void | :ref:`warp_mouse<class_Viewport_method_warp_mouse>` **(** :ref:`Vector2<class_Vector2>` to_position **)** |
  163. +---------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  164. .. rst-class:: classref-section-separator
  165. ----
  166. .. rst-class:: classref-descriptions-group
  167. Signals
  168. -------
  169. .. _class_Viewport_signal_gui_focus_changed:
  170. .. rst-class:: classref-signal
  171. **gui_focus_changed** **(** :ref:`Control<class_Control>` node **)**
  172. Emitted when a Control node grabs keyboard focus.
  173. .. rst-class:: classref-item-separator
  174. ----
  175. .. _class_Viewport_signal_size_changed:
  176. .. rst-class:: classref-signal
  177. **size_changed** **(** **)**
  178. Emitted when the size of the viewport is changed, whether by :ref:`set_size_override<class_Viewport_method_set_size_override>`, resize of window, or some other means.
  179. .. rst-class:: classref-section-separator
  180. ----
  181. .. rst-class:: classref-descriptions-group
  182. Enumerations
  183. ------------
  184. .. _enum_Viewport_UpdateMode:
  185. .. rst-class:: classref-enumeration
  186. enum **UpdateMode**:
  187. .. _class_Viewport_constant_UPDATE_DISABLED:
  188. .. rst-class:: classref-enumeration-constant
  189. :ref:`UpdateMode<enum_Viewport_UpdateMode>` **UPDATE_DISABLED** = ``0``
  190. Do not update the render target.
  191. .. _class_Viewport_constant_UPDATE_ONCE:
  192. .. rst-class:: classref-enumeration-constant
  193. :ref:`UpdateMode<enum_Viewport_UpdateMode>` **UPDATE_ONCE** = ``1``
  194. Update the render target once, then switch to :ref:`UPDATE_DISABLED<class_Viewport_constant_UPDATE_DISABLED>`.
  195. .. _class_Viewport_constant_UPDATE_WHEN_VISIBLE:
  196. .. rst-class:: classref-enumeration-constant
  197. :ref:`UpdateMode<enum_Viewport_UpdateMode>` **UPDATE_WHEN_VISIBLE** = ``2``
  198. Update the render target only when it is visible. This is the default value.
  199. .. _class_Viewport_constant_UPDATE_ALWAYS:
  200. .. rst-class:: classref-enumeration-constant
  201. :ref:`UpdateMode<enum_Viewport_UpdateMode>` **UPDATE_ALWAYS** = ``3``
  202. Always update the render target.
  203. .. rst-class:: classref-item-separator
  204. ----
  205. .. _enum_Viewport_ShadowAtlasQuadrantSubdiv:
  206. .. rst-class:: classref-enumeration
  207. enum **ShadowAtlasQuadrantSubdiv**:
  208. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED:
  209. .. rst-class:: classref-enumeration-constant
  210. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED** = ``0``
  211. This quadrant will not be used.
  212. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1:
  213. .. rst-class:: classref-enumeration-constant
  214. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_1** = ``1``
  215. This quadrant will only be used by one shadow map.
  216. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_4:
  217. .. rst-class:: classref-enumeration-constant
  218. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_4** = ``2``
  219. This quadrant will be split in 4 and used by up to 4 shadow maps.
  220. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_16:
  221. .. rst-class:: classref-enumeration-constant
  222. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_16** = ``3``
  223. This quadrant will be split 16 ways and used by up to 16 shadow maps.
  224. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_64:
  225. .. rst-class:: classref-enumeration-constant
  226. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_64** = ``4``
  227. This quadrant will be split 64 ways and used by up to 64 shadow maps.
  228. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_256:
  229. .. rst-class:: classref-enumeration-constant
  230. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_256** = ``5``
  231. This quadrant will be split 256 ways and used by up to 256 shadow maps. Unless the :ref:`shadow_atlas_size<class_Viewport_property_shadow_atlas_size>` is very high, the shadows in this quadrant will be very low resolution.
  232. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_1024:
  233. .. rst-class:: classref-enumeration-constant
  234. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_1024** = ``6``
  235. This quadrant will be split 1024 ways and used by up to 1024 shadow maps. Unless the :ref:`shadow_atlas_size<class_Viewport_property_shadow_atlas_size>` is very high, the shadows in this quadrant will be very low resolution.
  236. .. _class_Viewport_constant_SHADOW_ATLAS_QUADRANT_SUBDIV_MAX:
  237. .. rst-class:: classref-enumeration-constant
  238. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **SHADOW_ATLAS_QUADRANT_SUBDIV_MAX** = ``7``
  239. Represents the size of the :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` enum.
  240. .. rst-class:: classref-item-separator
  241. ----
  242. .. _enum_Viewport_RenderInfo:
  243. .. rst-class:: classref-enumeration
  244. enum **RenderInfo**:
  245. .. _class_Viewport_constant_RENDER_INFO_OBJECTS_IN_FRAME:
  246. .. rst-class:: classref-enumeration-constant
  247. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_OBJECTS_IN_FRAME** = ``0``
  248. Amount of objects in frame.
  249. .. _class_Viewport_constant_RENDER_INFO_VERTICES_IN_FRAME:
  250. .. rst-class:: classref-enumeration-constant
  251. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_VERTICES_IN_FRAME** = ``1``
  252. Amount of vertices in frame.
  253. .. _class_Viewport_constant_RENDER_INFO_MATERIAL_CHANGES_IN_FRAME:
  254. .. rst-class:: classref-enumeration-constant
  255. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_MATERIAL_CHANGES_IN_FRAME** = ``2``
  256. Amount of material changes in frame.
  257. .. _class_Viewport_constant_RENDER_INFO_SHADER_CHANGES_IN_FRAME:
  258. .. rst-class:: classref-enumeration-constant
  259. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_SHADER_CHANGES_IN_FRAME** = ``3``
  260. Amount of shader changes in frame.
  261. .. _class_Viewport_constant_RENDER_INFO_SURFACE_CHANGES_IN_FRAME:
  262. .. rst-class:: classref-enumeration-constant
  263. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_SURFACE_CHANGES_IN_FRAME** = ``4``
  264. Amount of surface changes in frame.
  265. .. _class_Viewport_constant_RENDER_INFO_DRAW_CALLS_IN_FRAME:
  266. .. rst-class:: classref-enumeration-constant
  267. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_DRAW_CALLS_IN_FRAME** = ``5``
  268. Amount of draw calls in frame.
  269. .. _class_Viewport_constant_RENDER_INFO_2D_ITEMS_IN_FRAME:
  270. .. rst-class:: classref-enumeration-constant
  271. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_2D_ITEMS_IN_FRAME** = ``6``
  272. Amount of items or joined items in frame.
  273. .. _class_Viewport_constant_RENDER_INFO_2D_DRAW_CALLS_IN_FRAME:
  274. .. rst-class:: classref-enumeration-constant
  275. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_2D_DRAW_CALLS_IN_FRAME** = ``7``
  276. Amount of draw calls in frame.
  277. .. _class_Viewport_constant_RENDER_INFO_MAX:
  278. .. rst-class:: classref-enumeration-constant
  279. :ref:`RenderInfo<enum_Viewport_RenderInfo>` **RENDER_INFO_MAX** = ``8``
  280. Represents the size of the :ref:`RenderInfo<enum_Viewport_RenderInfo>` enum.
  281. .. rst-class:: classref-item-separator
  282. ----
  283. .. _enum_Viewport_DebugDraw:
  284. .. rst-class:: classref-enumeration
  285. enum **DebugDraw**:
  286. .. _class_Viewport_constant_DEBUG_DRAW_DISABLED:
  287. .. rst-class:: classref-enumeration-constant
  288. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_DISABLED** = ``0``
  289. Objects are displayed normally.
  290. .. _class_Viewport_constant_DEBUG_DRAW_UNSHADED:
  291. .. rst-class:: classref-enumeration-constant
  292. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_UNSHADED** = ``1``
  293. Objects are displayed without light information.
  294. .. _class_Viewport_constant_DEBUG_DRAW_OVERDRAW:
  295. .. rst-class:: classref-enumeration-constant
  296. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_OVERDRAW** = ``2``
  297. Objected are displayed semi-transparent with additive blending so you can see where they intersect.
  298. .. _class_Viewport_constant_DEBUG_DRAW_WIREFRAME:
  299. .. rst-class:: classref-enumeration-constant
  300. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **DEBUG_DRAW_WIREFRAME** = ``3``
  301. Objects are displayed in wireframe style.
  302. .. rst-class:: classref-item-separator
  303. ----
  304. .. _enum_Viewport_MSAA:
  305. .. rst-class:: classref-enumeration
  306. enum **MSAA**:
  307. .. _class_Viewport_constant_MSAA_DISABLED:
  308. .. rst-class:: classref-enumeration-constant
  309. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_DISABLED** = ``0``
  310. Multisample anti-aliasing mode disabled. This is the default value.
  311. .. _class_Viewport_constant_MSAA_2X:
  312. .. rst-class:: classref-enumeration-constant
  313. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_2X** = ``1``
  314. Use 2x Multisample Antialiasing.
  315. .. _class_Viewport_constant_MSAA_4X:
  316. .. rst-class:: classref-enumeration-constant
  317. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_4X** = ``2``
  318. Use 4x Multisample Antialiasing.
  319. .. _class_Viewport_constant_MSAA_8X:
  320. .. rst-class:: classref-enumeration-constant
  321. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_8X** = ``3``
  322. Use 8x Multisample Antialiasing. Likely unsupported on low-end and older hardware.
  323. .. _class_Viewport_constant_MSAA_16X:
  324. .. rst-class:: classref-enumeration-constant
  325. :ref:`MSAA<enum_Viewport_MSAA>` **MSAA_16X** = ``4``
  326. Use 16x Multisample Antialiasing. Likely unsupported on medium and low-end hardware.
  327. .. rst-class:: classref-item-separator
  328. ----
  329. .. _enum_Viewport_Usage:
  330. .. rst-class:: classref-enumeration
  331. enum **Usage**:
  332. .. _class_Viewport_constant_USAGE_2D:
  333. .. rst-class:: classref-enumeration-constant
  334. :ref:`Usage<enum_Viewport_Usage>` **USAGE_2D** = ``0``
  335. Allocates all buffers needed for drawing 2D scenes. This takes less VRAM than the 3D usage modes. Note that 3D rendering effects such as glow and HDR are not available when using this mode.
  336. .. _class_Viewport_constant_USAGE_2D_NO_SAMPLING:
  337. .. rst-class:: classref-enumeration-constant
  338. :ref:`Usage<enum_Viewport_Usage>` **USAGE_2D_NO_SAMPLING** = ``1``
  339. Allocates buffers needed for 2D scenes without allocating a buffer for screen copy. Accordingly, you cannot read from the screen. Of the :ref:`Usage<enum_Viewport_Usage>` types, this requires the least VRAM. Note that 3D rendering effects such as glow and HDR are not available when using this mode.
  340. .. _class_Viewport_constant_USAGE_3D:
  341. .. rst-class:: classref-enumeration-constant
  342. :ref:`Usage<enum_Viewport_Usage>` **USAGE_3D** = ``2``
  343. Allocates full buffers for drawing 3D scenes and all 3D effects including buffers needed for 2D scenes and effects.
  344. .. _class_Viewport_constant_USAGE_3D_NO_EFFECTS:
  345. .. rst-class:: classref-enumeration-constant
  346. :ref:`Usage<enum_Viewport_Usage>` **USAGE_3D_NO_EFFECTS** = ``3``
  347. Allocates buffers needed for drawing 3D scenes. But does not allocate buffers needed for reading from the screen and post-processing effects. Saves some VRAM.
  348. .. rst-class:: classref-item-separator
  349. ----
  350. .. _enum_Viewport_ClearMode:
  351. .. rst-class:: classref-enumeration
  352. enum **ClearMode**:
  353. .. _class_Viewport_constant_CLEAR_MODE_ALWAYS:
  354. .. rst-class:: classref-enumeration-constant
  355. :ref:`ClearMode<enum_Viewport_ClearMode>` **CLEAR_MODE_ALWAYS** = ``0``
  356. Always clear the render target before drawing.
  357. .. _class_Viewport_constant_CLEAR_MODE_NEVER:
  358. .. rst-class:: classref-enumeration-constant
  359. :ref:`ClearMode<enum_Viewport_ClearMode>` **CLEAR_MODE_NEVER** = ``1``
  360. Never clear the render target.
  361. .. _class_Viewport_constant_CLEAR_MODE_ONLY_NEXT_FRAME:
  362. .. rst-class:: classref-enumeration-constant
  363. :ref:`ClearMode<enum_Viewport_ClearMode>` **CLEAR_MODE_ONLY_NEXT_FRAME** = ``2``
  364. Clear the render target next frame, then switch to :ref:`CLEAR_MODE_NEVER<class_Viewport_constant_CLEAR_MODE_NEVER>`.
  365. .. rst-class:: classref-section-separator
  366. ----
  367. .. rst-class:: classref-descriptions-group
  368. Property Descriptions
  369. ---------------------
  370. .. _class_Viewport_property_arvr:
  371. .. rst-class:: classref-property
  372. :ref:`bool<class_bool>` **arvr** = ``false``
  373. .. rst-class:: classref-property-setget
  374. - void **set_use_arvr** **(** :ref:`bool<class_bool>` value **)**
  375. - :ref:`bool<class_bool>` **use_arvr** **(** **)**
  376. If ``true``, the viewport will be used in AR/VR process.
  377. .. rst-class:: classref-item-separator
  378. ----
  379. .. _class_Viewport_property_audio_listener_enable_2d:
  380. .. rst-class:: classref-property
  381. :ref:`bool<class_bool>` **audio_listener_enable_2d** = ``false``
  382. .. rst-class:: classref-property-setget
  383. - void **set_as_audio_listener_2d** **(** :ref:`bool<class_bool>` value **)**
  384. - :ref:`bool<class_bool>` **is_audio_listener_2d** **(** **)**
  385. If ``true``, the viewport will process 2D audio streams.
  386. .. rst-class:: classref-item-separator
  387. ----
  388. .. _class_Viewport_property_audio_listener_enable_3d:
  389. .. rst-class:: classref-property
  390. :ref:`bool<class_bool>` **audio_listener_enable_3d** = ``false``
  391. .. rst-class:: classref-property-setget
  392. - void **set_as_audio_listener** **(** :ref:`bool<class_bool>` value **)**
  393. - :ref:`bool<class_bool>` **is_audio_listener** **(** **)**
  394. If ``true``, the viewport will process 3D audio streams.
  395. .. rst-class:: classref-item-separator
  396. ----
  397. .. _class_Viewport_property_canvas_transform:
  398. .. rst-class:: classref-property
  399. :ref:`Transform2D<class_Transform2D>` **canvas_transform**
  400. .. rst-class:: classref-property-setget
  401. - void **set_canvas_transform** **(** :ref:`Transform2D<class_Transform2D>` value **)**
  402. - :ref:`Transform2D<class_Transform2D>` **get_canvas_transform** **(** **)**
  403. The canvas transform of the viewport, useful for changing the on-screen positions of all child :ref:`CanvasItem<class_CanvasItem>`\ s. This is relative to the global canvas transform of the viewport.
  404. .. rst-class:: classref-item-separator
  405. ----
  406. .. _class_Viewport_property_debanding:
  407. .. rst-class:: classref-property
  408. :ref:`bool<class_bool>` **debanding** = ``false``
  409. .. rst-class:: classref-property-setget
  410. - void **set_use_debanding** **(** :ref:`bool<class_bool>` value **)**
  411. - :ref:`bool<class_bool>` **get_use_debanding** **(** **)**
  412. If ``true``, uses a fast post-processing filter to make banding significantly less visible in 3D. 2D rendering is *not* affected by debanding unless the :ref:`Environment.background_mode<class_Environment_property_background_mode>` is :ref:`Environment.BG_CANVAS<class_Environment_constant_BG_CANVAS>`. In this case, :ref:`usage<class_Viewport_property_usage>` must also be set to :ref:`USAGE_3D<class_Viewport_constant_USAGE_3D>`. See also :ref:`ProjectSettings.rendering/quality/filters/use_debanding<class_ProjectSettings_property_rendering/quality/filters/use_debanding>`.
  413. In some cases, debanding may introduce a slightly noticeable dithering pattern. It's recommended to enable debanding only when actually needed since the dithering pattern will make lossless-compressed screenshots larger.
  414. \ **Note:** Only available on the GLES3 backend. :ref:`hdr<class_Viewport_property_hdr>` must also be ``true`` for debanding to be effective.
  415. .. rst-class:: classref-item-separator
  416. ----
  417. .. _class_Viewport_property_debug_draw:
  418. .. rst-class:: classref-property
  419. :ref:`DebugDraw<enum_Viewport_DebugDraw>` **debug_draw** = ``0``
  420. .. rst-class:: classref-property-setget
  421. - void **set_debug_draw** **(** :ref:`DebugDraw<enum_Viewport_DebugDraw>` value **)**
  422. - :ref:`DebugDraw<enum_Viewport_DebugDraw>` **get_debug_draw** **(** **)**
  423. The overlay mode for test rendered geometry in debug purposes.
  424. .. rst-class:: classref-item-separator
  425. ----
  426. .. _class_Viewport_property_disable_3d:
  427. .. rst-class:: classref-property
  428. :ref:`bool<class_bool>` **disable_3d** = ``false``
  429. .. rst-class:: classref-property-setget
  430. - void **set_disable_3d** **(** :ref:`bool<class_bool>` value **)**
  431. - :ref:`bool<class_bool>` **is_3d_disabled** **(** **)**
  432. If ``true``, the viewport will disable 3D rendering. To actually disable allocation of 3D buffers, set :ref:`usage<class_Viewport_property_usage>` instead.
  433. .. rst-class:: classref-item-separator
  434. ----
  435. .. _class_Viewport_property_fxaa:
  436. .. rst-class:: classref-property
  437. :ref:`bool<class_bool>` **fxaa** = ``false``
  438. .. rst-class:: classref-property-setget
  439. - void **set_use_fxaa** **(** :ref:`bool<class_bool>` value **)**
  440. - :ref:`bool<class_bool>` **get_use_fxaa** **(** **)**
  441. Enables 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. Some of the lost sharpness can be recovered by enabling contrast-adaptive sharpening (see :ref:`sharpen_intensity<class_Viewport_property_sharpen_intensity>`).
  442. .. rst-class:: classref-item-separator
  443. ----
  444. .. _class_Viewport_property_global_canvas_transform:
  445. .. rst-class:: classref-property
  446. :ref:`Transform2D<class_Transform2D>` **global_canvas_transform**
  447. .. rst-class:: classref-property-setget
  448. - void **set_global_canvas_transform** **(** :ref:`Transform2D<class_Transform2D>` value **)**
  449. - :ref:`Transform2D<class_Transform2D>` **get_global_canvas_transform** **(** **)**
  450. The global canvas transform of the viewport. The canvas transform is relative to this.
  451. .. rst-class:: classref-item-separator
  452. ----
  453. .. _class_Viewport_property_gui_disable_input:
  454. .. rst-class:: classref-property
  455. :ref:`bool<class_bool>` **gui_disable_input** = ``false``
  456. .. rst-class:: classref-property-setget
  457. - void **set_disable_input** **(** :ref:`bool<class_bool>` value **)**
  458. - :ref:`bool<class_bool>` **is_input_disabled** **(** **)**
  459. If ``true``, the viewport will not receive input events.
  460. .. rst-class:: classref-item-separator
  461. ----
  462. .. _class_Viewport_property_gui_snap_controls_to_pixels:
  463. .. rst-class:: classref-property
  464. :ref:`bool<class_bool>` **gui_snap_controls_to_pixels** = ``true``
  465. .. rst-class:: classref-property-setget
  466. - void **set_snap_controls_to_pixels** **(** :ref:`bool<class_bool>` value **)**
  467. - :ref:`bool<class_bool>` **is_snap_controls_to_pixels_enabled** **(** **)**
  468. If ``true``, the GUI controls on the viewport will lay pixel perfectly.
  469. .. rst-class:: classref-item-separator
  470. ----
  471. .. _class_Viewport_property_handle_input_locally:
  472. .. rst-class:: classref-property
  473. :ref:`bool<class_bool>` **handle_input_locally** = ``true``
  474. .. rst-class:: classref-property-setget
  475. - void **set_handle_input_locally** **(** :ref:`bool<class_bool>` value **)**
  476. - :ref:`bool<class_bool>` **is_handling_input_locally** **(** **)**
  477. .. container:: contribute
  478. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  479. .. rst-class:: classref-item-separator
  480. ----
  481. .. _class_Viewport_property_hdr:
  482. .. rst-class:: classref-property
  483. :ref:`bool<class_bool>` **hdr** = ``true``
  484. .. rst-class:: classref-property-setget
  485. - void **set_hdr** **(** :ref:`bool<class_bool>` value **)**
  486. - :ref:`bool<class_bool>` **get_hdr** **(** **)**
  487. If ``true``, the viewport rendering will receive benefits from High Dynamic Range algorithm. High Dynamic Range allows the viewport to receive values that are outside the 0-1 range. In Godot, HDR uses half floating-point precision (16-bit) by default. To use full floating-point precision (32-bit), enable :ref:`use_32_bpc_depth<class_Viewport_property_use_32_bpc_depth>`.
  488. \ **Note:** Requires :ref:`usage<class_Viewport_property_usage>` to be set to :ref:`USAGE_3D<class_Viewport_constant_USAGE_3D>` or :ref:`USAGE_3D_NO_EFFECTS<class_Viewport_constant_USAGE_3D_NO_EFFECTS>`, since HDR is not supported for 2D.
  489. \ **Note:** Only available on the GLES3 backend.
  490. .. rst-class:: classref-item-separator
  491. ----
  492. .. _class_Viewport_property_keep_3d_linear:
  493. .. rst-class:: classref-property
  494. :ref:`bool<class_bool>` **keep_3d_linear** = ``false``
  495. .. rst-class:: classref-property-setget
  496. - void **set_keep_3d_linear** **(** :ref:`bool<class_bool>` value **)**
  497. - :ref:`bool<class_bool>` **get_keep_3d_linear** **(** **)**
  498. If ``true``, the result after 3D rendering will not have a linear to sRGB color conversion applied. This is important when the viewport is used as a render target where the result is used as a texture on a 3D object rendered in another viewport. It is also important if the viewport is used to create data that is not color based (noise, heightmaps, pickmaps, etc.). Do not enable this when the viewport is used as a texture on a 2D object or if the viewport is your final output. For the GLES2 driver this will convert the sRGB output to linear, this should only be used for VR plugins that require input in linear color space!
  499. .. rst-class:: classref-item-separator
  500. ----
  501. .. _class_Viewport_property_msaa:
  502. .. rst-class:: classref-property
  503. :ref:`MSAA<enum_Viewport_MSAA>` **msaa** = ``0``
  504. .. rst-class:: classref-property-setget
  505. - void **set_msaa** **(** :ref:`MSAA<enum_Viewport_MSAA>` value **)**
  506. - :ref:`MSAA<enum_Viewport_MSAA>` **get_msaa** **(** **)**
  507. 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.
  508. .. rst-class:: classref-item-separator
  509. ----
  510. .. _class_Viewport_property_own_world:
  511. .. rst-class:: classref-property
  512. :ref:`bool<class_bool>` **own_world** = ``false``
  513. .. rst-class:: classref-property-setget
  514. - void **set_use_own_world** **(** :ref:`bool<class_bool>` value **)**
  515. - :ref:`bool<class_bool>` **is_using_own_world** **(** **)**
  516. If ``true``, the viewport will use a unique copy of the :ref:`World<class_World>` defined in :ref:`world<class_Viewport_property_world>`.
  517. .. rst-class:: classref-item-separator
  518. ----
  519. .. _class_Viewport_property_physics_object_picking:
  520. .. rst-class:: classref-property
  521. :ref:`bool<class_bool>` **physics_object_picking** = ``false``
  522. .. rst-class:: classref-property-setget
  523. - void **set_physics_object_picking** **(** :ref:`bool<class_bool>` value **)**
  524. - :ref:`bool<class_bool>` **get_physics_object_picking** **(** **)**
  525. If ``true``, the objects rendered by viewport become subjects of mouse picking process.
  526. .. rst-class:: classref-item-separator
  527. ----
  528. .. _class_Viewport_property_render_direct_to_screen:
  529. .. rst-class:: classref-property
  530. :ref:`bool<class_bool>` **render_direct_to_screen** = ``false``
  531. .. rst-class:: classref-property-setget
  532. - void **set_use_render_direct_to_screen** **(** :ref:`bool<class_bool>` value **)**
  533. - :ref:`bool<class_bool>` **is_using_render_direct_to_screen** **(** **)**
  534. If ``true``, 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 ``SCREEN_TEXTURE`` becomes unavailable. For more information see :ref:`VisualServer.viewport_set_render_direct_to_screen<class_VisualServer_method_viewport_set_render_direct_to_screen>`.
  535. .. rst-class:: classref-item-separator
  536. ----
  537. .. _class_Viewport_property_render_target_clear_mode:
  538. .. rst-class:: classref-property
  539. :ref:`ClearMode<enum_Viewport_ClearMode>` **render_target_clear_mode** = ``0``
  540. .. rst-class:: classref-property-setget
  541. - void **set_clear_mode** **(** :ref:`ClearMode<enum_Viewport_ClearMode>` value **)**
  542. - :ref:`ClearMode<enum_Viewport_ClearMode>` **get_clear_mode** **(** **)**
  543. The clear mode when viewport used as a render target.
  544. \ **Note:** This property is intended for 2D usage.
  545. .. rst-class:: classref-item-separator
  546. ----
  547. .. _class_Viewport_property_render_target_update_mode:
  548. .. rst-class:: classref-property
  549. :ref:`UpdateMode<enum_Viewport_UpdateMode>` **render_target_update_mode** = ``2``
  550. .. rst-class:: classref-property-setget
  551. - void **set_update_mode** **(** :ref:`UpdateMode<enum_Viewport_UpdateMode>` value **)**
  552. - :ref:`UpdateMode<enum_Viewport_UpdateMode>` **get_update_mode** **(** **)**
  553. The update mode when viewport used as a render target.
  554. .. rst-class:: classref-item-separator
  555. ----
  556. .. _class_Viewport_property_render_target_v_flip:
  557. .. rst-class:: classref-property
  558. :ref:`bool<class_bool>` **render_target_v_flip** = ``false``
  559. .. rst-class:: classref-property-setget
  560. - void **set_vflip** **(** :ref:`bool<class_bool>` value **)**
  561. - :ref:`bool<class_bool>` **get_vflip** **(** **)**
  562. If ``true``, the result of rendering will be flipped vertically. Since Viewports in Godot 3.x render upside-down, it's recommended to set this to ``true`` in most situations.
  563. .. rst-class:: classref-item-separator
  564. ----
  565. .. _class_Viewport_property_shadow_atlas_quad_0:
  566. .. rst-class:: classref-property
  567. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_0** = ``2``
  568. .. rst-class:: classref-property-setget
  569. - void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
  570. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  571. The subdivision amount of the first quadrant on the shadow atlas.
  572. .. rst-class:: classref-item-separator
  573. ----
  574. .. _class_Viewport_property_shadow_atlas_quad_1:
  575. .. rst-class:: classref-property
  576. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_1** = ``2``
  577. .. rst-class:: classref-property-setget
  578. - void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
  579. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  580. The subdivision amount of the second quadrant on the shadow atlas.
  581. .. rst-class:: classref-item-separator
  582. ----
  583. .. _class_Viewport_property_shadow_atlas_quad_2:
  584. .. rst-class:: classref-property
  585. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_2** = ``3``
  586. .. rst-class:: classref-property-setget
  587. - void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
  588. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  589. The subdivision amount of the third quadrant on the shadow atlas.
  590. .. rst-class:: classref-item-separator
  591. ----
  592. .. _class_Viewport_property_shadow_atlas_quad_3:
  593. .. rst-class:: classref-property
  594. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **shadow_atlas_quad_3** = ``4``
  595. .. rst-class:: classref-property-setget
  596. - void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
  597. - :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  598. The subdivision amount of the fourth quadrant on the shadow atlas.
  599. .. rst-class:: classref-item-separator
  600. ----
  601. .. _class_Viewport_property_shadow_atlas_size:
  602. .. rst-class:: classref-property
  603. :ref:`int<class_int>` **shadow_atlas_size** = ``0``
  604. .. rst-class:: classref-property-setget
  605. - void **set_shadow_atlas_size** **(** :ref:`int<class_int>` value **)**
  606. - :ref:`int<class_int>` **get_shadow_atlas_size** **(** **)**
  607. The shadow atlas' resolution (used for omni and spot lights). The value will be rounded up to the nearest power of 2.
  608. \ **Note:** If this is set to ``0``, both point *and* directional shadows won't be visible. Since user-created viewports default to a value of ``0``, this value must be set above ``0`` manually (typically at least ``256``).
  609. .. rst-class:: classref-item-separator
  610. ----
  611. .. _class_Viewport_property_sharpen_intensity:
  612. .. rst-class:: classref-property
  613. :ref:`float<class_float>` **sharpen_intensity** = ``0.0``
  614. .. rst-class:: classref-property-setget
  615. - void **set_sharpen_intensity** **(** :ref:`float<class_float>` value **)**
  616. - :ref:`float<class_float>` **get_sharpen_intensity** **(** **)**
  617. If set to a value greater than ``0.0``, contrast-adaptive sharpening will be applied to the 3D viewport. This has a low performance cost and can be used to recover some of the sharpness lost from using FXAA. Values around ``0.5`` generally give the best results. See also :ref:`fxaa<class_Viewport_property_fxaa>`.
  618. .. rst-class:: classref-item-separator
  619. ----
  620. .. _class_Viewport_property_size:
  621. .. rst-class:: classref-property
  622. :ref:`Vector2<class_Vector2>` **size** = ``Vector2( 0, 0 )``
  623. .. rst-class:: classref-property-setget
  624. - void **set_size** **(** :ref:`Vector2<class_Vector2>` value **)**
  625. - :ref:`Vector2<class_Vector2>` **get_size** **(** **)**
  626. The width and height of viewport. Must be set to a value greater than or equal to 2 pixels on both dimensions. Otherwise, nothing will be displayed.
  627. .. rst-class:: classref-item-separator
  628. ----
  629. .. _class_Viewport_property_size_override_stretch:
  630. .. rst-class:: classref-property
  631. :ref:`bool<class_bool>` **size_override_stretch** = ``false``
  632. .. rst-class:: classref-property-setget
  633. - void **set_size_override_stretch** **(** :ref:`bool<class_bool>` value **)**
  634. - :ref:`bool<class_bool>` **is_size_override_stretch_enabled** **(** **)**
  635. If ``true``, the size override affects stretch as well.
  636. .. rst-class:: classref-item-separator
  637. ----
  638. .. _class_Viewport_property_transparent_bg:
  639. .. rst-class:: classref-property
  640. :ref:`bool<class_bool>` **transparent_bg** = ``false``
  641. .. rst-class:: classref-property-setget
  642. - void **set_transparent_background** **(** :ref:`bool<class_bool>` value **)**
  643. - :ref:`bool<class_bool>` **has_transparent_background** **(** **)**
  644. If ``true``, the viewport should render its background as transparent.
  645. .. rst-class:: classref-item-separator
  646. ----
  647. .. _class_Viewport_property_usage:
  648. .. rst-class:: classref-property
  649. :ref:`Usage<enum_Viewport_Usage>` **usage** = ``2``
  650. .. rst-class:: classref-property-setget
  651. - void **set_usage** **(** :ref:`Usage<enum_Viewport_Usage>` value **)**
  652. - :ref:`Usage<enum_Viewport_Usage>` **get_usage** **(** **)**
  653. The viewport's rendering mode. This controls which buffers are allocated for the viewport (2D only, or 2D + 3D). 2D-only options can reduce memory usage and improve performance slightly, especially on low-end devices.
  654. \ **Note:** If set to :ref:`USAGE_2D<class_Viewport_constant_USAGE_2D>` or :ref:`USAGE_2D_NO_SAMPLING<class_Viewport_constant_USAGE_2D_NO_SAMPLING>`, :ref:`hdr<class_Viewport_property_hdr>` will have no effect when enabled since HDR is not supported for 2D.
  655. .. rst-class:: classref-item-separator
  656. ----
  657. .. _class_Viewport_property_use_32_bpc_depth:
  658. .. rst-class:: classref-property
  659. :ref:`bool<class_bool>` **use_32_bpc_depth** = ``false``
  660. .. rst-class:: classref-property-setget
  661. - void **set_use_32_bpc_depth** **(** :ref:`bool<class_bool>` value **)**
  662. - :ref:`bool<class_bool>` **get_use_32_bpc_depth** **(** **)**
  663. If ``true``, allocates the viewport's framebuffer with full floating-point precision (32-bit) instead of half floating-point precision (16-bit). Only effective when :ref:`hdr<class_Viewport_property_hdr>` is also enabled.
  664. \ **Note:** Enabling this setting does not improve rendering quality. Using full floating-point precision is slower, and is generally only needed for advanced shaders that require a high level of precision. To reduce banding, enable :ref:`debanding<class_Viewport_property_debanding>` instead.
  665. \ **Note:** Only available on the GLES3 backend.
  666. .. rst-class:: classref-item-separator
  667. ----
  668. .. _class_Viewport_property_world:
  669. .. rst-class:: classref-property
  670. :ref:`World<class_World>` **world**
  671. .. rst-class:: classref-property-setget
  672. - void **set_world** **(** :ref:`World<class_World>` value **)**
  673. - :ref:`World<class_World>` **get_world** **(** **)**
  674. The custom :ref:`World<class_World>` which can be used as 3D environment source.
  675. .. rst-class:: classref-item-separator
  676. ----
  677. .. _class_Viewport_property_world_2d:
  678. .. rst-class:: classref-property
  679. :ref:`World2D<class_World2D>` **world_2d**
  680. .. rst-class:: classref-property-setget
  681. - void **set_world_2d** **(** :ref:`World2D<class_World2D>` value **)**
  682. - :ref:`World2D<class_World2D>` **get_world_2d** **(** **)**
  683. The custom :ref:`World2D<class_World2D>` which can be used as 2D environment source.
  684. .. rst-class:: classref-section-separator
  685. ----
  686. .. rst-class:: classref-descriptions-group
  687. Method Descriptions
  688. -------------------
  689. .. _class_Viewport_method_find_world:
  690. .. rst-class:: classref-method
  691. :ref:`World<class_World>` **find_world** **(** **)** |const|
  692. Returns the first valid :ref:`World<class_World>` for this viewport, searching the :ref:`world<class_Viewport_property_world>` property of itself and any Viewport ancestor.
  693. .. rst-class:: classref-item-separator
  694. ----
  695. .. _class_Viewport_method_find_world_2d:
  696. .. rst-class:: classref-method
  697. :ref:`World2D<class_World2D>` **find_world_2d** **(** **)** |const|
  698. Returns the first valid :ref:`World2D<class_World2D>` for this viewport, searching the :ref:`world_2d<class_Viewport_property_world_2d>` property of itself and any Viewport ancestor.
  699. .. rst-class:: classref-item-separator
  700. ----
  701. .. _class_Viewport_method_get_camera:
  702. .. rst-class:: classref-method
  703. :ref:`Camera<class_Camera>` **get_camera** **(** **)** |const|
  704. Returns the active 3D camera.
  705. .. rst-class:: classref-item-separator
  706. ----
  707. .. _class_Viewport_method_get_final_transform:
  708. .. rst-class:: classref-method
  709. :ref:`Transform2D<class_Transform2D>` **get_final_transform** **(** **)** |const|
  710. Returns the total transform of the viewport.
  711. .. rst-class:: classref-item-separator
  712. ----
  713. .. _class_Viewport_method_get_modal_stack_top:
  714. .. rst-class:: classref-method
  715. :ref:`Control<class_Control>` **get_modal_stack_top** **(** **)** |const|
  716. Returns the topmost modal in the stack.
  717. .. rst-class:: classref-item-separator
  718. ----
  719. .. _class_Viewport_method_get_mouse_position:
  720. .. rst-class:: classref-method
  721. :ref:`Vector2<class_Vector2>` **get_mouse_position** **(** **)** |const|
  722. Returns the mouse's position in this **Viewport** using the coordinate system of this **Viewport**.
  723. .. rst-class:: classref-item-separator
  724. ----
  725. .. _class_Viewport_method_get_render_info:
  726. .. rst-class:: classref-method
  727. :ref:`int<class_int>` **get_render_info** **(** :ref:`RenderInfo<enum_Viewport_RenderInfo>` info **)**
  728. Returns information about the viewport from the rendering pipeline.
  729. .. rst-class:: classref-item-separator
  730. ----
  731. .. _class_Viewport_method_get_shadow_atlas_quadrant_subdiv:
  732. .. rst-class:: classref-method
  733. :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` **get_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant **)** |const|
  734. Returns the :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` of the specified quadrant.
  735. .. rst-class:: classref-item-separator
  736. ----
  737. .. _class_Viewport_method_get_size_override:
  738. .. rst-class:: classref-method
  739. :ref:`Vector2<class_Vector2>` **get_size_override** **(** **)** |const|
  740. Returns the size override set with :ref:`set_size_override<class_Viewport_method_set_size_override>`.
  741. .. rst-class:: classref-item-separator
  742. ----
  743. .. _class_Viewport_method_get_texture:
  744. .. rst-class:: classref-method
  745. :ref:`ViewportTexture<class_ViewportTexture>` **get_texture** **(** **)** |const|
  746. Returns the viewport's texture.
  747. \ **Note:** Due to the way OpenGL works, the resulting :ref:`ViewportTexture<class_ViewportTexture>` is flipped vertically. You can use :ref:`Image.flip_y<class_Image_method_flip_y>` on the result of :ref:`Texture.get_data<class_Texture_method_get_data>` to flip it back, for example:
  748. ::
  749. var img = get_viewport().get_texture().get_data()
  750. img.flip_y()
  751. .. rst-class:: classref-item-separator
  752. ----
  753. .. _class_Viewport_method_get_viewport_rid:
  754. .. rst-class:: classref-method
  755. :ref:`RID<class_RID>` **get_viewport_rid** **(** **)** |const|
  756. Returns the viewport's RID from the :ref:`VisualServer<class_VisualServer>`.
  757. .. rst-class:: classref-item-separator
  758. ----
  759. .. _class_Viewport_method_get_visible_rect:
  760. .. rst-class:: classref-method
  761. :ref:`Rect2<class_Rect2>` **get_visible_rect** **(** **)** |const|
  762. Returns the visible rectangle in global screen coordinates.
  763. .. rst-class:: classref-item-separator
  764. ----
  765. .. _class_Viewport_method_gui_get_drag_data:
  766. .. rst-class:: classref-method
  767. :ref:`Variant<class_Variant>` **gui_get_drag_data** **(** **)** |const|
  768. Returns the drag data from the GUI, that was previously returned by :ref:`Control.get_drag_data<class_Control_method_get_drag_data>`.
  769. .. rst-class:: classref-item-separator
  770. ----
  771. .. _class_Viewport_method_gui_has_modal_stack:
  772. .. rst-class:: classref-method
  773. :ref:`bool<class_bool>` **gui_has_modal_stack** **(** **)** |const|
  774. Returns ``true`` if there are visible modals on-screen.
  775. .. rst-class:: classref-item-separator
  776. ----
  777. .. _class_Viewport_method_gui_is_drag_successful:
  778. .. rst-class:: classref-method
  779. :ref:`bool<class_bool>` **gui_is_drag_successful** **(** **)** |const|
  780. Returns ``true`` if the drag operation is successful.
  781. .. rst-class:: classref-item-separator
  782. ----
  783. .. _class_Viewport_method_gui_is_dragging:
  784. .. rst-class:: classref-method
  785. :ref:`bool<class_bool>` **gui_is_dragging** **(** **)** |const|
  786. Returns ``true`` if the viewport is currently performing a drag operation.
  787. Alternative to :ref:`Node.NOTIFICATION_DRAG_BEGIN<class_Node_constant_NOTIFICATION_DRAG_BEGIN>` and :ref:`Node.NOTIFICATION_DRAG_END<class_Node_constant_NOTIFICATION_DRAG_END>` when you prefer polling the value.
  788. .. rst-class:: classref-item-separator
  789. ----
  790. .. _class_Viewport_method_input:
  791. .. rst-class:: classref-method
  792. void **input** **(** :ref:`InputEvent<class_InputEvent>` local_event **)**
  793. .. container:: contribute
  794. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  795. .. rst-class:: classref-item-separator
  796. ----
  797. .. _class_Viewport_method_is_input_handled:
  798. .. rst-class:: classref-method
  799. :ref:`bool<class_bool>` **is_input_handled** **(** **)** |const|
  800. .. container:: contribute
  801. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  802. .. rst-class:: classref-item-separator
  803. ----
  804. .. _class_Viewport_method_is_size_override_enabled:
  805. .. rst-class:: classref-method
  806. :ref:`bool<class_bool>` **is_size_override_enabled** **(** **)** |const|
  807. Returns ``true`` if the size override is enabled. See :ref:`set_size_override<class_Viewport_method_set_size_override>`.
  808. .. rst-class:: classref-item-separator
  809. ----
  810. .. _class_Viewport_method_set_attach_to_screen_rect:
  811. .. rst-class:: classref-method
  812. void **set_attach_to_screen_rect** **(** :ref:`Rect2<class_Rect2>` rect **)**
  813. 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.
  814. .. rst-class:: classref-item-separator
  815. ----
  816. .. _class_Viewport_method_set_input_as_handled:
  817. .. rst-class:: classref-method
  818. void **set_input_as_handled** **(** **)**
  819. Stops the input from propagating further down the :ref:`SceneTree<class_SceneTree>`.
  820. .. rst-class:: classref-item-separator
  821. ----
  822. .. _class_Viewport_method_set_shadow_atlas_quadrant_subdiv:
  823. .. rst-class:: classref-method
  824. void **set_shadow_atlas_quadrant_subdiv** **(** :ref:`int<class_int>` quadrant, :ref:`ShadowAtlasQuadrantSubdiv<enum_Viewport_ShadowAtlasQuadrantSubdiv>` subdiv **)**
  825. 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.
  826. .. rst-class:: classref-item-separator
  827. ----
  828. .. _class_Viewport_method_set_size_override:
  829. .. rst-class:: classref-method
  830. void **set_size_override** **(** :ref:`bool<class_bool>` enable, :ref:`Vector2<class_Vector2>` size=Vector2( -1, -1 ), :ref:`Vector2<class_Vector2>` margin=Vector2( 0, 0 ) **)**
  831. Sets the size override of the viewport. If the ``enable`` parameter is ``true`` the override is used, otherwise it uses the default size. If the size parameter is ``(-1, -1)``, it won't update the size.
  832. .. rst-class:: classref-item-separator
  833. ----
  834. .. _class_Viewport_method_unhandled_input:
  835. .. rst-class:: classref-method
  836. void **unhandled_input** **(** :ref:`InputEvent<class_InputEvent>` local_event **)**
  837. .. container:: contribute
  838. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  839. .. rst-class:: classref-item-separator
  840. ----
  841. .. _class_Viewport_method_update_worlds:
  842. .. rst-class:: classref-method
  843. void **update_worlds** **(** **)**
  844. Forces update of the 2D and 3D worlds.
  845. .. rst-class:: classref-item-separator
  846. ----
  847. .. _class_Viewport_method_warp_mouse:
  848. .. rst-class:: classref-method
  849. void **warp_mouse** **(** :ref:`Vector2<class_Vector2>` to_position **)**
  850. Moves the mouse pointer to the specified position in this **Viewport** using the coordinate system of this **Viewport**.
  851. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  852. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  853. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  854. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`