Use libsquish in stk-code for android
This commit is contained in:
parent
bc311a445e
commit
257c208a1d
@ -343,6 +343,7 @@ LOCAL_CFLAGS := -I../lib/angelscript/include \
|
|||||||
-I../lib/mcpp \
|
-I../lib/mcpp \
|
||||||
-I../lib/sdl2/include \
|
-I../lib/sdl2/include \
|
||||||
-I../lib/tinygettext/include \
|
-I../lib/tinygettext/include \
|
||||||
|
-I../lib/libsquish \
|
||||||
-I../src \
|
-I../src \
|
||||||
-Ideps-$(TARGET_ARCH_ABI)/curl/include \
|
-Ideps-$(TARGET_ARCH_ABI)/curl/include \
|
||||||
-Ideps-$(TARGET_ARCH_ABI)/freetype/include \
|
-Ideps-$(TARGET_ARCH_ABI)/freetype/include \
|
||||||
|
@ -34,14 +34,14 @@
|
|||||||
#include <IVideoDriver.h>
|
#include <IVideoDriver.h>
|
||||||
#include <IWriteFile.h>
|
#include <IWriteFile.h>
|
||||||
|
|
||||||
#if !(defined(SERVER_ONLY) || defined(MOBILE_STK))
|
#if !defined(SERVER_ONLY)
|
||||||
#include <squish.h>
|
#include <squish.h>
|
||||||
static_assert(squish::kColourClusterFit == (1 << 5), "Wrong header");
|
static_assert(squish::kColourClusterFit == (1 << 5), "Wrong header");
|
||||||
static_assert(squish::kColourRangeFit == (1 << 6), "Wrong header");
|
static_assert(squish::kColourRangeFit == (1 << 6), "Wrong header");
|
||||||
static_assert(squish::kColourIterativeClusterFit == (1 << 8), "Wrong header");
|
static_assert(squish::kColourIterativeClusterFit == (1 << 8), "Wrong header");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(defined(SERVER_ONLY) || defined(MOBILE_STK))
|
#if !defined(SERVER_ONLY)
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include <mipmap/img.h>
|
#include <mipmap/img.h>
|
||||||
@ -51,9 +51,7 @@ extern "C"
|
|||||||
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
#if !defined(MOBILE_STK)
|
|
||||||
static const uint8_t CACHE_VERSION = 2;
|
static const uint8_t CACHE_VERSION = 2;
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace SP
|
namespace SP
|
||||||
{
|
{
|
||||||
@ -238,7 +236,7 @@ bool SPTexture::compressedTexImage2d(std::shared_ptr<video::IImage> texture,
|
|||||||
<core::dimension2du, unsigned> >&
|
<core::dimension2du, unsigned> >&
|
||||||
mipmap_sizes)
|
mipmap_sizes)
|
||||||
{
|
{
|
||||||
#if !defined(SERVER_ONLY) && !defined(MOBILE_STK)
|
#if !defined(SERVER_ONLY)
|
||||||
unsigned format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
unsigned format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||||
if (m_undo_srgb && CVS->isEXTTextureCompressionS3TCSRGBUsable())
|
if (m_undo_srgb && CVS->isEXTTextureCompressionS3TCSRGBUsable())
|
||||||
{
|
{
|
||||||
@ -336,7 +334,7 @@ bool SPTexture::saveCompressedTexture(std::shared_ptr<video::IImage> texture,
|
|||||||
<core::dimension2du, unsigned> >& sizes,
|
<core::dimension2du, unsigned> >& sizes,
|
||||||
const std::string& cache_location)
|
const std::string& cache_location)
|
||||||
{
|
{
|
||||||
#if !defined(SERVER_ONLY) && !defined(MOBILE_STK)
|
#if !defined(SERVER_ONLY)
|
||||||
const unsigned total_size = std::accumulate(sizes.begin(), sizes.end(), 0,
|
const unsigned total_size = std::accumulate(sizes.begin(), sizes.end(), 0,
|
||||||
[] (const unsigned int previous, const std::pair
|
[] (const unsigned int previous, const std::pair
|
||||||
<core::dimension2du, unsigned>& cur_sizes)
|
<core::dimension2du, unsigned>& cur_sizes)
|
||||||
@ -401,7 +399,7 @@ std::shared_ptr<video::IImage> SPTexture::getTextureCache(const std::string& p,
|
|||||||
std::vector<std::pair<core::dimension2du, unsigned> >* sizes)
|
std::vector<std::pair<core::dimension2du, unsigned> >* sizes)
|
||||||
{
|
{
|
||||||
std::shared_ptr<video::IImage> cache;
|
std::shared_ptr<video::IImage> cache;
|
||||||
#if !(defined(SERVER_ONLY) || defined(MOBILE_STK))
|
#if !defined(SERVER_ONLY)
|
||||||
io::IReadFile* file = irr::io::createReadFile(p.c_str());
|
io::IReadFile* file = irr::io::createReadFile(p.c_str());
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
@ -491,7 +489,6 @@ bool SPTexture::threadedLoad()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifndef MOBILE_STK
|
|
||||||
if (UserConfigParams::m_hq_mipmap && image->getDimension().Width > 1 &&
|
if (UserConfigParams::m_hq_mipmap && image->getDimension().Width > 1 &&
|
||||||
image->getDimension().Height > 1)
|
image->getDimension().Height > 1)
|
||||||
{
|
{
|
||||||
@ -517,7 +514,6 @@ bool SPTexture::threadedLoad()
|
|||||||
generateHQMipmap(image->lock(), mipmap_sizes,
|
generateHQMipmap(image->lock(), mipmap_sizes,
|
||||||
(uint8_t*)mipmaps->lock());
|
(uint8_t*)mipmaps->lock());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
SPTextureManager::get()->increaseGLCommandFunctionCount(1);
|
SPTextureManager::get()->increaseGLCommandFunctionCount(1);
|
||||||
SPTextureManager::get()->addGLCommandFunction(
|
SPTextureManager::get()->addGLCommandFunction(
|
||||||
[this, image, mipmaps]()->bool
|
[this, image, mipmaps]()->bool
|
||||||
@ -689,7 +685,7 @@ void SPTexture::generateHQMipmap(void* in,
|
|||||||
<core::dimension2du, unsigned> >& mms,
|
<core::dimension2du, unsigned> >& mms,
|
||||||
uint8_t* out)
|
uint8_t* out)
|
||||||
{
|
{
|
||||||
#if !(defined(SERVER_ONLY) || defined(MOBILE_STK))
|
#if !defined(SERVER_ONLY)
|
||||||
imMipmapCascade cascade;
|
imMipmapCascade cascade;
|
||||||
imReduceOptions options;
|
imReduceOptions options;
|
||||||
imReduceSetOptions(&options,
|
imReduceSetOptions(&options,
|
||||||
@ -726,7 +722,7 @@ std::vector<std::pair<core::dimension2du, unsigned> >
|
|||||||
{
|
{
|
||||||
std::vector<std::pair<core::dimension2du, unsigned> > mipmap_sizes;
|
std::vector<std::pair<core::dimension2du, unsigned> > mipmap_sizes;
|
||||||
|
|
||||||
#if !(defined(SERVER_ONLY) || defined(MOBILE_STK))
|
#if !defined(SERVER_ONLY)
|
||||||
unsigned width = image->getDimension().Width;
|
unsigned width = image->getDimension().Width;
|
||||||
unsigned height = image->getDimension().Height;
|
unsigned height = image->getDimension().Height;
|
||||||
mipmap_sizes.emplace_back(core::dimension2du(width, height), 0);
|
mipmap_sizes.emplace_back(core::dimension2du(width, height), 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user