mirror of
https://github.com/lubosz/overte.git
synced 2025-04-08 18:02:23 +02:00
Add nvtt external
This commit is contained in:
parent
157dc1475b
commit
0428b22b63
3 changed files with 55 additions and 0 deletions
36
cmake/externals/nvtt/CMakeLists.txt
vendored
Normal file
36
cmake/externals/nvtt/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
include(ExternalProject)
|
||||
include(SelectLibraryConfigurations)
|
||||
|
||||
set(EXTERNAL_NAME nvtt)
|
||||
|
||||
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
||||
|
||||
if (NOT ANDROID)
|
||||
ExternalProject_Add(
|
||||
${EXTERNAL_NAME}
|
||||
URL "C:/Users/Clement/dev/nvidia-texture-tools/project/vc12/package"
|
||||
# URL_MD5 "e7f0a941c9a873f2c4334367454485da"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD 1
|
||||
)
|
||||
|
||||
# Hide this external target (for IDE users)
|
||||
set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
|
||||
|
||||
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
|
||||
|
||||
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE PATH "Location of NVTT include directory")
|
||||
|
||||
if (WIN32)
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/x64/nvtt.lib CACHE FILEPATH "Path to NVTT library")
|
||||
set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${SOURCE_DIR}/Release/x64 CACHE PATH "Location of NVTT DLL")
|
||||
add_paths_to_fixup_libs(${${EXTERNAL_NAME_UPPER}_DLL_PATH})
|
||||
else (APPLE)
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/lib/static/libnvtt.a CACHE FILEPATH "Path to NVTT static library")
|
||||
elseif ()
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${INSTALL_DIR}/lib/nvtt.so CACHE FILEPATH "Path to NVTT library")
|
||||
endif ()
|
||||
|
||||
endif()
|
|
@ -3,3 +3,6 @@ AUTOSCRIBE_SHADER_LIB(gpu model)
|
|||
setup_hifi_library()
|
||||
link_hifi_libraries(shared ktx gpu)
|
||||
|
||||
add_dependency_external_projects(nvtt)
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${NVTT_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET_NAME} ${NVTT_LIBRARIES})
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
//
|
||||
#include "TextureMap.h"
|
||||
|
||||
#include <nvtt/nvtt.h>
|
||||
|
||||
#include <ktx/KTX.h>
|
||||
|
||||
#include <QImage>
|
||||
|
@ -222,6 +224,20 @@ void generateMips(gpu::Texture* texture, QImage& image, bool fastResize) {
|
|||
}
|
||||
}
|
||||
|
||||
int w = 0, h = 0;
|
||||
void* data = 0;
|
||||
nvtt::InputOptions inputOptions;
|
||||
inputOptions.setTextureLayout(nvtt::TextureType_2D, w, h);
|
||||
inputOptions.setMipmapData(data, w, h);
|
||||
|
||||
nvtt::OutputOptions outputOptions;
|
||||
outputOptions.setFileName("output.dds");
|
||||
|
||||
nvtt::CompressionOptions compressionOptions;
|
||||
compressionOptions.setFormat(nvtt::Format_DXT1);
|
||||
|
||||
nvtt::Compressor compressor;
|
||||
//compressor.process(inputOptions, compressionOptions, outputOptions);
|
||||
#else
|
||||
texture->autoGenerateMips(-1);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue