2014-02-10 09:10:30 +08:00
|
|
|
/*************************************************************************/
|
|
|
|
/* viewport.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 20:16:55 +08:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 09:10:30 +08:00
|
|
|
/*************************************************************************/
|
2018-01-01 21:40:08 +08:00
|
|
|
/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
|
2014-02-10 09:10:30 +08:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2018-01-05 07:50:27 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
#ifndef VIEWPORT_H
|
|
|
|
#define VIEWPORT_H
|
|
|
|
|
|
|
|
#include "math_2d.h"
|
2017-03-05 23:44:50 +08:00
|
|
|
#include "scene/main/node.h"
|
2014-02-10 09:10:30 +08:00
|
|
|
#include "scene/resources/texture.h"
|
2017-03-05 23:44:50 +08:00
|
|
|
#include "scene/resources/world_2d.h"
|
|
|
|
#include "servers/visual_server.h"
|
2014-02-10 09:10:30 +08:00
|
|
|
/**
|
|
|
|
@author Juan Linietsky <reduzio@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Camera;
|
2016-07-07 07:35:49 +08:00
|
|
|
class Camera2D;
|
2016-03-20 10:10:04 +08:00
|
|
|
class Listener;
|
2016-01-17 09:41:10 +08:00
|
|
|
class Control;
|
|
|
|
class CanvasItem;
|
|
|
|
class Panel;
|
|
|
|
class Label;
|
|
|
|
class Timer;
|
2014-02-10 09:10:30 +08:00
|
|
|
class Viewport;
|
|
|
|
|
2016-10-05 12:26:35 +08:00
|
|
|
class ViewportTexture : public Texture {
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
GDCLASS(ViewportTexture, Texture);
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-01-10 12:04:31 +08:00
|
|
|
NodePath path;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
friend class Viewport;
|
|
|
|
Viewport *vp;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-12-05 02:55:20 +08:00
|
|
|
RID proxy;
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
protected:
|
2017-01-10 12:04:31 +08:00
|
|
|
static void _bind_methods();
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
public:
|
|
|
|
void set_viewport_path_in_scene(const NodePath &p_path);
|
2017-01-10 12:04:31 +08:00
|
|
|
NodePath get_viewport_path_in_scene() const;
|
|
|
|
|
|
|
|
virtual void setup_local_to_scene();
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
virtual int get_width() const;
|
|
|
|
virtual int get_height() const;
|
|
|
|
virtual Size2 get_size() const;
|
|
|
|
virtual RID get_rid() const;
|
|
|
|
|
|
|
|
virtual bool has_alpha() const;
|
|
|
|
|
|
|
|
virtual void set_flags(uint32_t p_flags);
|
|
|
|
virtual uint32_t get_flags() const;
|
|
|
|
|
2017-06-09 11:23:50 +08:00
|
|
|
virtual Ref<Image> get_data() const;
|
|
|
|
|
2017-01-10 12:04:31 +08:00
|
|
|
ViewportTexture();
|
|
|
|
~ViewportTexture();
|
2014-02-10 09:10:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class Viewport : public Node {
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
GDCLASS(Viewport, Node);
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
public:
|
2016-10-04 03:33:42 +08:00
|
|
|
enum UpdateMode {
|
|
|
|
UPDATE_DISABLED,
|
|
|
|
UPDATE_ONCE, //then goes to disabled
|
|
|
|
UPDATE_WHEN_VISIBLE, // default
|
|
|
|
UPDATE_ALWAYS
|
2014-02-10 09:10:30 +08:00
|
|
|
};
|
|
|
|
|
2016-11-10 10:55:06 +08:00
|
|
|
enum ShadowAtlasQuadrantSubdiv {
|
|
|
|
SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED,
|
|
|
|
SHADOW_ATLAS_QUADRANT_SUBDIV_1,
|
|
|
|
SHADOW_ATLAS_QUADRANT_SUBDIV_4,
|
|
|
|
SHADOW_ATLAS_QUADRANT_SUBDIV_16,
|
|
|
|
SHADOW_ATLAS_QUADRANT_SUBDIV_64,
|
|
|
|
SHADOW_ATLAS_QUADRANT_SUBDIV_256,
|
|
|
|
SHADOW_ATLAS_QUADRANT_SUBDIV_1024,
|
|
|
|
SHADOW_ATLAS_QUADRANT_SUBDIV_MAX,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-01-02 09:16:52 +08:00
|
|
|
enum MSAA {
|
|
|
|
MSAA_DISABLED,
|
|
|
|
MSAA_2X,
|
|
|
|
MSAA_4X,
|
|
|
|
MSAA_8X,
|
|
|
|
MSAA_16X,
|
2014-02-10 09:10:30 +08:00
|
|
|
};
|
|
|
|
|
2017-06-09 11:23:50 +08:00
|
|
|
enum Usage {
|
|
|
|
USAGE_2D,
|
|
|
|
USAGE_2D_NO_SAMPLING,
|
|
|
|
USAGE_3D,
|
|
|
|
USAGE_3D_NO_EFFECTS,
|
|
|
|
};
|
|
|
|
|
2017-06-12 02:52:03 +08:00
|
|
|
enum RenderInfo {
|
|
|
|
|
|
|
|
RENDER_INFO_OBJECTS_IN_FRAME,
|
|
|
|
RENDER_INFO_VERTICES_IN_FRAME,
|
|
|
|
RENDER_INFO_MATERIAL_CHANGES_IN_FRAME,
|
|
|
|
RENDER_INFO_SHADER_CHANGES_IN_FRAME,
|
|
|
|
RENDER_INFO_SURFACE_CHANGES_IN_FRAME,
|
|
|
|
RENDER_INFO_DRAW_CALLS_IN_FRAME,
|
|
|
|
RENDER_INFO_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
enum DebugDraw {
|
|
|
|
DEBUG_DRAW_DISABLED,
|
|
|
|
DEBUG_DRAW_UNSHADED,
|
|
|
|
DEBUG_DRAW_OVERDRAW,
|
|
|
|
DEBUG_DRAW_WIREFRAME,
|
|
|
|
};
|
|
|
|
|
2017-08-31 22:01:36 +08:00
|
|
|
enum ClearMode {
|
|
|
|
|
|
|
|
CLEAR_MODE_ALWAYS,
|
|
|
|
CLEAR_MODE_NEVER,
|
|
|
|
CLEAR_MODE_ONLY_NEXT_FRAME
|
|
|
|
};
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
private:
|
2017-03-05 23:44:50 +08:00
|
|
|
friend class ViewportTexture;
|
2016-01-19 06:49:11 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
Viewport *parent;
|
|
|
|
|
2016-03-20 10:10:04 +08:00
|
|
|
Listener *listener;
|
2017-03-05 23:44:50 +08:00
|
|
|
Set<Listener *> listeners;
|
2016-03-20 10:10:04 +08:00
|
|
|
|
2017-04-23 20:10:41 +08:00
|
|
|
bool arvr;
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
Camera *camera;
|
2017-03-05 23:44:50 +08:00
|
|
|
Set<Camera *> cameras;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
|
|
|
RID viewport;
|
|
|
|
RID current_canvas;
|
|
|
|
|
|
|
|
bool audio_listener;
|
2016-03-20 10:10:04 +08:00
|
|
|
RID internal_listener;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
|
|
|
bool audio_listener_2d;
|
2016-03-20 10:10:04 +08:00
|
|
|
RID internal_listener_2d;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-01-11 11:52:51 +08:00
|
|
|
Transform2D canvas_transform;
|
|
|
|
Transform2D global_canvas_transform;
|
|
|
|
Transform2D stretch_transform;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2016-10-04 03:33:42 +08:00
|
|
|
Size2 size;
|
2014-04-15 09:43:44 +08:00
|
|
|
Rect2 to_screen_rect;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2015-09-21 00:03:46 +08:00
|
|
|
RID contact_2d_debug;
|
|
|
|
RID contact_3d_debug_multimesh;
|
|
|
|
RID contact_3d_debug_instance;
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
bool size_override;
|
|
|
|
bool size_override_stretch;
|
|
|
|
Size2 size_override_size;
|
|
|
|
Size2 size_override_margin;
|
|
|
|
|
2014-10-28 09:54:32 +08:00
|
|
|
Rect2 last_vp_rect;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
|
|
|
bool transparent_bg;
|
2016-10-04 03:33:42 +08:00
|
|
|
bool vflip;
|
2017-08-31 22:01:36 +08:00
|
|
|
ClearMode clear_mode;
|
2016-10-04 03:33:42 +08:00
|
|
|
bool filter;
|
|
|
|
bool gen_mipmaps;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-09-07 22:22:07 +08:00
|
|
|
bool snap_controls_to_pixels;
|
|
|
|
|
2014-09-15 22:33:30 +08:00
|
|
|
bool physics_object_picking;
|
2017-05-20 23:38:03 +08:00
|
|
|
List<Ref<InputEvent> > physics_picking_events;
|
2014-09-15 22:33:30 +08:00
|
|
|
ObjectID physics_object_capture;
|
|
|
|
ObjectID physics_object_over;
|
|
|
|
Vector2 physics_last_mousepos;
|
|
|
|
void _test_new_mouseover(ObjectID new_collider);
|
2017-03-05 23:44:50 +08:00
|
|
|
Map<ObjectID, uint64_t> physics_2d_mouseover;
|
2014-09-15 22:33:30 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
Ref<World2D> world_2d;
|
|
|
|
Ref<World> world;
|
2014-04-15 09:43:44 +08:00
|
|
|
Ref<World> own_world;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2014-04-10 11:18:27 +08:00
|
|
|
StringName input_group;
|
|
|
|
StringName gui_input_group;
|
|
|
|
StringName unhandled_input_group;
|
|
|
|
StringName unhandled_key_input_group;
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
void _update_listener();
|
|
|
|
void _update_listener_2d();
|
|
|
|
|
|
|
|
void _propagate_enter_world(Node *p_node);
|
|
|
|
void _propagate_exit_world(Node *p_node);
|
2016-05-11 22:46:08 +08:00
|
|
|
void _propagate_viewport_notification(Node *p_node, int p_what);
|
2014-02-10 09:10:30 +08:00
|
|
|
|
|
|
|
void _update_stretch_transform();
|
|
|
|
void _update_global_transform();
|
|
|
|
|
2016-10-05 12:26:35 +08:00
|
|
|
bool disable_3d;
|
2016-10-04 03:33:42 +08:00
|
|
|
UpdateMode update_mode;
|
|
|
|
RID texture_rid;
|
2017-01-10 12:04:31 +08:00
|
|
|
uint32_t texture_flags;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-06-12 02:52:03 +08:00
|
|
|
DebugDraw debug_draw;
|
|
|
|
|
2017-06-09 11:23:50 +08:00
|
|
|
Usage usage;
|
|
|
|
|
2016-11-10 10:55:06 +08:00
|
|
|
int shadow_atlas_size;
|
|
|
|
ShadowAtlasQuadrantSubdiv shadow_atlas_quadrant_subdiv[4];
|
|
|
|
|
2017-01-02 09:16:52 +08:00
|
|
|
MSAA msaa;
|
|
|
|
bool hdr;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-01-11 05:02:19 +08:00
|
|
|
Ref<ViewportTexture> default_texture;
|
2017-03-05 23:44:50 +08:00
|
|
|
Set<ViewportTexture *> viewport_textures;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2016-01-17 09:41:10 +08:00
|
|
|
struct GUI {
|
|
|
|
// info used when this is a window
|
|
|
|
|
|
|
|
bool key_event_accepted;
|
|
|
|
Control *mouse_focus;
|
2018-03-28 05:41:27 +08:00
|
|
|
Control *mouse_click_grabber;
|
2016-01-17 09:41:10 +08:00
|
|
|
int mouse_focus_button;
|
|
|
|
Control *key_focus;
|
|
|
|
Control *mouse_over;
|
|
|
|
Control *tooltip;
|
|
|
|
Panel *tooltip_popup;
|
|
|
|
Label *tooltip_label;
|
|
|
|
Point2 tooltip_pos;
|
|
|
|
Point2 last_mouse_pos;
|
|
|
|
Point2 drag_accum;
|
|
|
|
bool drag_attempted;
|
|
|
|
Variant drag_data;
|
|
|
|
Control *drag_preview;
|
2016-01-25 21:30:03 +08:00
|
|
|
float tooltip_timer;
|
|
|
|
float tooltip_delay;
|
2017-03-05 23:44:50 +08:00
|
|
|
List<Control *> modal_stack;
|
2017-01-11 11:52:51 +08:00
|
|
|
Transform2D focus_inv_xform;
|
2016-01-17 09:41:10 +08:00
|
|
|
bool subwindow_order_dirty;
|
2017-03-05 23:44:50 +08:00
|
|
|
List<Control *> subwindows;
|
2016-01-17 09:41:10 +08:00
|
|
|
bool roots_order_dirty;
|
2017-03-05 23:44:50 +08:00
|
|
|
List<Control *> roots;
|
2016-10-04 03:33:42 +08:00
|
|
|
int canvas_sort_index; //for sorting items with canvas as root
|
2016-01-17 09:41:10 +08:00
|
|
|
|
|
|
|
GUI();
|
|
|
|
} gui;
|
|
|
|
|
|
|
|
bool disable_input;
|
|
|
|
|
2017-05-20 23:38:03 +08:00
|
|
|
void _gui_call_input(Control *p_control, const Ref<InputEvent> &p_input);
|
2016-01-17 09:41:10 +08:00
|
|
|
void _gui_sort_subwindows();
|
|
|
|
void _gui_sort_roots();
|
|
|
|
void _gui_sort_modal_stack();
|
2017-03-05 23:44:50 +08:00
|
|
|
Control *_gui_find_control(const Point2 &p_global);
|
|
|
|
Control *_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_global, const Transform2D &p_xform, Transform2D &r_inv_xform);
|
2016-01-17 09:41:10 +08:00
|
|
|
|
2017-05-20 23:38:03 +08:00
|
|
|
void _gui_input_event(Ref<InputEvent> p_event);
|
2016-01-17 09:41:10 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
void update_worlds();
|
|
|
|
|
2017-01-11 11:52:51 +08:00
|
|
|
_FORCE_INLINE_ Transform2D _get_input_pre_xform() const;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-05-20 23:38:03 +08:00
|
|
|
void _vp_input(const Ref<InputEvent> &p_ev);
|
2017-03-05 23:44:50 +08:00
|
|
|
void _vp_input_text(const String &p_text);
|
2017-05-20 23:38:03 +08:00
|
|
|
void _vp_unhandled_input(const Ref<InputEvent> &p_ev);
|
|
|
|
Ref<InputEvent> _make_input_local(const Ref<InputEvent> &ev);
|
2016-01-17 09:41:10 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
friend class Control;
|
2016-01-17 09:41:10 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
List<Control *>::Element *_gui_add_root_control(Control *p_control);
|
|
|
|
List<Control *>::Element *_gui_add_subwindow_control(Control *p_control);
|
2016-01-17 09:41:10 +08:00
|
|
|
|
|
|
|
void _gui_set_subwindow_order_dirty();
|
|
|
|
void _gui_set_root_order_dirty();
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
void _gui_remove_modal_control(List<Control *>::Element *MI);
|
|
|
|
void _gui_remove_from_modal_stack(List<Control *>::Element *MI, ObjectID p_prev_focus_owner);
|
|
|
|
void _gui_remove_root_control(List<Control *>::Element *RI);
|
|
|
|
void _gui_remove_subwindow_control(List<Control *>::Element *SI);
|
2016-01-17 09:41:10 +08:00
|
|
|
|
|
|
|
void _gui_cancel_tooltip();
|
|
|
|
void _gui_show_tooltip();
|
|
|
|
|
|
|
|
void _gui_remove_control(Control *p_control);
|
|
|
|
void _gui_hid_control(Control *p_control);
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
void _gui_force_drag(Control *p_base, const Variant &p_data, Control *p_control);
|
|
|
|
void _gui_set_drag_preview(Control *p_base, Control *p_control);
|
2016-01-17 09:41:10 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
bool _gui_is_modal_on_top(const Control *p_control);
|
|
|
|
List<Control *>::Element *_gui_show_modal(Control *p_control);
|
2016-01-17 09:41:10 +08:00
|
|
|
|
|
|
|
void _gui_remove_focus();
|
|
|
|
void _gui_unfocus_control(Control *p_control);
|
2017-03-05 23:44:50 +08:00
|
|
|
bool _gui_control_has_focus(const Control *p_control);
|
|
|
|
void _gui_control_grab_focus(Control *p_control);
|
2016-01-17 09:41:10 +08:00
|
|
|
void _gui_grab_click_focus(Control *p_control);
|
2018-03-28 05:41:27 +08:00
|
|
|
void _post_gui_grab_click_focus();
|
2016-01-17 09:41:10 +08:00
|
|
|
void _gui_accept_event();
|
|
|
|
|
|
|
|
Control *_gui_get_focus_owner();
|
|
|
|
|
2016-09-11 00:29:07 +08:00
|
|
|
Vector2 _get_window_offset() const;
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
bool _gui_drop(Control *p_at_control, Point2 p_at_pos, bool p_just_check);
|
2017-01-24 10:12:08 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
friend class Listener;
|
2016-03-20 10:10:04 +08:00
|
|
|
void _listener_transform_changed_notify();
|
2017-03-05 23:44:50 +08:00
|
|
|
void _listener_set(Listener *p_listener);
|
|
|
|
bool _listener_add(Listener *p_listener); //true if first
|
|
|
|
void _listener_remove(Listener *p_listener);
|
|
|
|
void _listener_make_next_current(Listener *p_exclude);
|
2016-03-20 10:10:04 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
friend class Camera;
|
2014-02-10 09:10:30 +08:00
|
|
|
void _camera_transform_changed_notify();
|
2017-03-05 23:44:50 +08:00
|
|
|
void _camera_set(Camera *p_camera);
|
|
|
|
bool _camera_add(Camera *p_camera); //true if first
|
|
|
|
void _camera_remove(Camera *p_camera);
|
|
|
|
void _camera_make_next_current(Camera *p_exclude);
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2016-03-09 07:00:52 +08:00
|
|
|
protected:
|
2014-02-10 09:10:30 +08:00
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
public:
|
|
|
|
Listener *get_listener() const;
|
|
|
|
Camera *get_camera() const;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-04-23 20:10:41 +08:00
|
|
|
void set_use_arvr(bool p_use_arvr);
|
|
|
|
bool use_arvr();
|
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
void set_as_audio_listener(bool p_enable);
|
|
|
|
bool is_audio_listener() const;
|
|
|
|
|
|
|
|
void set_as_audio_listener_2d(bool p_enable);
|
|
|
|
bool is_audio_listener_2d() const;
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
void set_size(const Size2 &p_size);
|
2016-10-04 03:33:42 +08:00
|
|
|
|
|
|
|
Size2 get_size() const;
|
2014-02-10 09:10:30 +08:00
|
|
|
Rect2 get_visible_rect() const;
|
2017-01-14 22:07:57 +08:00
|
|
|
RID get_viewport_rid() const;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
void set_world(const Ref<World> &p_world);
|
|
|
|
void set_world_2d(const Ref<World2D> &p_world_2d);
|
2014-02-10 09:10:30 +08:00
|
|
|
Ref<World> get_world() const;
|
|
|
|
Ref<World> find_world() const;
|
|
|
|
|
2016-07-14 02:51:38 +08:00
|
|
|
Ref<World2D> get_world_2d() const;
|
2014-02-10 09:10:30 +08:00
|
|
|
Ref<World2D> find_world_2d() const;
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
void set_canvas_transform(const Transform2D &p_transform);
|
2017-01-11 11:52:51 +08:00
|
|
|
Transform2D get_canvas_transform() const;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
void set_global_canvas_transform(const Transform2D &p_transform);
|
2017-01-11 11:52:51 +08:00
|
|
|
Transform2D get_global_canvas_transform() const;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-01-11 11:52:51 +08:00
|
|
|
Transform2D get_final_transform() const;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
|
|
|
void set_transparent_background(bool p_enable);
|
|
|
|
bool has_transparent_background() const;
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
void set_size_override(bool p_enable, const Size2 &p_size = Size2(-1, -1), const Vector2 &p_margin = Vector2());
|
2014-02-10 09:10:30 +08:00
|
|
|
Size2 get_size_override() const;
|
2016-10-04 03:33:42 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
bool is_size_override_enabled() const;
|
|
|
|
void set_size_override_stretch(bool p_enable);
|
|
|
|
bool is_size_override_stretch_enabled() const;
|
|
|
|
|
2016-10-04 03:33:42 +08:00
|
|
|
void set_vflip(bool p_enable);
|
|
|
|
bool get_vflip() const;
|
2014-04-10 11:18:27 +08:00
|
|
|
|
2017-08-31 22:01:36 +08:00
|
|
|
void set_clear_mode(ClearMode p_mode);
|
|
|
|
ClearMode get_clear_mode() const;
|
2014-04-10 11:18:27 +08:00
|
|
|
|
2016-10-04 03:33:42 +08:00
|
|
|
void set_update_mode(UpdateMode p_mode);
|
|
|
|
UpdateMode get_update_mode() const;
|
2016-10-05 12:26:35 +08:00
|
|
|
Ref<ViewportTexture> get_texture() const;
|
2015-02-21 17:35:06 +08:00
|
|
|
|
2016-11-10 10:55:06 +08:00
|
|
|
void set_shadow_atlas_size(int p_size);
|
|
|
|
int get_shadow_atlas_size() const;
|
2014-05-14 12:22:15 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
void set_shadow_atlas_quadrant_subdiv(int p_quadrant, ShadowAtlasQuadrantSubdiv p_subdiv);
|
2016-11-10 10:55:06 +08:00
|
|
|
ShadowAtlasQuadrantSubdiv get_shadow_atlas_quadrant_subdiv(int p_quadrant) const;
|
2014-08-14 21:31:38 +08:00
|
|
|
|
2017-01-02 09:16:52 +08:00
|
|
|
void set_msaa(MSAA p_msaa);
|
|
|
|
MSAA get_msaa() const;
|
2014-02-10 09:10:30 +08:00
|
|
|
|
2017-01-02 09:16:52 +08:00
|
|
|
void set_hdr(bool p_hdr);
|
|
|
|
bool get_hdr() const;
|
2014-10-28 09:54:32 +08:00
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
Vector2 get_camera_coords(const Vector2 &p_viewport_coords) const;
|
2014-10-28 09:54:32 +08:00
|
|
|
Vector2 get_camera_rect_size() const;
|
|
|
|
|
2014-04-15 09:43:44 +08:00
|
|
|
void set_use_own_world(bool p_world);
|
|
|
|
bool is_using_own_world() const;
|
|
|
|
|
2017-05-20 23:38:03 +08:00
|
|
|
void input(const Ref<InputEvent> &p_event);
|
|
|
|
void unhandled_input(const Ref<InputEvent> &p_event);
|
2014-04-10 11:18:27 +08:00
|
|
|
|
2016-01-17 09:41:10 +08:00
|
|
|
void set_disable_input(bool p_disable);
|
|
|
|
bool is_input_disabled() const;
|
|
|
|
|
2016-10-05 12:26:35 +08:00
|
|
|
void set_disable_3d(bool p_disable);
|
|
|
|
bool is_3d_disabled() const;
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
void set_attach_to_screen_rect(const Rect2 &p_rect);
|
2016-10-04 03:33:42 +08:00
|
|
|
Rect2 get_attach_to_screen_rect() const;
|
2014-04-15 09:43:44 +08:00
|
|
|
|
2017-03-29 23:29:38 +08:00
|
|
|
Vector2 get_mouse_position() const;
|
2017-03-05 23:44:50 +08:00
|
|
|
void warp_mouse(const Vector2 &p_pos);
|
2015-02-15 06:22:06 +08:00
|
|
|
|
2014-09-15 22:33:30 +08:00
|
|
|
void set_physics_object_picking(bool p_enable);
|
|
|
|
bool get_physics_object_picking();
|
|
|
|
|
2016-01-17 09:41:10 +08:00
|
|
|
bool gui_has_modal_stack() const;
|
|
|
|
|
2016-05-11 22:46:08 +08:00
|
|
|
Variant gui_get_drag_data() const;
|
2016-06-28 07:14:59 +08:00
|
|
|
Control *get_modal_stack_top() const;
|
2016-01-17 09:41:10 +08:00
|
|
|
|
2016-10-04 03:33:42 +08:00
|
|
|
void gui_reset_canvas_sort_index();
|
|
|
|
int gui_get_canvas_sort_index();
|
|
|
|
|
2016-05-18 05:27:15 +08:00
|
|
|
virtual String get_configuration_warning() const;
|
|
|
|
|
2017-06-09 11:23:50 +08:00
|
|
|
void set_usage(Usage p_usage);
|
|
|
|
Usage get_usage() const;
|
|
|
|
|
2017-06-12 02:52:03 +08:00
|
|
|
void set_debug_draw(DebugDraw p_debug_draw);
|
|
|
|
DebugDraw get_debug_draw() const;
|
|
|
|
|
|
|
|
int get_render_info(RenderInfo p_info);
|
|
|
|
|
2017-09-07 22:22:07 +08:00
|
|
|
void set_snap_controls_to_pixels(bool p_enable);
|
|
|
|
bool is_snap_controls_to_pixels_enabled() const;
|
|
|
|
|
2016-03-09 07:00:52 +08:00
|
|
|
Viewport();
|
2014-02-10 09:10:30 +08:00
|
|
|
~Viewport();
|
|
|
|
};
|
|
|
|
|
2017-03-05 23:44:50 +08:00
|
|
|
VARIANT_ENUM_CAST(Viewport::UpdateMode);
|
|
|
|
VARIANT_ENUM_CAST(Viewport::ShadowAtlasQuadrantSubdiv);
|
|
|
|
VARIANT_ENUM_CAST(Viewport::MSAA);
|
2017-06-09 11:23:50 +08:00
|
|
|
VARIANT_ENUM_CAST(Viewport::Usage);
|
2017-06-12 02:52:03 +08:00
|
|
|
VARIANT_ENUM_CAST(Viewport::DebugDraw);
|
2017-08-31 22:01:36 +08:00
|
|
|
VARIANT_ENUM_CAST(Viewport::ClearMode);
|
2017-06-12 02:52:03 +08:00
|
|
|
VARIANT_ENUM_CAST(Viewport::RenderInfo);
|
2016-11-10 10:55:06 +08:00
|
|
|
|
2014-02-10 09:10:30 +08:00
|
|
|
#endif
|