Merge pull request #12276 from djrm/pr_vp_fixes
Fixed viewport transparent bg when clear mode is enabled.
This commit is contained in:
commit
f3f15965c0
2 changed files with 5 additions and 1 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue