summaryrefslogtreecommitdiffstats
path: root/modules/gltf
diff options
context:
space:
mode:
authorLyuma <xn.lyuma@gmail.com>2023-08-05 16:52:51 -0700
committerLyuma <xn.lyuma@gmail.com>2023-08-05 16:54:35 -0700
commitf67b6c158ce780641d9174e75441a5ca0ee92444 (patch)
tree50ff6c0c4eaf6abbf5a764995c0bc3e836dbe398 /modules/gltf
parent16a93563bfd3b02ca0a8f6df2026f3a3217f5571 (diff)
downloadredot-engine-f67b6c158ce780641d9174e75441a5ca0ee92444.tar.gz
Use image index instead of texture index for source_images
Diffstat (limited to 'modules/gltf')
-rw-r--r--modules/gltf/gltf_document.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index 572ef44876..9e7611bc5e 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -3400,10 +3400,11 @@ Ref<Texture2D> GLTFDocument::_get_texture(Ref<GLTFState> p_state, const GLTFText
const GLTFImageIndex image = p_state->textures[p_texture]->get_src_image();
ERR_FAIL_INDEX_V(image, p_state->images.size(), Ref<Texture2D>());
if (GLTFState::GLTFHandleBinary(p_state->handle_binary_image) == GLTFState::GLTFHandleBinary::HANDLE_BINARY_EMBED_AS_BASISU) {
+ ERR_FAIL_INDEX_V(image, p_state->source_images.size(), Ref<Texture2D>());
Ref<PortableCompressedTexture2D> portable_texture;
portable_texture.instantiate();
portable_texture->set_keep_compressed_buffer(true);
- Ref<Image> new_img = p_state->source_images[p_texture]->duplicate();
+ Ref<Image> new_img = p_state->source_images[image]->duplicate();
ERR_FAIL_COND_V(new_img.is_null(), Ref<Texture2D>());
new_img->generate_mipmaps();
if (p_texture_types) {