diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-04-14 22:43:44 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-04-14 22:43:44 -0300 |
commit | ec4ef2d2e794819548d731f93728266d31261d71 (patch) | |
tree | 6c2940a9029d07a22288c93684dac19cc39de7ed /servers | |
parent | 162d2ebe4f1a6da2da62ad45c4cbfb161157d31d (diff) |
-Added google play services (needed for some stuff)
-Added new screen resizing options, stretch_2d is removed, new much more flexible ones.
-Fixed bug in viewport (can create more instances in 3d-in-2d demo now)
-Can set android permissions and screen sizes manually in the export settings
-Changed export templates extension to .tpz (too many people unzipped the manually..)
-File dialog now ensures that the proper extension is used (will not allow to save without it)
-Fixed bug that made collision exceptions not work in 2D
Diffstat (limited to 'servers')
-rw-r--r-- | servers/physics_2d/physics_2d_server_sw.cpp | 2 | ||||
-rw-r--r-- | servers/visual/rasterizer.h | 1 | ||||
-rw-r--r-- | servers/visual/rasterizer_dummy.cpp | 8 | ||||
-rw-r--r-- | servers/visual/rasterizer_dummy.h | 3 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 46 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 3 | ||||
-rw-r--r-- | servers/visual/visual_server_wrap_mt.h | 1 | ||||
-rw-r--r-- | servers/visual_server.h | 3 |
8 files changed, 64 insertions, 3 deletions
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index fd1ea579f0..ee29d3aeff 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -770,7 +770,7 @@ void Physics2DServerSW::body_remove_collision_exception(RID p_body, RID p_body_b Body2DSW *body = body_owner.get(p_body); ERR_FAIL_COND(!body); - body->remove_exception(p_body); + body->remove_exception(p_body_b); }; diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 37a846ca72..0b54fec859 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -494,6 +494,7 @@ public: }; virtual void canvas_begin()=0; + virtual void canvas_disable_blending()=0; virtual void canvas_set_opacity(float p_opacity)=0; virtual void canvas_set_blend_mode(VS::MaterialBlendMode p_mode)=0; virtual void canvas_begin_rect(const Matrix32& p_transform)=0;; diff --git a/servers/visual/rasterizer_dummy.cpp b/servers/visual/rasterizer_dummy.cpp index 4fc8f1da8f..bfb427f2e8 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,bool p_transparent_bg) { +void RasterizerDummy::set_render_target(RID p_render_target, bool p_transparent_bg, bool p_vflip) { } @@ -1455,6 +1455,12 @@ void RasterizerDummy::canvas_begin() { } +void RasterizerDummy::canvas_disable_blending() { + + + +} + void RasterizerDummy::canvas_set_opacity(float p_opacity) { diff --git a/servers/visual/rasterizer_dummy.h b/servers/visual/rasterizer_dummy.h index 07a78549f7..e1fa521284 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,bool p_transparent_bg=false); + virtual void set_render_target(RID p_render_target,bool p_transparent_bg=false,bool p_vflip=false); virtual void clear_viewport(const Color& p_color); virtual void capture_viewport(Image* r_capture); @@ -652,6 +652,7 @@ public: /* CANVAS API */ virtual void canvas_begin(); + virtual void canvas_disable_blending(); virtual void canvas_set_opacity(float p_opacity); virtual void canvas_set_blend_mode(VS::MaterialBlendMode p_mode); virtual void canvas_begin_rect(const Matrix32& p_transform); diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index a189fff246..18fd4c9922 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -1145,6 +1145,15 @@ void VisualServerRaster::viewport_set_render_target_vflip(RID p_viewport,bool p_ } +void VisualServerRaster::viewport_set_render_target_to_screen_rect(RID p_viewport,const Rect2& p_rect) { + + Viewport *viewport = viewport_owner.get( p_viewport ); + ERR_FAIL_COND(!viewport); + + viewport->rt_to_screen_rect=p_rect; + +} + bool VisualServerRaster::viewport_get_render_target_vflip(RID p_viewport) const{ const Viewport *viewport = viewport_owner.get( p_viewport ); @@ -5458,6 +5467,8 @@ void VisualServerRaster::_draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_ void VisualServerRaster::_draw_viewports() { //draw viewports for render targets + + List<Viewport*> to_blit; List<Viewport*> to_disable; for(SelfList<Viewport> *E=viewport_update_list.first();E;E=E->next()) { @@ -5472,6 +5483,9 @@ void VisualServerRaster::_draw_viewports() { continue; } + if (vp->rt_to_screen_rect!=Rect2()) + to_blit.push_back(vp); + 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); @@ -5491,6 +5505,38 @@ void VisualServerRaster::_draw_viewports() { to_disable.pop_front(); } + + //draw RTs directly to screen when requested + + for (List<Viewport*>::Element *E=to_blit.front();E;E=E->next()) { + + int window_w = OS::get_singleton()->get_video_mode().width; + int window_h = OS::get_singleton()->get_video_mode().height; + + ViewportRect desired_rect; + desired_rect.x = desired_rect.y = 0; + desired_rect.width = window_w; + desired_rect.height = window_h; + + if ( viewport_rect.x != desired_rect.x || + viewport_rect.y != desired_rect.y || + viewport_rect.width != desired_rect.width || + viewport_rect.height != desired_rect.height ) { + + viewport_rect=desired_rect; + + rasterizer->set_viewport(viewport_rect); + } + + rasterizer->canvas_begin(); + rasterizer->canvas_disable_blending(); + rasterizer->canvas_begin_rect(Matrix32()); + rasterizer->canvas_draw_rect(E->get()->rt_to_screen_rect,0,Rect2(Point2(),E->get()->rt_to_screen_rect.size),E->get()->render_target_texture,Color(1,1,1)); + + } + + + //draw viewports attached to screen for(Map<RID,int>::Element *E=screen_viewports.front();E;E=E->next()) { diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index d8d72b63ea..d3d504a7c6 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -481,6 +481,8 @@ class VisualServerRaster : public VisualServer { RID render_target; RID render_target_texture; + Rect2 rt_to_screen_rect; + bool hide_scenario; bool hide_canvas; bool transparent_bg; @@ -913,6 +915,7 @@ public: 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_set_render_target_to_screen_rect(RID p_viewport,const Rect2& p_rect); 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 4e1094a3a2..c8f00c3786 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -891,6 +891,7 @@ public: FUNC2(viewport_set_render_target_vflip,RID,bool); FUNC1RC(bool,viewport_get_render_target_vflip,RID); + FUNC2(viewport_set_render_target_to_screen_rect,RID,const Rect2&); 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 d2c2046e54..4cf0c96228 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -592,6 +592,7 @@ public: virtual void viewport_attach_to_screen(RID p_viewport,int p_screen=0)=0; virtual void viewport_detach(RID p_viewport)=0; + virtual void viewport_set_render_target_to_screen_rect(RID p_viewport,const Rect2& p_rect)=0; enum RenderTargetUpdateMode { RENDER_TARGET_UPDATE_DISABLED, @@ -611,6 +612,8 @@ public: virtual void viewport_queue_screen_capture(RID p_viewport)=0; virtual Image viewport_get_screen_capture(RID p_viewport) const=0; + + struct ViewportRect { int x,y,width,height; |