diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-03-30 12:13:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-30 12:13:32 +0200 |
commit | 60f8df380df7ddc5dde4de4384b488e8a342ce79 (patch) | |
tree | 1330f02fff7c40f8e1448c7f262211f1068e90b7 /modules | |
parent | 398d502cc78a7b2086ea864581a6c0ec0e2a4cb2 (diff) | |
parent | 45f74ceb853a2986acbdb44f7b36b409b4e0cea5 (diff) | |
download | redot-engine-60f8df380df7ddc5dde4de4384b488e8a342ce79.tar.gz |
Merge pull request #59478 from reduz/add-portable-compressed-texture
Diffstat (limited to 'modules')
-rw-r--r-- | modules/basis_universal/register_types.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/modules/basis_universal/register_types.cpp b/modules/basis_universal/register_types.cpp index 8e328a519d..4c2ebe603f 100644 --- a/modules/basis_universal/register_types.cpp +++ b/modules/basis_universal/register_types.cpp @@ -143,12 +143,11 @@ static Vector<uint8_t> basis_universal_packer(const Ref<Image> &p_image, Image:: } #endif // TOOLS_ENABLED -static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { +static Ref<Image> basis_universal_unpacker_ptr(const uint8_t *p_data, int p_size) { Ref<Image> image; - const uint8_t *r = p_buffer.ptr(); - const uint8_t *ptr = r; - int size = p_buffer.size(); + const uint8_t *ptr = p_data; + int size = p_size; basist::transcoder_texture_format format = basist::transcoder_texture_format::cTFTotalTextureFormats; Image::Format imgfmt = Image::FORMAT_MAX; @@ -259,6 +258,14 @@ static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { return image; } +static Ref<Image> basis_universal_unpacker(const Vector<uint8_t> &p_buffer) { + Ref<Image> image; + + const uint8_t *r = p_buffer.ptr(); + int size = p_buffer.size(); + return basis_universal_unpacker_ptr(r, size); +} + void register_basis_universal_types() { #ifdef TOOLS_ENABLED using namespace basisu; @@ -267,6 +274,7 @@ void register_basis_universal_types() { Image::basis_universal_packer = basis_universal_packer; #endif Image::basis_universal_unpacker = basis_universal_unpacker; + Image::basis_universal_unpacker_ptr = basis_universal_unpacker_ptr; } void unregister_basis_universal_types() { @@ -274,4 +282,5 @@ void unregister_basis_universal_types() { Image::basis_universal_packer = nullptr; #endif Image::basis_universal_unpacker = nullptr; + Image::basis_universal_unpacker_ptr = nullptr; } |