summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-04-10 00:18:27 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-04-10 00:18:27 -0300
commit7ea3e8267afaf626256c84a9a3dc61e2954fc6a2 (patch)
tree0aa7588918b814d1781fc94e8b518c7095a0bab7 /servers
parentb4969373b3475799d6b24cdffeda4659c37f0b8a (diff)
-Fixed a few bugs in Viewport
-Made a few demos using Viewport to show it's true power! -Fixed some start-up error messages.
Diffstat (limited to 'servers')
-rw-r--r--servers/audio/audio_server_sw.cpp2
-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
-rw-r--r--servers/visual_server.h3
8 files changed, 37 insertions, 7 deletions
diff --git a/servers/audio/audio_server_sw.cpp b/servers/audio/audio_server_sw.cpp
index 069bc414f9..cb08024851 100644
--- a/servers/audio/audio_server_sw.cpp
+++ b/servers/audio/audio_server_sw.cpp
@@ -927,7 +927,7 @@ AudioServerSW::AudioServerSW(SampleManagerSW *p_sample_manager) {
sample_manager=p_sample_manager;
String interp = GLOBAL_DEF("audio/mixer_interp","linear");
- Globals::get_singleton()->set_custom_property_info("audio/mixer",PropertyInfo(Variant::STRING,"audio/mixer",PROPERTY_HINT_ENUM,"raw,linear,cubic"));
+ Globals::get_singleton()->set_custom_property_info("audio/mixer_interp",PropertyInfo(Variant::STRING,"audio/mixer_interp",PROPERTY_HINT_ENUM,"raw,linear,cubic"));
if (interp=="raw")
mixer_interp=AudioMixerSW::INTERPOLATION_RAW;
else if (interp=="cubic")
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);
diff --git a/servers/visual_server.h b/servers/visual_server.h
index b3922ab4fc..d2c2046e54 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -600,10 +600,13 @@ public:
RENDER_TARGET_UPDATE_ALWAYS
};
+
virtual void viewport_set_as_render_target(RID p_viewport,bool p_enable)=0;
virtual void viewport_set_render_target_update_mode(RID p_viewport,RenderTargetUpdateMode p_mode)=0;
virtual RenderTargetUpdateMode viewport_get_render_target_update_mode(RID p_viewport) const=0;
virtual RID viewport_get_render_target_texture(RID p_viewport) const=0;
+ virtual void viewport_set_render_target_vflip(RID p_viewport,bool p_enable)=0;
+ virtual bool viewport_get_render_target_vflip(RID p_viewport) const=0;
virtual void viewport_queue_screen_capture(RID p_viewport)=0;
virtual Image viewport_get_screen_capture(RID p_viewport) const=0;