diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-06-11 15:52:03 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-06-11 15:52:03 -0300 |
commit | 4d50c7ad8c77efd304d343edf81a81c596958d7d (patch) | |
tree | 8dd9483ff3f09f5c420f241755c0a49ee42b8edc /servers/visual | |
parent | ec015a32ae4fed154ed6d0bd002c1e653d74a2c3 (diff) |
Restored multiple viewport function, as well as view modes.
Diffstat (limited to 'servers/visual')
-rw-r--r-- | servers/visual/rasterizer.h | 3 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.cpp | 5 | ||||
-rw-r--r-- | servers/visual/visual_server_raster.h | 6 | ||||
-rw-r--r-- | servers/visual/visual_server_viewport.cpp | 21 | ||||
-rw-r--r-- | servers/visual/visual_server_viewport.h | 10 | ||||
-rw-r--r-- | servers/visual/visual_server_wrap_mt.h | 5 |
6 files changed, 50 insertions, 0 deletions
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 236e8b4a0f..87cf6eed8c 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -155,6 +155,7 @@ public: virtual void render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count) = 0; virtual void set_scene_pass(uint64_t p_pass) = 0; + virtual void set_debug_draw_mode(VS::ViewportDebugDraw p_debug_draw) = 0; virtual bool free(RID p_rid) = 0; @@ -498,6 +499,8 @@ public: virtual void update_dirty_resources() = 0; + virtual void set_debug_generate_wireframes(bool p_generate) = 0; + static RasterizerStorage *base_singleton; RasterizerStorage(); virtual ~RasterizerStorage() {} diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index c4f22fdc0b..93c3793819 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -175,6 +175,11 @@ bool VisualServerRaster::has_os_feature(const String &p_feature) const { return VSG::storage->has_os_feature(p_feature); } +void VisualServerRaster::set_debug_generate_wireframes(bool p_generate) { + + VSG::storage->set_debug_generate_wireframes(p_generate); +} + VisualServerRaster::VisualServerRaster() { VSG::canvas = memnew(VisualServerCanvas); diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index f37c4735c7..b4b43a31be 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -595,6 +595,8 @@ public: m_r m_name(m_type1 arg1) { return BINDBASE->m_name(arg1); } #define BIND1RC(m_r, m_name, m_type1) \ m_r m_name(m_type1 arg1) const { return BINDBASE->m_name(arg1); } +#define BIND2R(m_r, m_name, m_type1, m_type2) \ + m_r m_name(m_type1 arg1, m_type2 arg2) { return BINDBASE->m_name(arg1, arg2); } #define BIND2RC(m_r, m_name, m_type1, m_type2) \ m_r m_name(m_type1 arg1, m_type2 arg2) const { return BINDBASE->m_name(arg1, arg2); } #define BIND3RC(m_r, m_name, m_type1, m_type2, m_type3) \ @@ -932,6 +934,9 @@ public: BIND2(viewport_set_hdr, RID, bool) BIND2(viewport_set_usage, RID, ViewportUsage) + BIND2R(int, viewport_get_render_info, RID, ViewportRenderInfo) + BIND2(viewport_set_debug_draw, RID, ViewportDebugDraw) + /* ENVIRONMENT API */ #undef BINDBASE @@ -1130,6 +1135,7 @@ public: virtual bool has_feature(Features p_feature) const; virtual bool has_os_feature(const String &p_feature) const; + virtual void set_debug_generate_wireframes(bool p_generate); VisualServerRaster(); ~VisualServerRaster(); diff --git a/servers/visual/visual_server_viewport.cpp b/servers/visual/visual_server_viewport.cpp index 3292d3feb4..9ab56894e9 100644 --- a/servers/visual/visual_server_viewport.cpp +++ b/servers/visual/visual_server_viewport.cpp @@ -272,6 +272,9 @@ void VisualServerViewport::draw_viewports() { continue; VSG::rasterizer->set_current_render_target(vp->render_target); + + VSG::scene_render->set_debug_draw_mode(vp->debug_draw); + _draw_viewport(vp); if (vp->viewport_to_screen_rect != Rect2()) { @@ -283,6 +286,7 @@ void VisualServerViewport::draw_viewports() { if (vp->update_mode == VS::VIEWPORT_UPDATE_ONCE) { vp->update_mode = VS::VIEWPORT_UPDATE_DISABLED; } + VSG::scene_render->set_debug_draw_mode(VS::VIEWPORT_DEBUG_DRAW_DISABLED); } } @@ -557,6 +561,23 @@ void VisualServerViewport::viewport_set_usage(RID p_viewport, VS::ViewportUsage } } +int VisualServerViewport::viewport_get_render_info(RID p_viewport, VS::ViewportRenderInfo p_info) { + + ERR_FAIL_INDEX_V(p_info, VS::VIEWPORT_RENDER_INFO_MAX, -1); + Viewport *viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND_V(!viewport, -1); + + return viewport->render_info[p_info]; +} + +void VisualServerViewport::viewport_set_debug_draw(RID p_viewport, VS::ViewportDebugDraw p_draw) { + + Viewport *viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->debug_draw = p_draw; +} + bool VisualServerViewport::free(RID p_rid) { if (viewport_owner.owns(p_rid)) { diff --git a/servers/visual/visual_server_viewport.h b/servers/visual/visual_server_viewport.h index ad3bfe9cb8..4d46e39b77 100644 --- a/servers/visual/visual_server_viewport.h +++ b/servers/visual/visual_server_viewport.h @@ -64,6 +64,9 @@ public: RID shadow_atlas; int shadow_atlas_size; + int render_info[VS::VIEWPORT_RENDER_INFO_MAX]; + VS::ViewportDebugDraw debug_draw; + VS::ViewportClearMode clear_mode; bool rendered_in_prev_frame; @@ -103,6 +106,10 @@ public: shadow_atlas_size = 0; disable_3d = false; disable_3d_by_usage = false; + debug_draw = VS::VIEWPORT_DEBUG_DRAW_DISABLED; + for (int i = 0; i < VS::VIEWPORT_RENDER_INFO_MAX; i++) { + render_info[i] = 0; + } } }; @@ -168,6 +175,9 @@ public: void viewport_set_hdr(RID p_viewport, bool p_enabled); void viewport_set_usage(RID p_viewport, VS::ViewportUsage p_usage); + virtual int viewport_get_render_info(RID p_viewport, VS::ViewportRenderInfo p_info); + virtual void viewport_set_debug_draw(RID p_viewport, VS::ViewportDebugDraw p_draw); + void draw_viewports(); bool free(RID p_rid); diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index 7653bf740a..d4f43ac396 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -372,6 +372,9 @@ public: FUNC2(viewport_set_hdr, RID, bool) FUNC2(viewport_set_usage, RID, ViewportUsage) + FUNC2R(int, viewport_get_render_info, RID, ViewportRenderInfo) + FUNC2(viewport_set_debug_draw, RID, ViewportDebugDraw) + /* ENVIRONMENT API */ FUNC0R(RID, environment_create) @@ -552,6 +555,8 @@ public: FUNC0R(RID, get_test_cube) + FUNC1(set_debug_generate_wireframes, bool) + virtual bool has_feature(Features p_feature) const { return visual_server->has_feature(p_feature); } virtual bool has_os_feature(const String &p_feature) const { return visual_server->has_os_feature(p_feature); } |