From edde52c8dea0193111239b6b2f002adcc24ac0c9 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 6 Aug 2018 14:56:06 -0300 Subject: Added proper import support for 3D and Array textures --- drivers/gles3/rasterizer_storage_gles3.cpp | 6 +++++- drivers/gles3/rasterizer_storage_gles3.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/gles3') diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 83792ca19f..a5c81d6c4d 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -622,15 +622,19 @@ void RasterizerStorageGLES3::texture_allocate(RID p_texture, int p_width, int p_ switch (p_type) { case VS::TEXTURE_TYPE_2D: { texture->target = GL_TEXTURE_2D; + texture->images.resize(1); } break; case VS::TEXTURE_TYPE_CUBEMAP: { texture->target = GL_TEXTURE_CUBE_MAP; + texture->images.resize(6); } break; case VS::TEXTURE_TYPE_2D_ARRAY: { texture->target = GL_TEXTURE_2D_ARRAY; + texture->images.resize(p_depth_3d); } break; case VS::TEXTURE_TYPE_3D: { texture->target = GL_TEXTURE_3D; + texture->images.resize(p_depth_3d); } break; } @@ -703,7 +707,7 @@ void RasterizerStorageGLES3::texture_set_data(RID p_texture, const Ref &p bool srgb; if (config.keep_original_textures && !(texture->flags & VS::TEXTURE_FLAG_USED_FOR_STREAMING)) { - texture->images[p_layer] = p_image; + texture->images.write[p_layer] = p_image; } Ref img = _get_gl_image_and_format(p_image, p_image->get_format(), texture->flags, format, internal_format, type, compressed, srgb); diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 5b8b524021..f55c8026ea 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -277,7 +277,7 @@ public: RenderTarget *render_target; - Ref images[6]; + Vector > images; VisualServer::TextureDetectCallback detect_3d; void *detect_3d_ud; -- cgit v1.2.3