summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorDaniel J. Ramirez <djrmuv@gmail.com>2017-10-21 02:06:10 -0500
committerDaniel J. Ramirez <djrmuv@gmail.com>2017-10-21 02:06:10 -0500
commitd67e77e837a63e3900f7dae942d8b58a94a94e0c (patch)
treeb7b77501fae9b7b6cdc6762a77a6de382eae129d /servers
parent8bc96cc14690d78435d3c2fb960d416df41af790 (diff)
Fixed viewport transparent bg when clear mode is enabled.
Diffstat (limited to 'servers')
-rw-r--r--servers/visual/visual_server_viewport.cpp3
-rw-r--r--servers/visual/visual_server_viewport.h3
2 files changed, 5 insertions, 1 deletions
diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp
index 0dca09a5bf..92c431e393 100644
--- a/servers/visual/visual_server_viewport.cpp
+++ b/servers/visual/visual_server_viewport.cpp
@@ -54,7 +54,7 @@ void VisualServerViewport::_draw_viewport(Viewport *p_viewport, ARVRInterface::E
bool can_draw_3d = !p_viewport->disable_3d && !p_viewport->disable_3d_by_usage && VSG::scene->camera_owner.owns(p_viewport->camera);
if (p_viewport->clear_mode != VS::VIEWPORT_CLEAR_NEVER) {
- VSG::rasterizer->clear_render_target(clear_color);
+ VSG::rasterizer->clear_render_target(p_viewport->transparent_bg ? Color(0, 0, 0, 0) : clear_color);
if (p_viewport->clear_mode == VS::VIEWPORT_CLEAR_ONLY_NEXT_FRAME) {
p_viewport->clear_mode = VS::VIEWPORT_CLEAR_NEVER;
}
@@ -504,6 +504,7 @@ void VisualServerViewport::viewport_set_transparent_background(RID p_viewport, b
ERR_FAIL_COND(!viewport);
VSG::storage->render_target_set_flag(viewport->render_target, RasterizerStorage::RENDER_TARGET_TRANSPARENT, p_enabled);
+ viewport->transparent_bg = true;
}
void VisualServerViewport::viewport_set_global_canvas_transform(RID p_viewport, const Transform2D &p_transform) {
diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h
index 8a294a9129..8db6eda133 100644
--- a/servers/visual/visual_server_viewport.h
+++ b/servers/visual/visual_server_viewport.h
@@ -72,6 +72,8 @@ public:
VS::ViewportClearMode clear_mode;
+ bool transparent_bg;
+
struct CanvasKey {
int layer;
@@ -101,6 +103,7 @@ public:
Viewport() {
update_mode = VS::VIEWPORT_UPDATE_WHEN_VISIBLE;
clear_mode = VS::VIEWPORT_CLEAR_ALWAYS;
+ transparent_bg = false;
disable_environment = false;
viewport_to_screen = 0;
shadow_atlas_size = 0;