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.h58
1 files changed, 39 insertions, 19 deletions
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 9c51f404d7..3732f9cfd1 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -37,10 +37,11 @@
#ifndef _3D_DISABLED
class Camera3D;
class CollisionObject3D;
-class Listener3D;
+class AudioListener3D;
class World3D;
#endif // _3D_DISABLED
+class AudioListener2D;
class Camera2D;
class CanvasItem;
class CanvasLayer;
@@ -88,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,
@@ -104,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
};
@@ -193,6 +202,7 @@ private:
Viewport *parent = nullptr;
+ AudioListener2D *audio_listener_2d = nullptr;
Camera2D *camera_2d = nullptr;
Set<CanvasLayer *> canvas_layers;
@@ -200,8 +210,8 @@ private:
RID current_canvas;
RID subwindow_canvas;
- bool audio_listener_2d = false;
- RID internal_listener_2d;
+ bool is_audio_listener_2d_enabled = false;
+ RID internal_audio_listener_2d;
bool override_canvas_transform = false;
@@ -264,7 +274,7 @@ private:
StringName unhandled_input_group;
StringName unhandled_key_input_group;
- void _update_listener_2d();
+ void _update_audio_listener_2d();
bool disable_3d = false;
@@ -408,6 +418,10 @@ private:
bool _gui_drop(Control *p_at_control, Point2 p_at_pos, bool p_just_check);
+ friend class AudioListener2D;
+ void _audio_listener_2d_set(AudioListener2D *p_listener);
+ void _audio_listener_2d_remove(AudioListener2D *p_listener);
+
friend class Camera2D;
void _camera_2d_set(Camera2D *p_camera_2d);
@@ -449,6 +463,7 @@ protected:
public:
uint64_t get_processed_events_count() const { return event_count; }
+ AudioListener2D *get_audio_listener_2d() const;
Camera2D *get_camera_2d() const;
void set_as_audio_listener_2d(bool p_enable);
bool is_audio_listener_2d() const;
@@ -508,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;
@@ -577,20 +592,21 @@ public:
#ifndef _3D_DISABLED
bool use_xr = false;
- friend class Listener3D;
- Listener3D *listener_3d = nullptr;
- Set<Listener3D *> listener_3d_set;
- bool audio_listener_3d = false;
- RID internal_listener_3d;
- Listener3D *get_listener_3d() const;
+ Scale3D scale_3d = SCALE_3D_DISABLED;
+ friend class AudioListener3D;
+ AudioListener3D *audio_listener_3d = nullptr;
+ Set<AudioListener3D *> audio_listener_3d_set;
+ bool is_audio_listener_3d_enabled = false;
+ RID internal_audio_listener_3d;
+ AudioListener3D *get_audio_listener_3d() const;
void set_as_audio_listener_3d(bool p_enable);
bool is_audio_listener_3d() const;
- void _update_listener_3d();
+ void _update_audio_listener_3d();
void _listener_transform_3d_changed_notify();
- void _listener_3d_set(Listener3D *p_listener);
- bool _listener_3d_add(Listener3D *p_listener); //true if first
- void _listener_3d_remove(Listener3D *p_listener);
- void _listener_3d_make_next_current(Listener3D *p_exclude);
+ void _audio_listener_3d_set(AudioListener3D *p_listener);
+ bool _audio_listener_3d_add(AudioListener3D *p_listener); //true if first
+ void _audio_listener_3d_remove(AudioListener3D *p_listener);
+ void _audio_listener_3d_make_next_current(AudioListener3D *p_exclude);
void _collision_object_3d_input_event(CollisionObject3D *p_object, Camera3D *p_camera, const Ref<InputEvent> &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape);
@@ -647,6 +663,9 @@ 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();
@@ -705,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);