squish: Move to a module and split thirdparty lib
This commit is contained in:
parent
8981ff8a84
commit
8311a78df5
|
@ -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('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('opus','Opus and opusfile library for Opus format support: (system/builtin)','builtin')
|
||||||
opts.Add('minizip','Build Minizip Archive Support: (yes/no)','yes')
|
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('freetype','Freetype support in editor','builtin')
|
||||||
opts.Add('xml','XML Save/Load support (yes/no)','yes')
|
opts.Add('xml','XML Save/Load support (yes/no)','yes')
|
||||||
opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin')
|
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
|
# to test 64 bits compiltion
|
||||||
# env.Append(CPPFLAGS=['-m64'])
|
# env.Append(CPPFLAGS=['-m64'])
|
||||||
|
|
||||||
if (env_base['squish']=='yes'):
|
|
||||||
env.Append(CPPFLAGS=['-DSQUISH_ENABLED']);
|
|
||||||
|
|
||||||
if (env['tools']=='yes'):
|
if (env['tools']=='yes'):
|
||||||
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
|
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
|
||||||
if (env['disable_3d']=='yes'):
|
if (env['disable_3d']=='yes'):
|
||||||
|
|
|
@ -25,8 +25,6 @@ SConscript("chibi/SCsub");
|
||||||
if (env["tools"]=="yes"):
|
if (env["tools"]=="yes"):
|
||||||
SConscript("convex_decomp/SCsub");
|
SConscript("convex_decomp/SCsub");
|
||||||
|
|
||||||
if (env["squish"]=="yes" and env["tools"]=="yes"):
|
|
||||||
SConscript("squish/SCsub");
|
|
||||||
if (env["freetype"]!="no"):
|
if (env["freetype"]!="no"):
|
||||||
SConscript("freetype/SCsub");
|
SConscript("freetype/SCsub");
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,6 @@
|
||||||
#include "png/resource_saver_png.h"
|
#include "png/resource_saver_png.h"
|
||||||
#include "chibi/event_stream_chibi.h"
|
#include "chibi/event_stream_chibi.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
|
||||||
#include "squish/image_compress_squish.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
#include "convex_decomp/b2d_decompose.h"
|
#include "convex_decomp/b2d_decompose.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,14 +74,6 @@ void register_driver_types() {
|
||||||
Geometry::_decompose_func=b2d_decompose;
|
Geometry::_decompose_func=b2d_decompose;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
|
||||||
#ifdef SQUISH_ENABLED
|
|
||||||
|
|
||||||
Image::set_compress_bc_func(image_compress_squish);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
initialize_chibi();
|
initialize_chibi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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')
|
|
|
@ -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")
|
|
@ -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")
|
|
@ -27,9 +27,11 @@
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#include "image_compress_squish.h"
|
#include "image_compress_squish.h"
|
||||||
#include "squish/squish.h"
|
|
||||||
#include "print_string.h"
|
#include "print_string.h"
|
||||||
|
|
||||||
|
#include <squish.h>
|
||||||
|
|
||||||
void image_compress_squish(Image *p_image) {
|
void image_compress_squish(Image *p_image) {
|
||||||
|
|
||||||
int w=p_image->get_width();
|
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);
|
p_image->create(p_image->get_width(),p_image->get_height(),p_image->get_mipmaps(),target_format,data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,8 @@
|
||||||
#ifndef IMAGE_COMPRESS_SQUISH_H
|
#ifndef IMAGE_COMPRESS_SQUISH_H
|
||||||
#define IMAGE_COMPRESS_SQUISH_H
|
#define IMAGE_COMPRESS_SQUISH_H
|
||||||
|
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
|
|
||||||
|
|
||||||
void image_compress_squish(Image *p_image);
|
void image_compress_squish(Image *p_image);
|
||||||
|
|
||||||
|
|
||||||
#endif // IMAGE_COMPRESS_SQUISH_H
|
#endif // IMAGE_COMPRESS_SQUISH_H
|
|
@ -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
|
|
@ -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
|
|
@ -26,8 +26,7 @@ def get_flags():
|
||||||
|
|
||||||
return [
|
return [
|
||||||
('tools', 'no'),
|
('tools', 'no'),
|
||||||
('squish', 'no'),
|
('module_etc1_enabled', 'no'),
|
||||||
('etc1', 'no'),
|
|
||||||
('module_mpc_enabled', 'no'),
|
('module_mpc_enabled', 'no'),
|
||||||
('module_theora_enabled', 'no'),
|
('module_theora_enabled', 'no'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -154,6 +154,9 @@ def configure(env):
|
||||||
if (env["enet"] == "system"):
|
if (env["enet"] == "system"):
|
||||||
env.ParseConfig('pkg-config libenet --cflags --libs')
|
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
|
# Sound and video libraries
|
||||||
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
|
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,18 @@ Files extracted from upstream source:
|
||||||
- RtAudio.{cpp,h}
|
- 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
|
## theora
|
||||||
|
|
||||||
- Upstream: https://www.theora.org
|
- Upstream: https://www.theora.org
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "alpha.h"
|
#include "alpha.h"
|
||||||
|
#include <climits>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace squish {
|
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
|
// find the least error and corresponding index
|
||||||
int value = rgba[4*i + 3];
|
int value = rgba[4*i + 3];
|
||||||
int least = 2147483647; //INT_MAX
|
int least = INT_MAX;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for( int j = 0; j < 8; ++j )
|
for( int j = 0; j < 8; ++j )
|
||||||
{
|
{
|
|
@ -26,7 +26,7 @@
|
||||||
#ifndef SQUISH_ALPHA_H
|
#ifndef SQUISH_ALPHA_H
|
||||||
#define SQUISH_ALPHA_H
|
#define SQUISH_ALPHA_H
|
||||||
|
|
||||||
#include "squish/squish.h"
|
#include <squish.h>
|
||||||
|
|
||||||
namespace squish {
|
namespace squish {
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#ifndef SQUISH_CLUSTERFIT_H
|
#ifndef SQUISH_CLUSTERFIT_H
|
||||||
#define SQUISH_CLUSTERFIT_H
|
#define SQUISH_CLUSTERFIT_H
|
||||||
|
|
||||||
#include "squish/squish.h"
|
#include <squish.h>
|
||||||
#include "maths.h"
|
#include "maths.h"
|
||||||
#include "simd.h"
|
#include "simd.h"
|
||||||
#include "colourfit.h"
|
#include "colourfit.h"
|
|
@ -26,7 +26,7 @@
|
||||||
#ifndef SQUISH_COLOURBLOCK_H
|
#ifndef SQUISH_COLOURBLOCK_H
|
||||||
#define SQUISH_COLOURBLOCK_H
|
#define SQUISH_COLOURBLOCK_H
|
||||||
|
|
||||||
#include "squish/squish.h"
|
#include <squish.h>
|
||||||
#include "maths.h"
|
#include "maths.h"
|
||||||
|
|
||||||
namespace squish {
|
namespace squish {
|
|
@ -26,7 +26,7 @@
|
||||||
#ifndef SQUISH_COLOURFIT_H
|
#ifndef SQUISH_COLOURFIT_H
|
||||||
#define SQUISH_COLOURFIT_H
|
#define SQUISH_COLOURFIT_H
|
||||||
|
|
||||||
#include "squish/squish.h"
|
#include <squish.h>
|
||||||
#include "maths.h"
|
#include "maths.h"
|
||||||
|
|
||||||
namespace squish {
|
namespace squish {
|
|
@ -26,7 +26,7 @@
|
||||||
#ifndef SQUISH_COLOURSET_H
|
#ifndef SQUISH_COLOURSET_H
|
||||||
#define SQUISH_COLOURSET_H
|
#define SQUISH_COLOURSET_H
|
||||||
|
|
||||||
#include "squish/squish.h"
|
#include <squish.h>
|
||||||
#include "maths.h"
|
#include "maths.h"
|
||||||
|
|
||||||
namespace squish {
|
namespace squish {
|
|
@ -26,7 +26,7 @@
|
||||||
#ifndef SQUISH_RANGEFIT_H
|
#ifndef SQUISH_RANGEFIT_H
|
||||||
#define SQUISH_RANGEFIT_H
|
#define SQUISH_RANGEFIT_H
|
||||||
|
|
||||||
#include "squish/squish.h"
|
#include <squish.h>
|
||||||
#include "colourfit.h"
|
#include "colourfit.h"
|
||||||
#include "maths.h"
|
#include "maths.h"
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "singlecolourfit.h"
|
#include "singlecolourfit.h"
|
||||||
#include "colourset.h"
|
#include "colourset.h"
|
||||||
#include "colourblock.h"
|
#include "colourblock.h"
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
namespace squish {
|
namespace squish {
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ SingleColourFit::SingleColourFit( ColourSet const* colours, int flags )
|
||||||
m_colour[2] = ( u8 )FloatToInt( 255.0f*values->Z(), 255 );
|
m_colour[2] = ( u8 )FloatToInt( 255.0f*values->Z(), 255 );
|
||||||
|
|
||||||
// initialise the best error
|
// initialise the best error
|
||||||
m_besterror = 2147483647; //INT_MAX
|
m_besterror = INT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleColourFit::Compress3( void* block )
|
void SingleColourFit::Compress3( void* block )
|
||||||
|
@ -130,7 +131,7 @@ void SingleColourFit::Compress4( void* block )
|
||||||
void SingleColourFit::ComputeEndPoints( SingleColourLookup const* const* lookups )
|
void SingleColourFit::ComputeEndPoints( SingleColourLookup const* const* lookups )
|
||||||
{
|
{
|
||||||
// check each index combination (endpoint or intermediate)
|
// check each index combination (endpoint or intermediate)
|
||||||
m_error = 2147483647; //INT_MAX
|
m_error = INT_MAX;
|
||||||
for( int index = 0; index < 2; ++index )
|
for( int index = 0; index < 2; ++index )
|
||||||
{
|
{
|
||||||
// check the error for this codebook index
|
// check the error for this codebook index
|
|
@ -26,7 +26,7 @@
|
||||||
#ifndef SQUISH_SINGLECOLOURFIT_H
|
#ifndef SQUISH_SINGLECOLOURFIT_H
|
||||||
#define SQUISH_SINGLECOLOURFIT_H
|
#define SQUISH_SINGLECOLOURFIT_H
|
||||||
|
|
||||||
#include "squish/squish.h"
|
#include <squish.h>
|
||||||
#include "colourfit.h"
|
#include "colourfit.h"
|
||||||
|
|
||||||
namespace squish {
|
namespace squish {
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "squish/squish.h"
|
#include <squish.h>
|
||||||
#include "colourset.h"
|
#include "colourset.h"
|
||||||
#include "maths.h"
|
#include "maths.h"
|
||||||
#include "rangefit.h"
|
#include "rangefit.h"
|
Loading…
Reference in New Issue