Build squish decompression in runtime

This commit is contained in:
Leon Krause 2018-11-27 18:14:54 +01:00
parent c23710adde
commit 32751e09ac
5 changed files with 7 additions and 10 deletions

View File

@ -1,5 +1,5 @@
def can_build(env, platform):
return env['tools']
return True
def configure(env):
pass

View File

@ -30,8 +30,6 @@
#include "image_compress_squish.h"
#include "core/print_string.h"
#include <squish.h>
void image_decompress_squish(Image *p_image) {
@ -76,6 +74,7 @@ void image_decompress_squish(Image *p_image) {
p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
}
#ifdef TOOLS_ENABLED
void image_compress_squish(Image *p_image, float p_lossy_quality, Image::CompressSource p_source) {
if (p_image->get_format() >= Image::FORMAT_DXT1)
@ -204,3 +203,4 @@ void image_compress_squish(Image *p_image, float p_lossy_quality, Image::Compres
p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data);
}
}
#endif

View File

@ -33,7 +33,9 @@
#include "core/image.h"
#ifdef TOOLS_ENABLED
void image_compress_squish(Image *p_image, float p_lossy_quality, Image::CompressSource p_source);
#endif
void image_decompress_squish(Image *p_image);
#endif // IMAGE_COMPRESS_SQUISH_H

View File

@ -29,17 +29,14 @@
/*************************************************************************/
#include "register_types.h"
#ifdef TOOLS_ENABLED
#include "image_compress_squish.h"
void register_squish_types() {
#ifdef TOOLS_ENABLED
Image::set_compress_bc_func(image_compress_squish);
#endif
Image::_image_decompress_bc = image_decompress_squish;
}
void unregister_squish_types() {}
#endif

View File

@ -28,7 +28,5 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef TOOLS_ENABLED
void register_squish_types();
void unregister_squish_types();
#endif