Fixed: #1254 Error while compiling with current stable squish

This commit is contained in:
kervala 2012-09-25 12:19:13 +02:00
parent 53077ccd40
commit d45a4122b8
7 changed files with 33 additions and 13 deletions

View file

@ -67,6 +67,11 @@ IF(SQUISH_FOUND)
IF(NOT SQUISH_FIND_QUIETLY)
MESSAGE(STATUS "Found Squish: ${SQUISH_LIBRARIES}")
ENDIF(NOT SQUISH_FIND_QUIETLY)
FILE(STRINGS ${SQUISH_INCLUDE_DIR}/squish.h METRIC REGEX "metric = 0")
IF(METRIC)
SET(SQUISH_COMPRESS_HAS_METRIC ON)
SET(SQUISH_DEFINITIONS -DSQUISH_COMPRESS_HAS_METRIC)
ENDIF(METRIC)
ELSE(SQUISH_FOUND)
IF(NOT SQUISH_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Squish!")

View file

@ -51,6 +51,7 @@ IF(WITH_QT)
ENDIF(WITH_QT)
IF(SQUISH_FOUND)
ADD_SUBDIRECTORY(s3tc_compressor_lib)
ADD_SUBDIRECTORY(panoply_maker)
ADD_SUBDIRECTORY(tga_2_dds)
ADD_SUBDIRECTORY(hls_bank_maker)

View file

@ -1,10 +1,8 @@
FILE(GLOB SRC *.cpp *.h ../panoply_maker/hls_bank_texture_info.cpp ../panoply_maker/hls_bank_texture_info.h ../s3tc_compressor_lib/*.cpp ../s3tc_compressor_lib/*.h)
FILE(GLOB SRC *.cpp *.h ../panoply_maker/hls_bank_texture_info.cpp ../panoply_maker/hls_bank_texture_info.h)
ADD_EXECUTABLE(hls_bank_maker ${SRC})
INCLUDE_DIRECTORIES(${SQUISH_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(hls_bank_maker ${SQUISH_LIBRARIES} nelmisc nel3d)
TARGET_LINK_LIBRARIES(hls_bank_maker s3tc_compressor nelmisc nel3d)
NL_DEFAULT_PROPS(hls_bank_maker "NeL, Tools, 3D: hls_bank_maker")
NL_ADD_RUNTIME_FLAGS(hls_bank_maker)

View file

@ -1,10 +1,8 @@
FILE(GLOB SRC *.cpp *.h ../s3tc_compressor_lib/*.h ../s3tc_compressor_lib/*.cpp)
FILE(GLOB SRC *.cpp *.h)
ADD_EXECUTABLE(panoply_maker ${SRC})
INCLUDE_DIRECTORIES(${SQUISH_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(panoply_maker ${SQUISH_LIBRARIES} nelmisc nel3d)
TARGET_LINK_LIBRARIES(panoply_maker s3tc_compressor nelmisc nel3d)
NL_DEFAULT_PROPS(panoply_maker "NeL, Tools, 3D: panoply_maker")
NL_ADD_RUNTIME_FLAGS(panoply_maker)

View file

@ -0,0 +1,16 @@
FILE(GLOB SRC *.cpp)
FILE(GLOB HEADER *.h)
INCLUDE_DIRECTORIES(${SQUISH_INCLUDE_DIR})
NL_TARGET_LIB(s3tc_compressor ${SRC} ${HEADER})
TARGET_LINK_LIBRARIES(s3tc_compressor ${SQUISH_LIBRARIES})
NL_DEFAULT_PROPS(s3tc_compressor "NeL, Tools, 3D: S3TC Compressor Library")
NL_ADD_RUNTIME_FLAGS(s3tc_compressor)
ADD_DEFINITIONS(${SQUISH_DEFINITIONS})
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS s3tc_compressor LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT tools3d)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)

View file

@ -60,8 +60,12 @@ static void compressMipMap(uint8 *pixSrc, sint width, sint height, vector<uint8
dest.dwLinearSize = squish::GetStorageRequirements(width, height, flags);
compdata.resize(dest.dwLinearSize);
// Go!
#ifdef SQUISH_COMPRESS_HAS_METRIC
float weight[3] = {0.3086f, 0.6094f, 0.0820f};
squish::CompressImage(pixSrc, width, height, &(*compdata.begin()), flags, weight);
#else
squish::CompressImage(pixSrc, width, height, &(*compdata.begin()), flags);
#endif
/* S3TC is a very good compressor, but make BIG mistakes in some case with DXTC5 and DXTC3
*/

View file

@ -1,10 +1,8 @@
FILE(GLOB SRC *.cpp *.h ../s3tc_compressor_lib/*.cpp ../s3tc_compressor_lib/*.h)
FILE(GLOB SRC *.cpp *.h)
ADD_EXECUTABLE(tga2dds ${SRC})
INCLUDE_DIRECTORIES(${SQUISH_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(tga2dds ${SQUISH_LIBRARIES} nelmisc nel3d)
TARGET_LINK_LIBRARIES(tga2dds s3tc_compressor nelmisc nel3d)
NL_DEFAULT_PROPS(tga2dds "NeL, Tools, 3D: tga2dds")
NL_ADD_RUNTIME_FLAGS(tga2dds)