diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-06-17 08:58:57 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-06-17 08:59:43 -0300 |
commit | 9757fc354cc4c1052f7023b2d1613a5333cc0cd2 (patch) | |
tree | c45cafe224b8f28c6c66335c3bae70264c8f1ee5 /servers | |
parent | 569a2b5bd7ad8e2851f4b99147f4463454daffad (diff) |
Fix transparent background rendering, closes #8703
Properly implemented UPDATE_WHEN_VISIBLE mode for viewports
Diffstat (limited to 'servers')
-rw-r--r-- | servers/visual/rasterizer.h | 3 | ||||
-rw-r--r-- | servers/visual/visual_server_viewport.cpp | 4 | ||||
-rw-r--r-- | servers/visual/visual_server_viewport.h | 3 |
3 files changed, 5 insertions, 5 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 75434c5fc5..a722b4744d 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -484,7 +484,8 @@ public: virtual void render_target_set_size(RID p_render_target, int p_width, int p_height) = 0; virtual RID render_target_get_texture(RID p_render_target) const = 0; virtual void render_target_set_flag(RID p_render_target, RenderTargetFlags p_flag, bool p_value) = 0; - virtual bool render_target_renedered_in_frame(RID p_render_target) = 0; + virtual bool render_target_was_used(RID p_render_target) = 0; + virtual void render_target_clear_used(RID p_render_target) = 0; virtual void render_target_set_msaa(RID p_render_target, VS::ViewportMSAA p_msaa) = 0; /* CANVAS SHADOW */ diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index a99b890601..2fbbcd225f 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -266,11 +266,13 @@ void VisualServerViewport::draw_viewports() { ERR_CONTINUE(!vp->render_target.is_valid()); - bool visible = vp->viewport_to_screen_rect != Rect2() || vp->update_mode == VS::VIEWPORT_UPDATE_ALWAYS || vp->update_mode == VS::VIEWPORT_UPDATE_ONCE; + bool visible = vp->viewport_to_screen_rect != Rect2() || vp->update_mode == VS::VIEWPORT_UPDATE_ALWAYS || vp->update_mode == VS::VIEWPORT_UPDATE_ONCE || (vp->update_mode == VS::VIEWPORT_UPDATE_WHEN_VISIBLE && VSG::storage->render_target_was_used(vp->render_target)); if (!visible) continue; + VSG::storage->render_target_clear_used(vp->render_target); + VSG::rasterizer->set_current_render_target(vp->render_target); VSG::scene_render->set_debug_draw_mode(vp->debug_draw); diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h index 4d46e39b77..f963ce4aa3 100644 --- a/servers/visual/visual_server_viewport.h +++ b/servers/visual/visual_server_viewport.h @@ -69,8 +69,6 @@ public: VS::ViewportClearMode clear_mode; - bool rendered_in_prev_frame; - struct CanvasKey { int layer; @@ -100,7 +98,6 @@ public: Viewport() { update_mode = VS::VIEWPORT_UPDATE_WHEN_VISIBLE; clear_mode = VS::VIEWPORT_CLEAR_ALWAYS; - rendered_in_prev_frame = false; disable_environment = false; viewport_to_screen = 0; shadow_atlas_size = 0; |