1 /** 2 Creates a sub-view into the screen. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.viewport; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.classdb; 23 import godot.node; 24 import godot.world2d; 25 import godot.world; 26 import godot.inputevent; 27 import godot.viewporttexture; 28 import godot.camera; 29 import godot.control; 30 /** 31 Creates a sub-view into the screen. 32 33 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. 34 Optionally, a viewport can have its own 2D or 3D world, so they don't share what they draw with other viewports. 35 If a viewport is a child of a $(D ViewportContainer), it will automatically take up its size, otherwise it must be set manually. 36 Viewports can also choose to be audio listeners, so they generate positional audio depending on a 2D or 3D camera child of it. 37 Also, viewports can be assigned to different screens in case the devices have multiple screens. 38 Finally, viewports can also behave as render targets, in which case they will not be visible unless the associated texture is used to draw. 39 */ 40 @GodotBaseClass struct Viewport 41 { 42 enum string _GODOT_internal_name = "Viewport"; 43 public: 44 @nogc nothrow: 45 union { godot_object _godot_object; Node _GODOT_base; } 46 alias _GODOT_base this; 47 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 48 package(godot) __gshared bool _classBindingInitialized = false; 49 package(godot) static struct _classBinding 50 { 51 __gshared: 52 @GodotName("set_use_arvr") GodotMethod!(void, bool) setUseArvr; 53 @GodotName("use_arvr") GodotMethod!(bool) useArvr; 54 @GodotName("set_size") GodotMethod!(void, Vector2) setSize; 55 @GodotName("get_size") GodotMethod!(Vector2) getSize; 56 @GodotName("set_world_2d") GodotMethod!(void, World2D) setWorld2d; 57 @GodotName("get_world_2d") GodotMethod!(World2D) getWorld2d; 58 @GodotName("find_world_2d") GodotMethod!(World2D) findWorld2d; 59 @GodotName("set_world") GodotMethod!(void, World) setWorld; 60 @GodotName("get_world") GodotMethod!(World) getWorld; 61 @GodotName("find_world") GodotMethod!(World) findWorld; 62 @GodotName("set_canvas_transform") GodotMethod!(void, Transform2D) setCanvasTransform; 63 @GodotName("get_canvas_transform") GodotMethod!(Transform2D) getCanvasTransform; 64 @GodotName("set_global_canvas_transform") GodotMethod!(void, Transform2D) setGlobalCanvasTransform; 65 @GodotName("get_global_canvas_transform") GodotMethod!(Transform2D) getGlobalCanvasTransform; 66 @GodotName("get_final_transform") GodotMethod!(Transform2D) getFinalTransform; 67 @GodotName("get_visible_rect") GodotMethod!(Rect2) getVisibleRect; 68 @GodotName("set_transparent_background") GodotMethod!(void, bool) setTransparentBackground; 69 @GodotName("has_transparent_background") GodotMethod!(bool) hasTransparentBackground; 70 @GodotName("_vp_input") GodotMethod!(void, InputEvent) _vpInput; 71 @GodotName("_vp_input_text") GodotMethod!(void, String) _vpInputText; 72 @GodotName("_vp_unhandled_input") GodotMethod!(void, InputEvent) _vpUnhandledInput; 73 @GodotName("set_size_override") GodotMethod!(void, bool, Vector2, Vector2) setSizeOverride; 74 @GodotName("get_size_override") GodotMethod!(Vector2) getSizeOverride; 75 @GodotName("is_size_override_enabled") GodotMethod!(bool) isSizeOverrideEnabled; 76 @GodotName("set_size_override_stretch") GodotMethod!(void, bool) setSizeOverrideStretch; 77 @GodotName("is_size_override_stretch_enabled") GodotMethod!(bool) isSizeOverrideStretchEnabled; 78 @GodotName("set_vflip") GodotMethod!(void, bool) setVflip; 79 @GodotName("get_vflip") GodotMethod!(bool) getVflip; 80 @GodotName("set_clear_mode") GodotMethod!(void, long) setClearMode; 81 @GodotName("get_clear_mode") GodotMethod!(Viewport.ClearMode) getClearMode; 82 @GodotName("set_update_mode") GodotMethod!(void, long) setUpdateMode; 83 @GodotName("get_update_mode") GodotMethod!(Viewport.UpdateMode) getUpdateMode; 84 @GodotName("set_msaa") GodotMethod!(void, long) setMsaa; 85 @GodotName("get_msaa") GodotMethod!(Viewport.MSAA) getMsaa; 86 @GodotName("set_hdr") GodotMethod!(void, bool) setHdr; 87 @GodotName("get_hdr") GodotMethod!(bool) getHdr; 88 @GodotName("set_usage") GodotMethod!(void, long) setUsage; 89 @GodotName("get_usage") GodotMethod!(Viewport.Usage) getUsage; 90 @GodotName("set_debug_draw") GodotMethod!(void, long) setDebugDraw; 91 @GodotName("get_debug_draw") GodotMethod!(Viewport.DebugDraw) getDebugDraw; 92 @GodotName("get_render_info") GodotMethod!(long, long) getRenderInfo; 93 @GodotName("get_texture") GodotMethod!(ViewportTexture) getTexture; 94 @GodotName("set_physics_object_picking") GodotMethod!(void, bool) setPhysicsObjectPicking; 95 @GodotName("get_physics_object_picking") GodotMethod!(bool) getPhysicsObjectPicking; 96 @GodotName("get_viewport_rid") GodotMethod!(RID) getViewportRid; 97 @GodotName("input") GodotMethod!(void, InputEvent) input; 98 @GodotName("unhandled_input") GodotMethod!(void, InputEvent) unhandledInput; 99 @GodotName("update_worlds") GodotMethod!(void) updateWorlds; 100 @GodotName("set_use_own_world") GodotMethod!(void, bool) setUseOwnWorld; 101 @GodotName("is_using_own_world") GodotMethod!(bool) isUsingOwnWorld; 102 @GodotName("get_camera") GodotMethod!(Camera) getCamera; 103 @GodotName("set_as_audio_listener") GodotMethod!(void, bool) setAsAudioListener; 104 @GodotName("is_audio_listener") GodotMethod!(bool) isAudioListener; 105 @GodotName("set_as_audio_listener_2d") GodotMethod!(void, bool) setAsAudioListener2d; 106 @GodotName("is_audio_listener_2d") GodotMethod!(bool) isAudioListener2d; 107 @GodotName("set_attach_to_screen_rect") GodotMethod!(void, Rect2) setAttachToScreenRect; 108 @GodotName("get_mouse_position") GodotMethod!(Vector2) getMousePosition; 109 @GodotName("warp_mouse") GodotMethod!(void, Vector2) warpMouse; 110 @GodotName("gui_has_modal_stack") GodotMethod!(bool) guiHasModalStack; 111 @GodotName("gui_get_drag_data") GodotMethod!(Variant) guiGetDragData; 112 @GodotName("gui_is_dragging") GodotMethod!(bool) guiIsDragging; 113 @GodotName("get_modal_stack_top") GodotMethod!(Control) getModalStackTop; 114 @GodotName("set_disable_input") GodotMethod!(void, bool) setDisableInput; 115 @GodotName("is_input_disabled") GodotMethod!(bool) isInputDisabled; 116 @GodotName("set_disable_3d") GodotMethod!(void, bool) setDisable3d; 117 @GodotName("is_3d_disabled") GodotMethod!(bool) is3dDisabled; 118 @GodotName("set_keep_3d_linear") GodotMethod!(void, bool) setKeep3dLinear; 119 @GodotName("get_keep_3d_linear") GodotMethod!(bool) getKeep3dLinear; 120 @GodotName("_gui_show_tooltip") GodotMethod!(void) _guiShowTooltip; 121 @GodotName("_gui_remove_focus") GodotMethod!(void) _guiRemoveFocus; 122 @GodotName("_post_gui_grab_click_focus") GodotMethod!(void) _postGuiGrabClickFocus; 123 @GodotName("set_shadow_atlas_size") GodotMethod!(void, long) setShadowAtlasSize; 124 @GodotName("get_shadow_atlas_size") GodotMethod!(long) getShadowAtlasSize; 125 @GodotName("set_snap_controls_to_pixels") GodotMethod!(void, bool) setSnapControlsToPixels; 126 @GodotName("is_snap_controls_to_pixels_enabled") GodotMethod!(bool) isSnapControlsToPixelsEnabled; 127 @GodotName("set_shadow_atlas_quadrant_subdiv") GodotMethod!(void, long, long) setShadowAtlasQuadrantSubdiv; 128 @GodotName("get_shadow_atlas_quadrant_subdiv") GodotMethod!(Viewport.ShadowAtlasQuadrantSubdiv, long) getShadowAtlasQuadrantSubdiv; 129 @GodotName("_subwindow_visibility_changed") GodotMethod!(void) _subwindowVisibilityChanged; 130 } 131 bool opEquals(in Viewport other) const { return _godot_object.ptr is other._godot_object.ptr; } 132 Viewport opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 133 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 134 mixin baseCasts; 135 static Viewport _new() 136 { 137 static godot_class_constructor constructor; 138 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Viewport"); 139 if(constructor is null) return typeof(this).init; 140 return cast(Viewport)(constructor()); 141 } 142 @disable new(size_t s); 143 /// 144 enum ClearMode : int 145 { 146 /** 147 Always clear the render target before drawing. 148 */ 149 clearModeAlways = 0, 150 /** 151 Never clear the render target. 152 */ 153 clearModeNever = 1, 154 /** 155 Clear the render target next frame, then switch to `CLEAR_MODE_NEVER`. 156 */ 157 clearModeOnlyNextFrame = 2, 158 } 159 /// 160 enum RenderInfo : int 161 { 162 /** 163 Amount of objects in frame. 164 */ 165 renderInfoObjectsInFrame = 0, 166 /** 167 Amount of vertices in frame. 168 */ 169 renderInfoVerticesInFrame = 1, 170 /** 171 Amount of material changes in frame. 172 */ 173 renderInfoMaterialChangesInFrame = 2, 174 /** 175 Amount of shader changes in frame. 176 */ 177 renderInfoShaderChangesInFrame = 3, 178 /** 179 Amount of surface changes in frame. 180 */ 181 renderInfoSurfaceChangesInFrame = 4, 182 /** 183 Amount of draw calls in frame. 184 */ 185 renderInfoDrawCallsInFrame = 5, 186 /** 187 Enum limiter. Do not use it directly. 188 */ 189 renderInfoMax = 6, 190 } 191 /// 192 enum Usage : int 193 { 194 /** 195 196 */ 197 usage2d = 0, 198 /** 199 200 */ 201 usage2dNoSampling = 1, 202 /** 203 204 */ 205 usage3d = 2, 206 /** 207 208 */ 209 usage3dNoEffects = 3, 210 } 211 /// 212 enum DebugDraw : int 213 { 214 /** 215 Objects are displayed normally. 216 */ 217 debugDrawDisabled = 0, 218 /** 219 Objects are displayed without light information. 220 */ 221 debugDrawUnshaded = 1, 222 /** 223 Objected are displayed semi-transparent with additive blending so you can see where they intersect. 224 */ 225 debugDrawOverdraw = 2, 226 /** 227 Objects are displayed in wireframe style. 228 */ 229 debugDrawWireframe = 3, 230 } 231 /// 232 enum ShadowAtlasQuadrantSubdiv : int 233 { 234 /** 235 236 */ 237 shadowAtlasQuadrantSubdivDisabled = 0, 238 /** 239 240 */ 241 shadowAtlasQuadrantSubdiv1 = 1, 242 /** 243 244 */ 245 shadowAtlasQuadrantSubdiv4 = 2, 246 /** 247 248 */ 249 shadowAtlasQuadrantSubdiv16 = 3, 250 /** 251 252 */ 253 shadowAtlasQuadrantSubdiv64 = 4, 254 /** 255 256 */ 257 shadowAtlasQuadrantSubdiv256 = 5, 258 /** 259 260 */ 261 shadowAtlasQuadrantSubdiv1024 = 6, 262 /** 263 Enum limiter. Do not use it directly. 264 */ 265 shadowAtlasQuadrantSubdivMax = 7, 266 } 267 /// 268 enum UpdateMode : int 269 { 270 /** 271 Do not update the render target. 272 */ 273 updateDisabled = 0, 274 /** 275 Update the render target once, then switch to `UPDATE_DISABLED`. 276 */ 277 updateOnce = 1, 278 /** 279 Update the render target only when it is visible. This is the default value. 280 */ 281 updateWhenVisible = 2, 282 /** 283 Always update the render target. 284 */ 285 updateAlways = 3, 286 } 287 /// 288 enum MSAA : int 289 { 290 /** 291 Multisample anti-aliasing mode disabled. This is the default value. 292 */ 293 msaaDisabled = 0, 294 /** 295 296 */ 297 msaa2x = 1, 298 /** 299 300 */ 301 msaa4x = 2, 302 /** 303 304 */ 305 msaa8x = 3, 306 /** 307 308 */ 309 msaa16x = 4, 310 } 311 /// 312 enum Constants : int 313 { 314 debugDrawDisabled = 0, 315 shadowAtlasQuadrantSubdivDisabled = 0, 316 updateDisabled = 0, 317 renderInfoObjectsInFrame = 0, 318 msaaDisabled = 0, 319 clearModeAlways = 0, 320 usage2d = 0, 321 updateOnce = 1, 322 msaa2x = 1, 323 debugDrawUnshaded = 1, 324 renderInfoVerticesInFrame = 1, 325 shadowAtlasQuadrantSubdiv1 = 1, 326 clearModeNever = 1, 327 usage2dNoSampling = 1, 328 debugDrawOverdraw = 2, 329 msaa4x = 2, 330 clearModeOnlyNextFrame = 2, 331 updateWhenVisible = 2, 332 usage3d = 2, 333 renderInfoMaterialChangesInFrame = 2, 334 shadowAtlasQuadrantSubdiv4 = 2, 335 shadowAtlasQuadrantSubdiv16 = 3, 336 msaa8x = 3, 337 renderInfoShaderChangesInFrame = 3, 338 usage3dNoEffects = 3, 339 debugDrawWireframe = 3, 340 updateAlways = 3, 341 shadowAtlasQuadrantSubdiv64 = 4, 342 renderInfoSurfaceChangesInFrame = 4, 343 msaa16x = 4, 344 shadowAtlasQuadrantSubdiv256 = 5, 345 renderInfoDrawCallsInFrame = 5, 346 renderInfoMax = 6, 347 shadowAtlasQuadrantSubdiv1024 = 6, 348 shadowAtlasQuadrantSubdivMax = 7, 349 } 350 /** 351 352 */ 353 void setUseArvr(in bool use) 354 { 355 checkClassBinding!(typeof(this))(); 356 ptrcall!(void)(_classBinding.setUseArvr, _godot_object, use); 357 } 358 /** 359 360 */ 361 bool useArvr() 362 { 363 checkClassBinding!(typeof(this))(); 364 return ptrcall!(bool)(_classBinding.useArvr, _godot_object); 365 } 366 /** 367 368 */ 369 void setSize(in Vector2 size) 370 { 371 checkClassBinding!(typeof(this))(); 372 ptrcall!(void)(_classBinding.setSize, _godot_object, size); 373 } 374 /** 375 376 */ 377 Vector2 getSize() const 378 { 379 checkClassBinding!(typeof(this))(); 380 return ptrcall!(Vector2)(_classBinding.getSize, _godot_object); 381 } 382 /** 383 384 */ 385 void setWorld2d(World2D world_2d) 386 { 387 checkClassBinding!(typeof(this))(); 388 ptrcall!(void)(_classBinding.setWorld2d, _godot_object, world_2d); 389 } 390 /** 391 392 */ 393 Ref!World2D getWorld2d() const 394 { 395 checkClassBinding!(typeof(this))(); 396 return ptrcall!(World2D)(_classBinding.getWorld2d, _godot_object); 397 } 398 /** 399 Returns the 2D world of the viewport. 400 */ 401 Ref!World2D findWorld2d() const 402 { 403 checkClassBinding!(typeof(this))(); 404 return ptrcall!(World2D)(_classBinding.findWorld2d, _godot_object); 405 } 406 /** 407 408 */ 409 void setWorld(World world) 410 { 411 checkClassBinding!(typeof(this))(); 412 ptrcall!(void)(_classBinding.setWorld, _godot_object, world); 413 } 414 /** 415 416 */ 417 Ref!World getWorld() const 418 { 419 checkClassBinding!(typeof(this))(); 420 return ptrcall!(World)(_classBinding.getWorld, _godot_object); 421 } 422 /** 423 Returns the 3D world of the viewport, or if none the world of the parent viewport. 424 */ 425 Ref!World findWorld() const 426 { 427 checkClassBinding!(typeof(this))(); 428 return ptrcall!(World)(_classBinding.findWorld, _godot_object); 429 } 430 /** 431 432 */ 433 void setCanvasTransform(in Transform2D xform) 434 { 435 checkClassBinding!(typeof(this))(); 436 ptrcall!(void)(_classBinding.setCanvasTransform, _godot_object, xform); 437 } 438 /** 439 440 */ 441 Transform2D getCanvasTransform() const 442 { 443 checkClassBinding!(typeof(this))(); 444 return ptrcall!(Transform2D)(_classBinding.getCanvasTransform, _godot_object); 445 } 446 /** 447 448 */ 449 void setGlobalCanvasTransform(in Transform2D xform) 450 { 451 checkClassBinding!(typeof(this))(); 452 ptrcall!(void)(_classBinding.setGlobalCanvasTransform, _godot_object, xform); 453 } 454 /** 455 456 */ 457 Transform2D getGlobalCanvasTransform() const 458 { 459 checkClassBinding!(typeof(this))(); 460 return ptrcall!(Transform2D)(_classBinding.getGlobalCanvasTransform, _godot_object); 461 } 462 /** 463 Returns the total transform of the viewport. 464 */ 465 Transform2D getFinalTransform() const 466 { 467 checkClassBinding!(typeof(this))(); 468 return ptrcall!(Transform2D)(_classBinding.getFinalTransform, _godot_object); 469 } 470 /** 471 Returns the visible rectangle in global screen coordinates. 472 */ 473 Rect2 getVisibleRect() const 474 { 475 checkClassBinding!(typeof(this))(); 476 return ptrcall!(Rect2)(_classBinding.getVisibleRect, _godot_object); 477 } 478 /** 479 480 */ 481 void setTransparentBackground(in bool enable) 482 { 483 checkClassBinding!(typeof(this))(); 484 ptrcall!(void)(_classBinding.setTransparentBackground, _godot_object, enable); 485 } 486 /** 487 488 */ 489 bool hasTransparentBackground() const 490 { 491 checkClassBinding!(typeof(this))(); 492 return ptrcall!(bool)(_classBinding.hasTransparentBackground, _godot_object); 493 } 494 /** 495 496 */ 497 void _vpInput(InputEvent arg0) 498 { 499 Array _GODOT_args = Array.empty_array; 500 _GODOT_args.append(arg0); 501 String _GODOT_method_name = String("_vp_input"); 502 this.callv(_GODOT_method_name, _GODOT_args); 503 } 504 /** 505 506 */ 507 void _vpInputText(StringArg0)(in StringArg0 text) 508 { 509 Array _GODOT_args = Array.empty_array; 510 _GODOT_args.append(text); 511 String _GODOT_method_name = String("_vp_input_text"); 512 this.callv(_GODOT_method_name, _GODOT_args); 513 } 514 /** 515 516 */ 517 void _vpUnhandledInput(InputEvent arg0) 518 { 519 Array _GODOT_args = Array.empty_array; 520 _GODOT_args.append(arg0); 521 String _GODOT_method_name = String("_vp_unhandled_input"); 522 this.callv(_GODOT_method_name, _GODOT_args); 523 } 524 /** 525 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. 526 */ 527 void setSizeOverride(in bool enable, in Vector2 size = Vector2(-1, -1), in Vector2 margin = Vector2(0, 0)) 528 { 529 checkClassBinding!(typeof(this))(); 530 ptrcall!(void)(_classBinding.setSizeOverride, _godot_object, enable, size, margin); 531 } 532 /** 533 Returns the size override set with $(D setSizeOverride). 534 */ 535 Vector2 getSizeOverride() const 536 { 537 checkClassBinding!(typeof(this))(); 538 return ptrcall!(Vector2)(_classBinding.getSizeOverride, _godot_object); 539 } 540 /** 541 Returns `true` if the size override is enabled. See $(D setSizeOverride). 542 */ 543 bool isSizeOverrideEnabled() const 544 { 545 checkClassBinding!(typeof(this))(); 546 return ptrcall!(bool)(_classBinding.isSizeOverrideEnabled, _godot_object); 547 } 548 /** 549 If `true` the size override affects stretch as well. 550 */ 551 void setSizeOverrideStretch(in bool enabled) 552 { 553 checkClassBinding!(typeof(this))(); 554 ptrcall!(void)(_classBinding.setSizeOverrideStretch, _godot_object, enabled); 555 } 556 /** 557 Returns `true` if the size stretch override is enabled. See $(D setSizeOverrideStretch). 558 */ 559 bool isSizeOverrideStretchEnabled() const 560 { 561 checkClassBinding!(typeof(this))(); 562 return ptrcall!(bool)(_classBinding.isSizeOverrideStretchEnabled, _godot_object); 563 } 564 /** 565 566 */ 567 void setVflip(in bool enable) 568 { 569 checkClassBinding!(typeof(this))(); 570 ptrcall!(void)(_classBinding.setVflip, _godot_object, enable); 571 } 572 /** 573 574 */ 575 bool getVflip() const 576 { 577 checkClassBinding!(typeof(this))(); 578 return ptrcall!(bool)(_classBinding.getVflip, _godot_object); 579 } 580 /** 581 582 */ 583 void setClearMode(in long mode) 584 { 585 checkClassBinding!(typeof(this))(); 586 ptrcall!(void)(_classBinding.setClearMode, _godot_object, mode); 587 } 588 /** 589 590 */ 591 Viewport.ClearMode getClearMode() const 592 { 593 checkClassBinding!(typeof(this))(); 594 return ptrcall!(Viewport.ClearMode)(_classBinding.getClearMode, _godot_object); 595 } 596 /** 597 598 */ 599 void setUpdateMode(in long mode) 600 { 601 checkClassBinding!(typeof(this))(); 602 ptrcall!(void)(_classBinding.setUpdateMode, _godot_object, mode); 603 } 604 /** 605 606 */ 607 Viewport.UpdateMode getUpdateMode() const 608 { 609 checkClassBinding!(typeof(this))(); 610 return ptrcall!(Viewport.UpdateMode)(_classBinding.getUpdateMode, _godot_object); 611 } 612 /** 613 614 */ 615 void setMsaa(in long msaa) 616 { 617 checkClassBinding!(typeof(this))(); 618 ptrcall!(void)(_classBinding.setMsaa, _godot_object, msaa); 619 } 620 /** 621 622 */ 623 Viewport.MSAA getMsaa() const 624 { 625 checkClassBinding!(typeof(this))(); 626 return ptrcall!(Viewport.MSAA)(_classBinding.getMsaa, _godot_object); 627 } 628 /** 629 630 */ 631 void setHdr(in bool enable) 632 { 633 checkClassBinding!(typeof(this))(); 634 ptrcall!(void)(_classBinding.setHdr, _godot_object, enable); 635 } 636 /** 637 638 */ 639 bool getHdr() const 640 { 641 checkClassBinding!(typeof(this))(); 642 return ptrcall!(bool)(_classBinding.getHdr, _godot_object); 643 } 644 /** 645 646 */ 647 void setUsage(in long usage) 648 { 649 checkClassBinding!(typeof(this))(); 650 ptrcall!(void)(_classBinding.setUsage, _godot_object, usage); 651 } 652 /** 653 654 */ 655 Viewport.Usage getUsage() const 656 { 657 checkClassBinding!(typeof(this))(); 658 return ptrcall!(Viewport.Usage)(_classBinding.getUsage, _godot_object); 659 } 660 /** 661 662 */ 663 void setDebugDraw(in long debug_draw) 664 { 665 checkClassBinding!(typeof(this))(); 666 ptrcall!(void)(_classBinding.setDebugDraw, _godot_object, debug_draw); 667 } 668 /** 669 670 */ 671 Viewport.DebugDraw getDebugDraw() const 672 { 673 checkClassBinding!(typeof(this))(); 674 return ptrcall!(Viewport.DebugDraw)(_classBinding.getDebugDraw, _godot_object); 675 } 676 /** 677 Returns information about the viewport from the rendering pipeline. 678 */ 679 long getRenderInfo(in long info) 680 { 681 checkClassBinding!(typeof(this))(); 682 return ptrcall!(long)(_classBinding.getRenderInfo, _godot_object, info); 683 } 684 /** 685 Returns the viewport's texture. 686 */ 687 Ref!ViewportTexture getTexture() const 688 { 689 checkClassBinding!(typeof(this))(); 690 return ptrcall!(ViewportTexture)(_classBinding.getTexture, _godot_object); 691 } 692 /** 693 694 */ 695 void setPhysicsObjectPicking(in bool enable) 696 { 697 checkClassBinding!(typeof(this))(); 698 ptrcall!(void)(_classBinding.setPhysicsObjectPicking, _godot_object, enable); 699 } 700 /** 701 702 */ 703 bool getPhysicsObjectPicking() 704 { 705 checkClassBinding!(typeof(this))(); 706 return ptrcall!(bool)(_classBinding.getPhysicsObjectPicking, _godot_object); 707 } 708 /** 709 Returns the viewport's RID from the $(D VisualServer). 710 */ 711 RID getViewportRid() const 712 { 713 checkClassBinding!(typeof(this))(); 714 return ptrcall!(RID)(_classBinding.getViewportRid, _godot_object); 715 } 716 /** 717 718 */ 719 void input(InputEvent local_event) 720 { 721 checkClassBinding!(typeof(this))(); 722 ptrcall!(void)(_classBinding.input, _godot_object, local_event); 723 } 724 /** 725 726 */ 727 void unhandledInput(InputEvent local_event) 728 { 729 checkClassBinding!(typeof(this))(); 730 ptrcall!(void)(_classBinding.unhandledInput, _godot_object, local_event); 731 } 732 /** 733 Forces update of the 2D and 3D worlds. 734 */ 735 void updateWorlds() 736 { 737 checkClassBinding!(typeof(this))(); 738 ptrcall!(void)(_classBinding.updateWorlds, _godot_object); 739 } 740 /** 741 742 */ 743 void setUseOwnWorld(in bool enable) 744 { 745 checkClassBinding!(typeof(this))(); 746 ptrcall!(void)(_classBinding.setUseOwnWorld, _godot_object, enable); 747 } 748 /** 749 750 */ 751 bool isUsingOwnWorld() const 752 { 753 checkClassBinding!(typeof(this))(); 754 return ptrcall!(bool)(_classBinding.isUsingOwnWorld, _godot_object); 755 } 756 /** 757 Returns the active 3D camera. 758 */ 759 Camera getCamera() const 760 { 761 checkClassBinding!(typeof(this))(); 762 return ptrcall!(Camera)(_classBinding.getCamera, _godot_object); 763 } 764 /** 765 766 */ 767 void setAsAudioListener(in bool enable) 768 { 769 checkClassBinding!(typeof(this))(); 770 ptrcall!(void)(_classBinding.setAsAudioListener, _godot_object, enable); 771 } 772 /** 773 774 */ 775 bool isAudioListener() const 776 { 777 checkClassBinding!(typeof(this))(); 778 return ptrcall!(bool)(_classBinding.isAudioListener, _godot_object); 779 } 780 /** 781 782 */ 783 void setAsAudioListener2d(in bool enable) 784 { 785 checkClassBinding!(typeof(this))(); 786 ptrcall!(void)(_classBinding.setAsAudioListener2d, _godot_object, enable); 787 } 788 /** 789 790 */ 791 bool isAudioListener2d() const 792 { 793 checkClassBinding!(typeof(this))(); 794 return ptrcall!(bool)(_classBinding.isAudioListener2d, _godot_object); 795 } 796 /** 797 798 */ 799 void setAttachToScreenRect(in Rect2 rect) 800 { 801 checkClassBinding!(typeof(this))(); 802 ptrcall!(void)(_classBinding.setAttachToScreenRect, _godot_object, rect); 803 } 804 /** 805 Returns the mouse position relative to the viewport. 806 */ 807 Vector2 getMousePosition() const 808 { 809 checkClassBinding!(typeof(this))(); 810 return ptrcall!(Vector2)(_classBinding.getMousePosition, _godot_object); 811 } 812 /** 813 Warps the mouse to a position relative to the viewport. 814 */ 815 void warpMouse(in Vector2 to_position) 816 { 817 checkClassBinding!(typeof(this))(); 818 ptrcall!(void)(_classBinding.warpMouse, _godot_object, to_position); 819 } 820 /** 821 Returns `true` if there are visible modals on-screen. 822 */ 823 bool guiHasModalStack() const 824 { 825 checkClassBinding!(typeof(this))(); 826 return ptrcall!(bool)(_classBinding.guiHasModalStack, _godot_object); 827 } 828 /** 829 Returns the drag data from the GUI, that was previously returned by $(D Control.getDragData). 830 */ 831 Variant guiGetDragData() const 832 { 833 checkClassBinding!(typeof(this))(); 834 return ptrcall!(Variant)(_classBinding.guiGetDragData, _godot_object); 835 } 836 /** 837 838 */ 839 bool guiIsDragging() const 840 { 841 checkClassBinding!(typeof(this))(); 842 return ptrcall!(bool)(_classBinding.guiIsDragging, _godot_object); 843 } 844 /** 845 Returns the topmost modal in the stack. 846 */ 847 Control getModalStackTop() const 848 { 849 checkClassBinding!(typeof(this))(); 850 return ptrcall!(Control)(_classBinding.getModalStackTop, _godot_object); 851 } 852 /** 853 854 */ 855 void setDisableInput(in bool disable) 856 { 857 checkClassBinding!(typeof(this))(); 858 ptrcall!(void)(_classBinding.setDisableInput, _godot_object, disable); 859 } 860 /** 861 862 */ 863 bool isInputDisabled() const 864 { 865 checkClassBinding!(typeof(this))(); 866 return ptrcall!(bool)(_classBinding.isInputDisabled, _godot_object); 867 } 868 /** 869 870 */ 871 void setDisable3d(in bool disable) 872 { 873 checkClassBinding!(typeof(this))(); 874 ptrcall!(void)(_classBinding.setDisable3d, _godot_object, disable); 875 } 876 /** 877 878 */ 879 bool is3dDisabled() const 880 { 881 checkClassBinding!(typeof(this))(); 882 return ptrcall!(bool)(_classBinding.is3dDisabled, _godot_object); 883 } 884 /** 885 886 */ 887 void setKeep3dLinear(in bool keep_3d_linear) 888 { 889 checkClassBinding!(typeof(this))(); 890 ptrcall!(void)(_classBinding.setKeep3dLinear, _godot_object, keep_3d_linear); 891 } 892 /** 893 894 */ 895 bool getKeep3dLinear() const 896 { 897 checkClassBinding!(typeof(this))(); 898 return ptrcall!(bool)(_classBinding.getKeep3dLinear, _godot_object); 899 } 900 /** 901 902 */ 903 void _guiShowTooltip() 904 { 905 Array _GODOT_args = Array.empty_array; 906 String _GODOT_method_name = String("_gui_show_tooltip"); 907 this.callv(_GODOT_method_name, _GODOT_args); 908 } 909 /** 910 911 */ 912 void _guiRemoveFocus() 913 { 914 Array _GODOT_args = Array.empty_array; 915 String _GODOT_method_name = String("_gui_remove_focus"); 916 this.callv(_GODOT_method_name, _GODOT_args); 917 } 918 /** 919 920 */ 921 void _postGuiGrabClickFocus() 922 { 923 Array _GODOT_args = Array.empty_array; 924 String _GODOT_method_name = String("_post_gui_grab_click_focus"); 925 this.callv(_GODOT_method_name, _GODOT_args); 926 } 927 /** 928 929 */ 930 void setShadowAtlasSize(in long size) 931 { 932 checkClassBinding!(typeof(this))(); 933 ptrcall!(void)(_classBinding.setShadowAtlasSize, _godot_object, size); 934 } 935 /** 936 937 */ 938 long getShadowAtlasSize() const 939 { 940 checkClassBinding!(typeof(this))(); 941 return ptrcall!(long)(_classBinding.getShadowAtlasSize, _godot_object); 942 } 943 /** 944 945 */ 946 void setSnapControlsToPixels(in bool enabled) 947 { 948 checkClassBinding!(typeof(this))(); 949 ptrcall!(void)(_classBinding.setSnapControlsToPixels, _godot_object, enabled); 950 } 951 /** 952 953 */ 954 bool isSnapControlsToPixelsEnabled() const 955 { 956 checkClassBinding!(typeof(this))(); 957 return ptrcall!(bool)(_classBinding.isSnapControlsToPixelsEnabled, _godot_object); 958 } 959 /** 960 961 */ 962 void setShadowAtlasQuadrantSubdiv(in long quadrant, in long subdiv) 963 { 964 checkClassBinding!(typeof(this))(); 965 ptrcall!(void)(_classBinding.setShadowAtlasQuadrantSubdiv, _godot_object, quadrant, subdiv); 966 } 967 /** 968 969 */ 970 Viewport.ShadowAtlasQuadrantSubdiv getShadowAtlasQuadrantSubdiv(in long quadrant) const 971 { 972 checkClassBinding!(typeof(this))(); 973 return ptrcall!(Viewport.ShadowAtlasQuadrantSubdiv)(_classBinding.getShadowAtlasQuadrantSubdiv, _godot_object, quadrant); 974 } 975 /** 976 977 */ 978 void _subwindowVisibilityChanged() 979 { 980 Array _GODOT_args = Array.empty_array; 981 String _GODOT_method_name = String("_subwindow_visibility_changed"); 982 this.callv(_GODOT_method_name, _GODOT_args); 983 } 984 /** 985 If `true` the viewport will be used in AR/VR process. Default value: `false`. 986 */ 987 @property bool arvr() 988 { 989 return useArvr(); 990 } 991 /// ditto 992 @property void arvr(bool v) 993 { 994 setUseArvr(v); 995 } 996 /** 997 The width and height of viewport. 998 */ 999 @property Vector2 size() 1000 { 1001 return getSize(); 1002 } 1003 /// ditto 1004 @property void size(Vector2 v) 1005 { 1006 setSize(v); 1007 } 1008 /** 1009 If `true` the viewport will use $(D World) defined in `world` property. Default value: `false`. 1010 */ 1011 @property bool ownWorld() 1012 { 1013 return isUsingOwnWorld(); 1014 } 1015 /// ditto 1016 @property void ownWorld(bool v) 1017 { 1018 setUseOwnWorld(v); 1019 } 1020 /** 1021 The custom $(D World) which can be used as 3D environment source. 1022 */ 1023 @property World world() 1024 { 1025 return getWorld(); 1026 } 1027 /// ditto 1028 @property void world(World v) 1029 { 1030 setWorld(v); 1031 } 1032 /** 1033 The custom $(D World2D) which can be used as 2D environment source. 1034 */ 1035 @property World2D world2d() 1036 { 1037 return getWorld2d(); 1038 } 1039 /// ditto 1040 @property void world2d(World2D v) 1041 { 1042 setWorld2d(v); 1043 } 1044 /** 1045 If `true` the viewport should render its background as transparent. Default value: `false`. 1046 */ 1047 @property bool transparentBg() 1048 { 1049 return hasTransparentBackground(); 1050 } 1051 /// ditto 1052 @property void transparentBg(bool v) 1053 { 1054 setTransparentBackground(v); 1055 } 1056 /** 1057 The multisample anti-aliasing mode. Default value: `MSAA_DISABLED`. 1058 */ 1059 @property Viewport.MSAA msaa() 1060 { 1061 return getMsaa(); 1062 } 1063 /// ditto 1064 @property void msaa(long v) 1065 { 1066 setMsaa(v); 1067 } 1068 /** 1069 If `true` the viewport rendering will receive benefits from High Dynamic Range algorithm. Default value: `true`. 1070 */ 1071 @property bool hdr() 1072 { 1073 return getHdr(); 1074 } 1075 /// ditto 1076 @property void hdr(bool v) 1077 { 1078 setHdr(v); 1079 } 1080 /** 1081 If `true` the viewport will disable 3D rendering. For actual disabling use `usage`. Default value: `false`. 1082 */ 1083 @property bool disable3d() 1084 { 1085 return is3dDisabled(); 1086 } 1087 /// ditto 1088 @property void disable3d(bool v) 1089 { 1090 setDisable3d(v); 1091 } 1092 /** 1093 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. 1094 */ 1095 @property bool keep3dLinear() 1096 { 1097 return getKeep3dLinear(); 1098 } 1099 /// ditto 1100 @property void keep3dLinear(bool v) 1101 { 1102 setKeep3dLinear(v); 1103 } 1104 /** 1105 The rendering mode of viewport. Default value: `USAGE_3D`. 1106 */ 1107 @property Viewport.Usage usage() 1108 { 1109 return getUsage(); 1110 } 1111 /// ditto 1112 @property void usage(long v) 1113 { 1114 setUsage(v); 1115 } 1116 /** 1117 The overlay mode for test rendered geometry in debug purposes. Default value: `DEBUG_DRAW_DISABLED`. 1118 */ 1119 @property Viewport.DebugDraw debugDraw() 1120 { 1121 return getDebugDraw(); 1122 } 1123 /// ditto 1124 @property void debugDraw(long v) 1125 { 1126 setDebugDraw(v); 1127 } 1128 /** 1129 If `true` the result of rendering will be flipped vertically. Default value: `false`. 1130 */ 1131 @property bool renderTargetVFlip() 1132 { 1133 return getVflip(); 1134 } 1135 /// ditto 1136 @property void renderTargetVFlip(bool v) 1137 { 1138 setVflip(v); 1139 } 1140 /** 1141 The clear mode when viewport used as a render target. Default value: `CLEAR_MODE_ALWAYS`. 1142 */ 1143 @property Viewport.ClearMode renderTargetClearMode() 1144 { 1145 return getClearMode(); 1146 } 1147 /// ditto 1148 @property void renderTargetClearMode(long v) 1149 { 1150 setClearMode(v); 1151 } 1152 /** 1153 The update mode when viewport used as a render target. Default value: `UPDATE_WHEN_VISIBLE`. 1154 */ 1155 @property Viewport.UpdateMode renderTargetUpdateMode() 1156 { 1157 return getUpdateMode(); 1158 } 1159 /// ditto 1160 @property void renderTargetUpdateMode(long v) 1161 { 1162 setUpdateMode(v); 1163 } 1164 /** 1165 If `true` the viewport will process 2D audio streams. Default value: `false`. 1166 */ 1167 @property bool audioListenerEnable2d() 1168 { 1169 return isAudioListener2d(); 1170 } 1171 /// ditto 1172 @property void audioListenerEnable2d(bool v) 1173 { 1174 setAsAudioListener2d(v); 1175 } 1176 /** 1177 If `true` the viewport will process 3D audio streams. Default value: `false`. 1178 */ 1179 @property bool audioListenerEnable3d() 1180 { 1181 return isAudioListener(); 1182 } 1183 /// ditto 1184 @property void audioListenerEnable3d(bool v) 1185 { 1186 setAsAudioListener(v); 1187 } 1188 /** 1189 If `true` the objects rendered by viewport become subjects of mouse picking process. Default value: `false`. 1190 */ 1191 @property bool physicsObjectPicking() 1192 { 1193 return getPhysicsObjectPicking(); 1194 } 1195 /// ditto 1196 @property void physicsObjectPicking(bool v) 1197 { 1198 setPhysicsObjectPicking(v); 1199 } 1200 /** 1201 If `true` the viewport will not receive input event. Default value: `false`. 1202 */ 1203 @property bool guiDisableInput() 1204 { 1205 return isInputDisabled(); 1206 } 1207 /// ditto 1208 @property void guiDisableInput(bool v) 1209 { 1210 setDisableInput(v); 1211 } 1212 /** 1213 If `true` the GUI controls on the viewport will lay pixel perfectly. Default value: `true`. 1214 */ 1215 @property bool guiSnapControlsToPixels() 1216 { 1217 return isSnapControlsToPixelsEnabled(); 1218 } 1219 /// ditto 1220 @property void guiSnapControlsToPixels(bool v) 1221 { 1222 setSnapControlsToPixels(v); 1223 } 1224 /** 1225 The resolution of shadow atlas. Both width and height is equal to one value. 1226 */ 1227 @property long shadowAtlasSize() 1228 { 1229 return getShadowAtlasSize(); 1230 } 1231 /// ditto 1232 @property void shadowAtlasSize(long v) 1233 { 1234 setShadowAtlasSize(v); 1235 } 1236 /** 1237 The subdivision amount of first quadrant on shadow atlas. Default value: `SHADOW_ATLAS_QUADRANT_SUBDIV_4`. 1238 */ 1239 @property Viewport.ShadowAtlasQuadrantSubdiv shadowAtlasQuad0() 1240 { 1241 return getShadowAtlasQuadrantSubdiv(0); 1242 } 1243 /// ditto 1244 @property void shadowAtlasQuad0(long v) 1245 { 1246 setShadowAtlasQuadrantSubdiv(0, v); 1247 } 1248 /** 1249 The subdivision amount of second quadrant on shadow atlas. Default value: `SHADOW_ATLAS_QUADRANT_SUBDIV_4`. 1250 */ 1251 @property Viewport.ShadowAtlasQuadrantSubdiv shadowAtlasQuad1() 1252 { 1253 return getShadowAtlasQuadrantSubdiv(1); 1254 } 1255 /// ditto 1256 @property void shadowAtlasQuad1(long v) 1257 { 1258 setShadowAtlasQuadrantSubdiv(1, v); 1259 } 1260 /** 1261 The subdivision amount of third quadrant on shadow atlas. Default value: `SHADOW_ATLAS_QUADRANT_SUBDIV_16`. 1262 */ 1263 @property Viewport.ShadowAtlasQuadrantSubdiv shadowAtlasQuad2() 1264 { 1265 return getShadowAtlasQuadrantSubdiv(2); 1266 } 1267 /// ditto 1268 @property void shadowAtlasQuad2(long v) 1269 { 1270 setShadowAtlasQuadrantSubdiv(2, v); 1271 } 1272 /** 1273 The subdivision amount of fourth quadrant on shadow atlas. Default value: `SHADOW_ATLAS_QUADRANT_SUBDIV_64`. 1274 */ 1275 @property Viewport.ShadowAtlasQuadrantSubdiv shadowAtlasQuad3() 1276 { 1277 return getShadowAtlasQuadrantSubdiv(3); 1278 } 1279 /// ditto 1280 @property void shadowAtlasQuad3(long v) 1281 { 1282 setShadowAtlasQuadrantSubdiv(3, v); 1283 } 1284 /** 1285 The canvas transform of the viewport, useful for changing the on-screen positions of all child $(D CanvasItem)s. This is relative to the global canvas transform of the viewport. 1286 */ 1287 @property Transform2D canvasTransform() 1288 { 1289 return getCanvasTransform(); 1290 } 1291 /// ditto 1292 @property void canvasTransform(Transform2D v) 1293 { 1294 setCanvasTransform(v); 1295 } 1296 /** 1297 The global canvas transform of the viewport. The canvas transform is relative to this. 1298 */ 1299 @property Transform2D globalCanvasTransform() 1300 { 1301 return getGlobalCanvasTransform(); 1302 } 1303 /// ditto 1304 @property void globalCanvasTransform(Transform2D v) 1305 { 1306 setGlobalCanvasTransform(v); 1307 } 1308 }