summaryrefslogtreecommitdiff
path: root/servers/visual
diff options
context:
space:
mode:
Diffstat (limited to 'servers/visual')
-rw-r--r--servers/visual/rasterizer.h2
-rw-r--r--servers/visual/rasterizer_dummy.cpp2
-rw-r--r--servers/visual/rasterizer_dummy.h2
-rw-r--r--servers/visual/visual_server_raster.cpp24
-rw-r--r--servers/visual/visual_server_raster.h6
-rw-r--r--servers/visual/visual_server_wrap_mt.h3
6 files changed, 33 insertions, 6 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 83031e981a..37a846ca72 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -444,7 +444,7 @@ public:
virtual void begin_frame()=0;
virtual void set_viewport(const VS::ViewportRect& p_viewport)=0;
- virtual void set_render_target(RID p_render_target)=0;
+ virtual void set_render_target(RID p_render_target,bool p_transparent_bg=false,bool p_vflip=false)=0;
virtual void clear_viewport(const Color& p_color)=0;
virtual void capture_viewport(Image* r_capture)=0;
diff --git a/servers/visual/rasterizer_dummy.cpp b/servers/visual/rasterizer_dummy.cpp
index 694d365d79..4fc8f1da8f 100644
--- a/servers/visual/rasterizer_dummy.cpp
+++ b/servers/visual/rasterizer_dummy.cpp
@@ -1384,7 +1384,7 @@ void RasterizerDummy::set_viewport(const VS::ViewportRect& p_viewport) {
}
-void RasterizerDummy::set_render_target(RID p_render_target) {
+void RasterizerDummy::set_render_target(RID p_render_target,bool p_transparent_bg) {
}
diff --git a/servers/visual/rasterizer_dummy.h b/servers/visual/rasterizer_dummy.h
index 7ae03a1c0b..07a78549f7 100644
--- a/servers/visual/rasterizer_dummy.h
+++ b/servers/visual/rasterizer_dummy.h
@@ -627,7 +627,7 @@ public:
virtual void begin_frame();
virtual void set_viewport(const VS::ViewportRect& p_viewport);
- virtual void set_render_target(RID p_render_target);
+ virtual void set_render_target(RID p_render_target,bool p_transparent_bg=false);
virtual void clear_viewport(const Color& p_color);
virtual void capture_viewport(Image* r_capture);
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 42b8d484b5..a189fff246 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -1136,6 +1136,25 @@ RID VisualServerRaster::viewport_get_render_target_texture(RID p_viewport) const
}
+void VisualServerRaster::viewport_set_render_target_vflip(RID p_viewport,bool p_enable) {
+
+ Viewport *viewport = viewport_owner.get( p_viewport );
+ ERR_FAIL_COND(!viewport);
+
+ viewport->render_target_vflip=p_enable;
+
+}
+
+bool VisualServerRaster::viewport_get_render_target_vflip(RID p_viewport) const{
+
+ const Viewport *viewport = viewport_owner.get( p_viewport );
+ ERR_FAIL_COND_V(!viewport,false);
+
+ return viewport->render_target_vflip;
+
+}
+
+
void VisualServerRaster::viewport_queue_screen_capture(RID p_viewport) {
VS_CHANGED;
@@ -1164,6 +1183,9 @@ void VisualServerRaster::viewport_set_rect(RID p_viewport,const ViewportRect& p_
ERR_FAIL_COND(!viewport);
viewport->rect=p_rect;
+ if (viewport->render_target.is_valid()) {
+ rasterizer->render_target_set_size(viewport->render_target,viewport->rect.width,viewport->rect.height);
+ }
}
@@ -5450,7 +5472,7 @@ void VisualServerRaster::_draw_viewports() {
continue;
}
- rasterizer->set_render_target(vp->render_target);
+ rasterizer->set_render_target(vp->render_target,vp->transparent_bg,vp->render_target_vflip);
_draw_viewport(vp,0,0,vp->rect.width,vp->rect.height);
if ( (vp->queue_capture && vp->render_target_update_mode==RENDER_TARGET_UPDATE_DISABLED) || vp->render_target_update_mode==RENDER_TARGET_UPDATE_ONCE) {
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index f0b3a2d13c..d8d72b63ea 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -484,8 +484,8 @@ class VisualServerRaster : public VisualServer {
bool hide_scenario;
bool hide_canvas;
bool transparent_bg;
-
bool queue_capture;
+ bool render_target_vflip;
Image capture;
bool rendered_in_prev_frame;
@@ -512,7 +512,7 @@ class VisualServerRaster : public VisualServer {
SelfList<Viewport> update_list;
- Viewport() : update_list(this) { transparent_bg=false; render_target_update_mode=RENDER_TARGET_UPDATE_WHEN_VISIBLE; queue_capture=false; rendered_in_prev_frame=false;}
+ Viewport() : update_list(this) { transparent_bg=false; render_target_update_mode=RENDER_TARGET_UPDATE_WHEN_VISIBLE; queue_capture=false; rendered_in_prev_frame=false; render_target_vflip=false;}
};
SelfList<Viewport>::List viewport_update_list;
@@ -911,6 +911,8 @@ public:
virtual void viewport_set_render_target_update_mode(RID p_viewport,RenderTargetUpdateMode p_mode);
virtual RenderTargetUpdateMode viewport_get_render_target_update_mode(RID p_viewport) const;
virtual RID viewport_get_render_target_texture(RID p_viewport) const;
+ virtual void viewport_set_render_target_vflip(RID p_viewport,bool p_enable);
+ virtual bool viewport_get_render_target_vflip(RID p_viewport) const;
virtual void viewport_queue_screen_capture(RID p_viewport);
virtual Image viewport_get_screen_capture(RID p_viewport) const;
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 3a6a3e509a..4e1094a3a2 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -889,6 +889,9 @@ public:
FUNC1RC(RenderTargetUpdateMode,viewport_get_render_target_update_mode,RID);
FUNC1RC(RID,viewport_get_render_target_texture,RID);
+ FUNC2(viewport_set_render_target_vflip,RID,bool);
+ FUNC1RC(bool,viewport_get_render_target_vflip,RID);
+
FUNC1(viewport_queue_screen_capture,RID);
FUNC1RC(Image,viewport_get_screen_capture,RID);