diff options
-rw-r--r-- | SConstruct | 5 | ||||
-rw-r--r-- | drivers/SCsub | 2 | ||||
-rw-r--r-- | drivers/register_driver_types.cpp | 13 | ||||
-rw-r--r-- | drivers/squish/SCsub | 23 | ||||
-rw-r--r-- | modules/squish/SCsub | 27 | ||||
-rw-r--r-- | modules/squish/config.py | 10 | ||||
-rw-r--r-- | modules/squish/image_compress_squish.cpp (renamed from drivers/squish/image_compress_squish.cpp) | 5 | ||||
-rw-r--r-- | modules/squish/image_compress_squish.h (renamed from drivers/squish/image_compress_squish.h) | 3 | ||||
-rw-r--r-- | modules/squish/register_types.cpp | 42 | ||||
-rw-r--r-- | modules/squish/register_types.h | 32 | ||||
-rw-r--r-- | platform/javascript/detect.py | 3 | ||||
-rw-r--r-- | platform/x11/detect.py | 3 | ||||
-rw-r--r-- | thirdparty/README.md | 12 | ||||
-rw-r--r-- | thirdparty/squish/alpha.cpp (renamed from drivers/squish/alpha.cpp) | 3 | ||||
-rw-r--r-- | thirdparty/squish/alpha.h (renamed from drivers/squish/alpha.h) | 2 | ||||
-rw-r--r-- | thirdparty/squish/clusterfit.cpp (renamed from drivers/squish/clusterfit.cpp) | 0 | ||||
-rw-r--r-- | thirdparty/squish/clusterfit.h (renamed from drivers/squish/clusterfit.h) | 2 | ||||
-rw-r--r-- | thirdparty/squish/colourblock.cpp (renamed from drivers/squish/colourblock.cpp) | 0 | ||||
-rw-r--r-- | thirdparty/squish/colourblock.h (renamed from drivers/squish/colourblock.h) | 2 | ||||
-rw-r--r-- | thirdparty/squish/colourfit.cpp (renamed from drivers/squish/colourfit.cpp) | 0 | ||||
-rw-r--r-- | thirdparty/squish/colourfit.h (renamed from drivers/squish/colourfit.h) | 2 | ||||
-rw-r--r-- | thirdparty/squish/colourset.cpp (renamed from drivers/squish/colourset.cpp) | 0 | ||||
-rw-r--r-- | thirdparty/squish/colourset.h (renamed from drivers/squish/colourset.h) | 2 | ||||
-rw-r--r-- | thirdparty/squish/config.h (renamed from drivers/squish/config.h) | 0 | ||||
-rw-r--r-- | thirdparty/squish/maths.cpp (renamed from drivers/squish/maths.cpp) | 0 | ||||
-rw-r--r-- | thirdparty/squish/maths.h (renamed from drivers/squish/maths.h) | 0 | ||||
-rw-r--r-- | thirdparty/squish/rangefit.cpp (renamed from drivers/squish/rangefit.cpp) | 0 | ||||
-rw-r--r-- | thirdparty/squish/rangefit.h (renamed from drivers/squish/rangefit.h) | 2 | ||||
-rw-r--r-- | thirdparty/squish/simd.h (renamed from drivers/squish/simd.h) | 0 | ||||
-rw-r--r-- | thirdparty/squish/simd_float.h (renamed from drivers/squish/simd_float.h) | 0 | ||||
-rw-r--r-- | thirdparty/squish/simd_sse.h (renamed from drivers/squish/simd_sse.h) | 0 | ||||
-rw-r--r-- | thirdparty/squish/simd_ve.h (renamed from drivers/squish/simd_ve.h) | 0 | ||||
-rw-r--r-- | thirdparty/squish/singlecolourfit.cpp (renamed from drivers/squish/singlecolourfit.cpp) | 5 | ||||
-rw-r--r-- | thirdparty/squish/singlecolourfit.h (renamed from drivers/squish/singlecolourfit.h) | 2 | ||||
-rw-r--r-- | thirdparty/squish/singlecolourlookup.inl (renamed from drivers/squish/singlecolourlookup.inl) | 0 | ||||
-rw-r--r-- | thirdparty/squish/squish.cpp (renamed from drivers/squish/squish.cpp) | 2 | ||||
-rw-r--r-- | thirdparty/squish/squish.h (renamed from drivers/squish/squish.h) | 0 |
37 files changed, 144 insertions, 60 deletions
diff --git a/SConstruct b/SConstruct index 66c066b141..c2fba48f91 100644 --- a/SConstruct +++ b/SConstruct @@ -124,7 +124,7 @@ opts.Add('libvorbis','Ogg Vorbis library for vorbis support (system/builtin)','b opts.Add('libtheora','Theora library for theora module (system/builtin)','builtin') opts.Add('opus','Opus and opusfile library for Opus format support: (system/builtin)','builtin') opts.Add('minizip','Build Minizip Archive Support: (yes/no)','yes') -opts.Add('squish','Squish BC Texture Compression in editor (yes/no)','yes') +opts.Add('squish','Squish library for BC Texture Compression in editor (system/builtin)','builtin') opts.Add('freetype','Freetype support in editor','builtin') opts.Add('xml','XML Save/Load support (yes/no)','yes') opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin') @@ -324,9 +324,6 @@ if selected_platform in platform_list: # to test 64 bits compiltion # env.Append(CPPFLAGS=['-m64']) - if (env_base['squish']=='yes'): - env.Append(CPPFLAGS=['-DSQUISH_ENABLED']); - if (env['tools']=='yes'): env.Append(CPPFLAGS=['-DTOOLS_ENABLED']) if (env['disable_3d']=='yes'): diff --git a/drivers/SCsub b/drivers/SCsub index 8538f2745d..bc0d948f41 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -25,8 +25,6 @@ SConscript("chibi/SCsub"); if (env["tools"]=="yes"): SConscript("convex_decomp/SCsub"); -if (env["squish"]=="yes" and env["tools"]=="yes"): - SConscript("squish/SCsub"); if (env["freetype"]!="no"): SConscript("freetype/SCsub"); diff --git a/drivers/register_driver_types.cpp b/drivers/register_driver_types.cpp index 1999a9a7c9..31d53e0185 100644 --- a/drivers/register_driver_types.cpp +++ b/drivers/register_driver_types.cpp @@ -33,11 +33,6 @@ #include "png/resource_saver_png.h" #include "chibi/event_stream_chibi.h" - -#ifdef TOOLS_ENABLED -#include "squish/image_compress_squish.h" -#endif - #ifdef TOOLS_ENABLED #include "convex_decomp/b2d_decompose.h" #endif @@ -79,14 +74,6 @@ void register_driver_types() { Geometry::_decompose_func=b2d_decompose; #endif -#ifdef TOOLS_ENABLED -#ifdef SQUISH_ENABLED - - Image::set_compress_bc_func(image_compress_squish); - -#endif -#endif - initialize_chibi(); } diff --git a/drivers/squish/SCsub b/drivers/squish/SCsub deleted file mode 100644 index da39dc1ebc..0000000000 --- a/drivers/squish/SCsub +++ /dev/null @@ -1,23 +0,0 @@ -Import('env') - - -squish_sources=[ -'squish/alpha.cpp', -'squish/clusterfit.cpp', -'squish/colourblock.cpp', -'squish/colourfit.cpp', -'squish/colourset.cpp', -'squish/maths.cpp', -'squish/rangefit.cpp', -'squish/singlecolourfit.cpp', -'squish/squish.cpp', -'squish/image_compress_squish.cpp', -] - - -if (env["tools"]=="yes"): - env.drivers_sources+=squish_sources - -#env.add_source_files(env.drivers_sources, squish_sources) - -Export('env') diff --git a/modules/squish/SCsub b/modules/squish/SCsub new file mode 100644 index 0000000000..072921ef64 --- /dev/null +++ b/modules/squish/SCsub @@ -0,0 +1,27 @@ +Import('env') +Import('env_modules') + +env_squish = env_modules.Clone() + +# Thirdparty source files +if (env["squish"] != "system"): # builtin + thirdparty_dir = "#thirdparty/squish/" + thirdparty_sources = [ + "alpha.cpp", + "clusterfit.cpp", + "colourblock.cpp", + "colourfit.cpp", + "colourset.cpp", + "maths.cpp", + "rangefit.cpp", + "singlecolourfit.cpp", + "squish.cpp", + ] + + thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] + + env_squish.add_source_files(env.modules_sources, thirdparty_sources) + env_squish.Append(CPPPATH = [thirdparty_dir]) + +# Godot source files +env_squish.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/squish/config.py b/modules/squish/config.py new file mode 100644 index 0000000000..d28d9c702e --- /dev/null +++ b/modules/squish/config.py @@ -0,0 +1,10 @@ + +def can_build(platform): + return True + +def configure(env): + # Tools only, disabled for non-tools + # TODO: Find a cleaner way to achieve that + if (env["tools"] == "no"): + env["module_squish_enabled"] = "no" + env.disabled_modules.append("squish") diff --git a/drivers/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index 95de83d5a5..ac7c935ceb 100644 --- a/drivers/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -27,9 +27,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "image_compress_squish.h" -#include "squish/squish.h" + #include "print_string.h" +#include <squish.h> + void image_compress_squish(Image *p_image) { int w=p_image->get_width(); @@ -88,4 +90,3 @@ void image_compress_squish(Image *p_image) { p_image->create(p_image->get_width(),p_image->get_height(),p_image->get_mipmaps(),target_format,data); } - diff --git a/drivers/squish/image_compress_squish.h b/modules/squish/image_compress_squish.h index 8c37ac2caa..19dd900674 100644 --- a/drivers/squish/image_compress_squish.h +++ b/modules/squish/image_compress_squish.h @@ -29,11 +29,8 @@ #ifndef IMAGE_COMPRESS_SQUISH_H #define IMAGE_COMPRESS_SQUISH_H - #include "image.h" - void image_compress_squish(Image *p_image); - #endif // IMAGE_COMPRESS_SQUISH_H diff --git a/modules/squish/register_types.cpp b/modules/squish/register_types.cpp new file mode 100644 index 0000000000..9e9621eb64 --- /dev/null +++ b/modules/squish/register_types.cpp @@ -0,0 +1,42 @@ +/*************************************************************************/ +/* register_types.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "register_types.h" + +#ifdef TOOLS_ENABLED + +#include "image_compress_squish.h" + +void register_squish_types() { + + Image::set_compress_bc_func(image_compress_squish); +} + +void unregister_squish_types() {} + +#endif diff --git a/modules/squish/register_types.h b/modules/squish/register_types.h new file mode 100644 index 0000000000..bbde6a44bf --- /dev/null +++ b/modules/squish/register_types.h @@ -0,0 +1,32 @@ +/*************************************************************************/ +/* register_types.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifdef TOOLS_ENABLED +void register_squish_types(); +void unregister_squish_types(); +#endif diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index fce57acc3b..19427eff14 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -26,8 +26,7 @@ def get_flags(): return [ ('tools', 'no'), - ('squish', 'no'), - ('etc1', 'no'), + ('module_etc1_enabled', 'no'), ('module_mpc_enabled', 'no'), ('module_theora_enabled', 'no'), ] diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 7c22bd97ff..90122eef4a 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -154,6 +154,9 @@ def configure(env): if (env["enet"] == "system"): env.ParseConfig('pkg-config libenet --cflags --libs') + if (env["squish"] == "system" and env["tools"] == "yes"): + env.ParseConfig('pkg-config libsquish --cflags --libs') + # Sound and video libraries # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) diff --git a/thirdparty/README.md b/thirdparty/README.md index f3a18df668..a044e6dcdc 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -158,6 +158,18 @@ Files extracted from upstream source: - RtAudio.{cpp,h} +## squish + +- Upstream: https://code.google.com/archive/p/libsquish + and patches from https://github.com/Cavewhere/squish +- Version: 1.11 +- License: MIT + +Files extracted from upstream source: + +- all .cpp, .h and .inl files + + ## theora - Upstream: https://www.theora.org diff --git a/drivers/squish/alpha.cpp b/thirdparty/squish/alpha.cpp index 2ddb7dc28b..2292081e7a 100644 --- a/drivers/squish/alpha.cpp +++ b/thirdparty/squish/alpha.cpp @@ -24,6 +24,7 @@ -------------------------------------------------------------------------- */ #include "alpha.h" +#include <climits> #include <algorithm> namespace squish { @@ -114,7 +115,7 @@ static int FitCodes( u8 const* rgba, int mask, u8 const* codes, u8* indices ) // find the least error and corresponding index int value = rgba[4*i + 3]; - int least = 2147483647; //INT_MAX + int least = INT_MAX; int index = 0; for( int j = 0; j < 8; ++j ) { diff --git a/drivers/squish/alpha.h b/thirdparty/squish/alpha.h index d56fe4d2c6..5736052551 100644 --- a/drivers/squish/alpha.h +++ b/thirdparty/squish/alpha.h @@ -26,7 +26,7 @@ #ifndef SQUISH_ALPHA_H #define SQUISH_ALPHA_H -#include "squish/squish.h" +#include <squish.h> namespace squish { diff --git a/drivers/squish/clusterfit.cpp b/thirdparty/squish/clusterfit.cpp index afea84880c..afea84880c 100644 --- a/drivers/squish/clusterfit.cpp +++ b/thirdparty/squish/clusterfit.cpp diff --git a/drivers/squish/clusterfit.h b/thirdparty/squish/clusterfit.h index 2d2b67103b..17db5d387c 100644 --- a/drivers/squish/clusterfit.h +++ b/thirdparty/squish/clusterfit.h @@ -27,7 +27,7 @@ #ifndef SQUISH_CLUSTERFIT_H #define SQUISH_CLUSTERFIT_H -#include "squish/squish.h" +#include <squish.h> #include "maths.h" #include "simd.h" #include "colourfit.h" diff --git a/drivers/squish/colourblock.cpp b/thirdparty/squish/colourblock.cpp index e6a5788b74..e6a5788b74 100644 --- a/drivers/squish/colourblock.cpp +++ b/thirdparty/squish/colourblock.cpp diff --git a/drivers/squish/colourblock.h b/thirdparty/squish/colourblock.h index 8a25b42a63..df0a47217f 100644 --- a/drivers/squish/colourblock.h +++ b/thirdparty/squish/colourblock.h @@ -26,7 +26,7 @@ #ifndef SQUISH_COLOURBLOCK_H #define SQUISH_COLOURBLOCK_H -#include "squish/squish.h" +#include <squish.h> #include "maths.h" namespace squish { diff --git a/drivers/squish/colourfit.cpp b/thirdparty/squish/colourfit.cpp index dba2b87e81..dba2b87e81 100644 --- a/drivers/squish/colourfit.cpp +++ b/thirdparty/squish/colourfit.cpp diff --git a/drivers/squish/colourfit.h b/thirdparty/squish/colourfit.h index d048b48709..a2d0559a32 100644 --- a/drivers/squish/colourfit.h +++ b/thirdparty/squish/colourfit.h @@ -26,7 +26,7 @@ #ifndef SQUISH_COLOURFIT_H #define SQUISH_COLOURFIT_H -#include "squish/squish.h" +#include <squish.h> #include "maths.h" namespace squish { diff --git a/drivers/squish/colourset.cpp b/thirdparty/squish/colourset.cpp index 97d29d9873..97d29d9873 100644 --- a/drivers/squish/colourset.cpp +++ b/thirdparty/squish/colourset.cpp diff --git a/drivers/squish/colourset.h b/thirdparty/squish/colourset.h index 803e787f5b..dcf56ae28e 100644 --- a/drivers/squish/colourset.h +++ b/thirdparty/squish/colourset.h @@ -26,7 +26,7 @@ #ifndef SQUISH_COLOURSET_H #define SQUISH_COLOURSET_H -#include "squish/squish.h" +#include <squish.h> #include "maths.h" namespace squish { diff --git a/drivers/squish/config.h b/thirdparty/squish/config.h index 7bf3760c26..7bf3760c26 100644 --- a/drivers/squish/config.h +++ b/thirdparty/squish/config.h diff --git a/drivers/squish/maths.cpp b/thirdparty/squish/maths.cpp index 59818a4d2b..59818a4d2b 100644 --- a/drivers/squish/maths.cpp +++ b/thirdparty/squish/maths.cpp diff --git a/drivers/squish/maths.h b/thirdparty/squish/maths.h index 769ae463f7..769ae463f7 100644 --- a/drivers/squish/maths.h +++ b/thirdparty/squish/maths.h diff --git a/drivers/squish/rangefit.cpp b/thirdparty/squish/rangefit.cpp index 5a66436056..5a66436056 100644 --- a/drivers/squish/rangefit.cpp +++ b/thirdparty/squish/rangefit.cpp diff --git a/drivers/squish/rangefit.h b/thirdparty/squish/rangefit.h index 9d74f9c128..795201993a 100644 --- a/drivers/squish/rangefit.h +++ b/thirdparty/squish/rangefit.h @@ -26,7 +26,7 @@ #ifndef SQUISH_RANGEFIT_H #define SQUISH_RANGEFIT_H -#include "squish/squish.h" +#include <squish.h> #include "colourfit.h" #include "maths.h" diff --git a/drivers/squish/simd.h b/thirdparty/squish/simd.h index 22bd10a460..22bd10a460 100644 --- a/drivers/squish/simd.h +++ b/thirdparty/squish/simd.h diff --git a/drivers/squish/simd_float.h b/thirdparty/squish/simd_float.h index e6351b80eb..e6351b80eb 100644 --- a/drivers/squish/simd_float.h +++ b/thirdparty/squish/simd_float.h diff --git a/drivers/squish/simd_sse.h b/thirdparty/squish/simd_sse.h index e584f2a0e5..e584f2a0e5 100644 --- a/drivers/squish/simd_sse.h +++ b/thirdparty/squish/simd_sse.h diff --git a/drivers/squish/simd_ve.h b/thirdparty/squish/simd_ve.h index 9a33955ffc..9a33955ffc 100644 --- a/drivers/squish/simd_ve.h +++ b/thirdparty/squish/simd_ve.h diff --git a/drivers/squish/singlecolourfit.cpp b/thirdparty/squish/singlecolourfit.cpp index ac8be1ad72..bd02cc41ab 100644 --- a/drivers/squish/singlecolourfit.cpp +++ b/thirdparty/squish/singlecolourfit.cpp @@ -26,6 +26,7 @@ #include "singlecolourfit.h" #include "colourset.h" #include "colourblock.h" +#include <climits> namespace squish { @@ -68,7 +69,7 @@ SingleColourFit::SingleColourFit( ColourSet const* colours, int flags ) m_colour[2] = ( u8 )FloatToInt( 255.0f*values->Z(), 255 ); // initialise the best error - m_besterror = 2147483647; //INT_MAX + m_besterror = INT_MAX; } void SingleColourFit::Compress3( void* block ) @@ -130,7 +131,7 @@ void SingleColourFit::Compress4( void* block ) void SingleColourFit::ComputeEndPoints( SingleColourLookup const* const* lookups ) { // check each index combination (endpoint or intermediate) - m_error = 2147483647; //INT_MAX + m_error = INT_MAX; for( int index = 0; index < 2; ++index ) { // check the error for this codebook index diff --git a/drivers/squish/singlecolourfit.h b/thirdparty/squish/singlecolourfit.h index c8dce2a5a0..0388fda028 100644 --- a/drivers/squish/singlecolourfit.h +++ b/thirdparty/squish/singlecolourfit.h @@ -26,7 +26,7 @@ #ifndef SQUISH_SINGLECOLOURFIT_H #define SQUISH_SINGLECOLOURFIT_H -#include "squish/squish.h" +#include <squish.h> #include "colourfit.h" namespace squish { diff --git a/drivers/squish/singlecolourlookup.inl b/thirdparty/squish/singlecolourlookup.inl index f1c95a1028..f1c95a1028 100644 --- a/drivers/squish/singlecolourlookup.inl +++ b/thirdparty/squish/singlecolourlookup.inl diff --git a/drivers/squish/squish.cpp b/thirdparty/squish/squish.cpp index 400a3b0c46..bbe89bfcfe 100644 --- a/drivers/squish/squish.cpp +++ b/thirdparty/squish/squish.cpp @@ -23,7 +23,7 @@ -------------------------------------------------------------------------- */ -#include "squish/squish.h" +#include <squish.h> #include "colourset.h" #include "maths.h" #include "rangefit.h" diff --git a/drivers/squish/squish.h b/thirdparty/squish/squish.h index 5f5ac149d7..5f5ac149d7 100644 --- a/drivers/squish/squish.h +++ b/thirdparty/squish/squish.h |