diff options
Diffstat (limited to 'scene/main/viewport.h')
-rw-r--r-- | scene/main/viewport.h | 124 |
1 files changed, 83 insertions, 41 deletions
diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 2a54aec96a..c4b4948c30 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -48,9 +48,9 @@ class Label; class Timer; class Viewport; -class RenderTargetTexture : public Texture { +class ViewportTexture : public Texture { - OBJ_TYPE( RenderTargetTexture, Texture ); + OBJ_TYPE( ViewportTexture, Texture ); int flags; friend class Viewport; @@ -70,7 +70,7 @@ public: virtual void set_flags(uint32_t p_flags); virtual uint32_t get_flags() const; - RenderTargetTexture(Viewport *p_vp=NULL); + ViewportTexture(Viewport *p_vp=NULL); }; @@ -79,19 +79,39 @@ class Viewport : public Node { OBJ_TYPE( Viewport, Node ); public: - enum RenderTargetUpdateMode { - RENDER_TARGET_UPDATE_DISABLED, - RENDER_TARGET_UPDATE_ONCE, //then goes to disabled - RENDER_TARGET_UPDATE_WHEN_VISIBLE, // default - RENDER_TARGET_UPDATE_ALWAYS + enum UpdateMode { + UPDATE_DISABLED, + UPDATE_ONCE, //then goes to disabled + UPDATE_WHEN_VISIBLE, // default + UPDATE_ALWAYS + }; + + 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, + + }; + + enum MSAA { + MSAA_DISABLED, + MSAA_2X, + MSAA_4X, + MSAA_8X, + MSAA_16X, }; private: -friend class RenderTargetTexture; +friend class ViewportTexture; + - Control *parent_control; Viewport *parent; Listener *listener; @@ -101,7 +121,6 @@ friend class RenderTargetTexture; Set<Camera*> cameras; RID viewport; - RID canvas_item; RID current_canvas; bool audio_listener; @@ -114,15 +133,13 @@ friend class RenderTargetTexture; Matrix32 global_canvas_transform; Matrix32 stretch_transform; - Rect2 rect; + Size2 size; Rect2 to_screen_rect; RID contact_2d_debug; RID contact_3d_debug_multimesh; RID contact_3d_debug_instance; - - bool size_override; bool size_override_stretch; Size2 size_override_size; @@ -131,10 +148,10 @@ friend class RenderTargetTexture; Rect2 last_vp_rect; bool transparent_bg; - bool render_target_vflip; - bool render_target_clear_on_new_frame; - bool render_target_filter; - bool render_target_gen_mipmaps; + bool vflip; + bool clear_on_new_frame; + bool filter; + bool gen_mipmaps; bool physics_object_picking; List<InputEvent> physics_picking_events; @@ -170,10 +187,17 @@ friend class RenderTargetTexture; void _update_stretch_transform(); void _update_global_transform(); - bool render_target; - RenderTargetUpdateMode render_target_update_mode; - RID render_target_texture_rid; - Ref<RenderTargetTexture> render_target_texture; + + bool disable_3d; + UpdateMode update_mode; + RID texture_rid; + Ref<ViewportTexture> texture; + + int shadow_atlas_size; + ShadowAtlasQuadrantSubdiv shadow_atlas_quadrant_subdiv[4]; + + MSAA msaa; + bool hdr; struct GUI { @@ -202,6 +226,7 @@ friend class RenderTargetTexture; List<Control*> subwindows; bool roots_order_dirty; List<Control*> roots; + int canvas_sort_index; //for sorting items with canvas as root GUI(); @@ -299,8 +324,10 @@ public: void set_as_audio_listener_2d(bool p_enable); bool is_audio_listener_2d() const; - void set_rect(const Rect2& p_rect); - Rect2 get_rect() const; + void set_size(const Size2& p_size); + + + Size2 get_size() const; Rect2 get_visible_rect() const; RID get_viewport() const; @@ -327,30 +354,34 @@ public: void set_size_override(bool p_enable,const Size2& p_size=Size2(-1,-1),const Vector2& p_margin=Vector2()); Size2 get_size_override() const; + bool is_size_override_enabled() const; void set_size_override_stretch(bool p_enable); bool is_size_override_stretch_enabled() const; - void set_as_render_target(bool p_enable); - bool is_set_as_render_target() const; + void set_vflip(bool p_enable); + bool get_vflip() const; + + void set_clear_on_new_frame(bool p_enable); + bool get_clear_on_new_frame() const; + void clear(); - void set_render_target_vflip(bool p_enable); - bool get_render_target_vflip() const; - void set_render_target_clear_on_new_frame(bool p_enable); - bool get_render_target_clear_on_new_frame() const; - void render_target_clear(); + void set_update_mode(UpdateMode p_mode); + UpdateMode get_update_mode() const; + Ref<ViewportTexture> get_texture() const; - void set_render_target_filter(bool p_enable); - bool get_render_target_filter() const; + void set_shadow_atlas_size(int p_size); + int get_shadow_atlas_size() const; - void set_render_target_gen_mipmaps(bool p_enable); - bool get_render_target_gen_mipmaps() const; + void set_shadow_atlas_quadrant_subdiv(int p_quadrant,ShadowAtlasQuadrantSubdiv p_subdiv); + ShadowAtlasQuadrantSubdiv get_shadow_atlas_quadrant_subdiv(int p_quadrant) const; - void set_render_target_update_mode(RenderTargetUpdateMode p_mode); - RenderTargetUpdateMode get_render_target_update_mode() const; - Ref<RenderTargetTexture> get_render_target_texture() const; + void set_msaa(MSAA p_msaa); + MSAA get_msaa() const; + void set_hdr(bool p_hdr); + bool get_hdr() const; Vector2 get_camera_coords(const Vector2& p_viewport_coords) const; Vector2 get_camera_rect_size() const; @@ -367,8 +398,11 @@ public: void set_disable_input(bool p_disable); bool is_input_disabled() const; - void set_render_target_to_screen_rect(const Rect2& p_rect); - Rect2 get_render_target_to_screen_rect() const; + void set_disable_3d(bool p_disable); + bool is_3d_disabled() const; + + void set_attach_to_screen_rect(const Rect2& p_rect); + Rect2 get_attach_to_screen_rect() const; Vector2 get_mouse_pos() const; void warp_mouse(const Vector2& p_pos); @@ -381,12 +415,20 @@ public: Variant gui_get_drag_data() const; Control *get_modal_stack_top() const; + void gui_reset_canvas_sort_index(); + int gui_get_canvas_sort_index(); + virtual String get_configuration_warning() const; + + Viewport(); ~Viewport(); }; -VARIANT_ENUM_CAST(Viewport::RenderTargetUpdateMode); +VARIANT_ENUM_CAST( Viewport::UpdateMode ); +VARIANT_ENUM_CAST( Viewport::ShadowAtlasQuadrantSubdiv ); +VARIANT_ENUM_CAST( Viewport::MSAA ); + #endif |