diff options
Diffstat (limited to 'modules/etc')
-rw-r--r-- | modules/etc/image_etc.cpp | 16 | ||||
-rw-r--r-- | modules/etc/image_etc.h | 4 | ||||
-rw-r--r-- | modules/etc/register_types.cpp | 4 | ||||
-rw-r--r-- | modules/etc/register_types.h | 4 | ||||
-rw-r--r-- | modules/etc/texture_loader_pkm.cpp | 4 | ||||
-rw-r--r-- | modules/etc/texture_loader_pkm.h | 4 |
6 files changed, 24 insertions, 12 deletions
diff --git a/modules/etc/image_etc.cpp b/modules/etc/image_etc.cpp index f0cbf6ae28..b80138c99d 100644 --- a/modules/etc/image_etc.cpp +++ b/modules/etc/image_etc.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -139,6 +139,18 @@ static void _compress_etc(Image *p_img, float p_lossy_quality, bool force_etc1_f return; } + if (force_etc1_format) { + // If VRAM compression is using ETC, but image has alpha, convert to RGBA4444 or LA8 + // This saves space while maintaining the alpha channel + if (detected_channels == Image::DETECTED_RGBA) { + p_img->convert(Image::FORMAT_RGBA4444); + return; + } else if (detected_channels == Image::DETECTED_LA) { + p_img->convert(Image::FORMAT_LA8); + return; + } + } + uint32_t imgw = p_img->get_width(), imgh = p_img->get_height(); Image::Format etc_format = force_etc1_format ? Image::FORMAT_ETC : _get_etc2_mode(detected_channels); diff --git a/modules/etc/image_etc.h b/modules/etc/image_etc.h index 724d06545b..7b4f26e127 100644 --- a/modules/etc/image_etc.h +++ b/modules/etc/image_etc.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/etc/register_types.cpp b/modules/etc/register_types.cpp index 584a1fcce8..26809e0de9 100644 --- a/modules/etc/register_types.cpp +++ b/modules/etc/register_types.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/etc/register_types.h b/modules/etc/register_types.h index 161c37b52f..fac83e7d17 100644 --- a/modules/etc/register_types.h +++ b/modules/etc/register_types.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/etc/texture_loader_pkm.cpp b/modules/etc/texture_loader_pkm.cpp index da6da74025..27c2358306 100644 --- a/modules/etc/texture_loader_pkm.cpp +++ b/modules/etc/texture_loader_pkm.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/etc/texture_loader_pkm.h b/modules/etc/texture_loader_pkm.h index 79c17953fc..3d52a9ea95 100644 --- a/modules/etc/texture_loader_pkm.h +++ b/modules/etc/texture_loader_pkm.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ |