diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-07-16 11:43:26 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2018-07-16 11:43:49 -0300 |
commit | de910f8c26407ea37b97a94a6fb1a8731d3694c6 (patch) | |
tree | e7728d7d48dd049319a3970d8e3bb2cb4958d15d /drivers/gles2 | |
parent | 9eb082004d9d6f9003ca5c0c64e3d5b10b210e60 (diff) |
Finally figured out how to implement AnimatedTexture properly.
Diffstat (limited to 'drivers/gles2')
-rw-r--r-- | drivers/gles2/rasterizer_canvas_gles2.cpp | 8 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_storage_gles2.cpp | 9 | ||||
-rw-r--r-- | drivers/gles2/rasterizer_storage_gles2.h | 7 |
3 files changed, 24 insertions, 0 deletions
diff --git a/drivers/gles2/rasterizer_canvas_gles2.cpp b/drivers/gles2/rasterizer_canvas_gles2.cpp index d5232a6511..daa421d45c 100644 --- a/drivers/gles2/rasterizer_canvas_gles2.cpp +++ b/drivers/gles2/rasterizer_canvas_gles2.cpp @@ -140,6 +140,10 @@ RasterizerStorageGLES2::Texture *RasterizerCanvasGLES2::_bind_canvas_texture(con texture = texture->get_ptr(); + if (texture->redraw_if_visible) { + VisualServerRaster::redraw_request(); + } + if (texture->render_target) { texture->render_target->used_in_frame = true; } @@ -909,6 +913,10 @@ void RasterizerCanvasGLES2::canvas_render_items(Item *p_item_list, int p_z, cons t = t->get_ptr(); + if (t->redraw_if_visible) { + VisualServerRaster::redraw_request(); + } + glBindTexture(t->target, t->tex_id); } } else { diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index ca39531b0d..b268d4c723 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -674,6 +674,15 @@ void RasterizerStorageGLES2::texture_set_proxy(RID p_texture, RID p_proxy) { } } +void RasterizerStorageGLES2::texture_set_force_redraw_if_visible(RID p_texture, bool p_enable) { + + Texture *texture = texture_owner.getornull(p_texture); + ERR_FAIL_COND(!texture); + + texture->redraw_if_visible = p_enable; + +} + void RasterizerStorageGLES2::texture_set_detect_3d_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata) { // TODO } diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h index df8c2fcf47..b2c8b620a6 100644 --- a/drivers/gles2/rasterizer_storage_gles2.h +++ b/drivers/gles2/rasterizer_storage_gles2.h @@ -176,12 +176,15 @@ public: bool active; GLenum tex_id; + uint16_t stored_cube_sides; RenderTarget *render_target; Ref<Image> images[6]; + bool redraw_if_visible; + Texture() { flags = 0; width = 0; @@ -205,6 +208,8 @@ public: proxy = NULL; render_target = NULL; + + redraw_if_visible = false; } _ALWAYS_INLINE_ Texture *get_ptr() { @@ -264,6 +269,8 @@ public: virtual void texture_set_detect_srgb_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata); virtual void texture_set_detect_normal_callback(RID p_texture, VisualServer::TextureDetectCallback p_callback, void *p_userdata); + virtual void texture_set_force_redraw_if_visible(RID p_texture, bool p_enable); + /* SKY API */ virtual RID sky_create(); |