summaryrefslogtreecommitdiff
path: root/scene/main/viewport.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main/viewport.h')
-rw-r--r--scene/main/viewport.h51
1 files changed, 36 insertions, 15 deletions
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 7a25f5aa00..bfb52c4b98 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -31,26 +31,26 @@
#ifndef VIEWPORT_H
#define VIEWPORT_H
-#include "core/math/transform_2d.h"
-#include "core/templates/pair.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
-#include "scene/resources/world_2d.h"
-#include "servers/display_server.h"
-#include "servers/rendering_server.h"
+#ifndef _3D_DISABLED
class Camera3D;
-class Camera2D;
+class CollisionObject3D;
class Listener3D;
-class Control;
+class World3D;
+#endif // _3D_DISABLED
+
+class Listener2D;
+class Camera2D;
class CanvasItem;
class CanvasLayer;
-class Panel;
+class Control;
class Label;
-class Timer;
-class Viewport;
-class CollisionObject3D;
class SceneTreeTimer;
+class Viewport;
+class Window;
+class World2D;
class ViewportTexture : public Texture2D {
GDCLASS(ViewportTexture, Texture2D);
@@ -89,6 +89,14 @@ class Viewport : public Node {
GDCLASS(Viewport, Node);
public:
+ enum Scale3D {
+ SCALE_3D_DISABLED,
+ SCALE_3D_75_PERCENT,
+ SCALE_3D_50_PERCENT,
+ SCALE_3D_33_PERCENT,
+ SCALE_3D_25_PERCENT
+ };
+
enum ShadowAtlasQuadrantSubdiv {
SHADOW_ATLAS_QUADRANT_SUBDIV_DISABLED,
SHADOW_ATLAS_QUADRANT_SUBDIV_1,
@@ -105,7 +113,7 @@ public:
MSAA_2X,
MSAA_4X,
MSAA_8X,
- MSAA_16X,
+ // 16x MSAA is not supported due to its high cost and driver bugs.
MSAA_MAX
};
@@ -194,6 +202,7 @@ private:
Viewport *parent = nullptr;
+ Listener2D *listener_2d = nullptr;
Camera2D *camera_2d = nullptr;
Set<CanvasLayer *> canvas_layers;
@@ -409,6 +418,10 @@ private:
bool _gui_drop(Control *p_at_control, Point2 p_at_pos, bool p_just_check);
+ friend class Listener2D;
+ void _listener_2d_set(Listener2D *p_listener);
+ void _listener_2d_remove(Listener2D *p_listener);
+
friend class Camera2D;
void _camera_2d_set(Camera2D *p_camera_2d);
@@ -450,6 +463,7 @@ protected:
public:
uint64_t get_processed_events_count() const { return event_count; }
+ Listener2D *get_listener_2d() const;
Camera2D *get_camera_2d() const;
void set_as_audio_listener_2d(bool p_enable);
bool is_audio_listener_2d() const;
@@ -509,9 +523,9 @@ public:
Vector2 get_camera_coords(const Vector2 &p_viewport_coords) const;
Vector2 get_camera_rect_size() const;
- void input_text(const String &p_text);
- void input(const Ref<InputEvent> &p_event, bool p_local_coords = false);
- void unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coords = false);
+ void push_text_input(const String &p_text);
+ void push_input(const Ref<InputEvent> &p_event, bool p_local_coords = false);
+ void push_unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coords = false);
void set_disable_input(bool p_disable);
bool is_input_disabled() const;
@@ -576,7 +590,9 @@ public:
void pass_mouse_focus_to(Viewport *p_viewport, Control *p_control);
+#ifndef _3D_DISABLED
bool use_xr = false;
+ Scale3D scale_3d = SCALE_3D_DISABLED;
friend class Listener3D;
Listener3D *listener_3d = nullptr;
Set<Listener3D *> listener_3d_set;
@@ -648,6 +664,10 @@ public:
void set_use_xr(bool p_use_xr);
bool is_using_xr();
+ void set_scale_3d(const Scale3D p_scale_3d);
+ Scale3D get_scale_3d() const;
+#endif // _3D_DISABLED
+
Viewport();
~Viewport();
};
@@ -704,6 +724,7 @@ VARIANT_ENUM_CAST(SubViewport::UpdateMode);
VARIANT_ENUM_CAST(Viewport::ShadowAtlasQuadrantSubdiv);
VARIANT_ENUM_CAST(Viewport::MSAA);
VARIANT_ENUM_CAST(Viewport::ScreenSpaceAA);
+VARIANT_ENUM_CAST(Viewport::Scale3D);
VARIANT_ENUM_CAST(Viewport::DebugDraw);
VARIANT_ENUM_CAST(Viewport::SDFScale);
VARIANT_ENUM_CAST(Viewport::SDFOversize);