diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ad3340..371946f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,5 +74,5 @@ install(TARGETS ${RSE_TERRAIN_TARGETS_LIST} # Install library includes install(FILES ${RSP_PUBLIC_HRDS} DESTINATION ${INSTALL_INC_DIR}) # Install dependancies -install(FILES ${PROJECT_BINARY_DIR}/bin/glew32.dll ${PROJECT_BINARY_DIR}/bin/libpng16.dll ${PROJECT_BINARY_DIR}/bin/zlib1.dll +install(FILES ${PROJECT_BINARY_DIR}/bin/glew32.dll ${PROJECT_BINARY_DIR}/bin/libpng16.dll DESTINATION ${INSTALL_BIN_DIR}) diff --git a/Jenkinsfile b/Jenkinsfile index 28b1eab..3060123 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { } environment { CI_OUTPUT_NAME = "RSETerrain" - CI_VERSION = "2.0.0" + CI_VERSION = "2.0.3" CI_BUILD_NUMBER = "$BUILD_NUMBER" } stages { diff --git a/LICENSE-zlib b/LICENSE-zlib deleted file mode 100644 index 1375708..0000000 --- a/LICENSE-zlib +++ /dev/null @@ -1,21 +0,0 @@ - - Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu \ No newline at end of file diff --git a/README.md b/README.md index 8d8edcc..3da2195 100644 --- a/README.md +++ b/README.md @@ -43,12 +43,13 @@ Due to issue with copyrights, I can't provide samples... You need to extract HOB ### Dependencies +- libpng (1.6.37) - obj-lib: as obj file exporter. (https://git.jcsmith.fr/jackcartersmith/obj) ### Compiling You can compile on both Windows (MinGW) or native Linux system thanks to CMake, you only need to adjust your dependencies on Windows or use Conan packages manager (https://conan.io). -zlib-dev (zlib1g-dev) and libpng16-dev distrib packages can be used on debian/ubuntu. +libpng16-dev distrib package can be used on debian/ubuntu. To compile, just clone (**don't forget git submodules**) and launch cmake: diff --git a/RSETerrain/CMakeLists.txt b/RSETerrain/CMakeLists.txt index 9111e16..057ac51 100644 --- a/RSETerrain/CMakeLists.txt +++ b/RSETerrain/CMakeLists.txt @@ -13,8 +13,6 @@ include(CheckCSourceCompiles) add_definitions(-DCONF_NO_GL) # Used for obj-lib to not compile GL part # Import needed packages and references their include path -find_package(ZLIB 1.2.12 REQUIRED) -include_directories(${ZLIB_INCLUDE_DIR}) find_package(PNG 1.6.37 REQUIRED) include_directories(${PNG_INCLUDE_DIR}) #find_package(GLEW REQUIRED) # Enable when GL rendering is ready @@ -43,7 +41,7 @@ set_target_properties(rse-terrain PROPERTIES OUTPUT_NAME ${RSE_TERRAIN_NAME}) if(MSVC) # msvc does not append 'lib' - do it here to have consistent name set_target_properties(rse-terrain PROPERTIES IMPORT_PREFIX "lib") - target_link_libraries(rse-terrain PRIVATE rsp-terrain-libstatic ${ZLIB_LIBRARIES} ${PNG_LIBRARIES} ${GLEW_LIBRARIES}) + target_link_libraries(rse-terrain PRIVATE rsp-terrain-libstatic ${PNG_LIBRARIES} ${GLEW_LIBRARIES}) else() - target_link_libraries(rse-terrain PRIVATE rsp-terrain-libstatic ${ZLIB_LIBRARIES} ${PNG_LIBRARIES} ${GLEW_LIBRARIES} m) + target_link_libraries(rse-terrain PRIVATE rsp-terrain-libstatic ${PNG_LIBRARIES} ${GLEW_LIBRARIES} m) endif() diff --git a/RSETerrain/src/RSETerrain.c b/RSETerrain/src/RSETerrain.c index a344d72..fffb4f0 100644 --- a/RSETerrain/src/RSETerrain.c +++ b/RSETerrain/src/RSETerrain.c @@ -3,7 +3,7 @@ * @date 23/08/2022 * @author JackCarterSmith * @copyright GPL-v3.0 - * @brief HMP model parser and export to Waveform OBJ format and grey-scale PNG heightmap. + * @brief HMP terrain parser and export to Waveform OBJ format and grey-scale PNG heightmap. * */ diff --git a/RSETerrain/src/terrain_export.c b/RSETerrain/src/terrain_export.c index cb3734b..5e766e3 100644 --- a/RSETerrain/src/terrain_export.c +++ b/RSETerrain/src/terrain_export.c @@ -10,11 +10,11 @@ #include #include #include +#include +#include #include "options.h" #include #include -#include -#include #include "obj/obj.h" #include "terrain_export.h" @@ -58,18 +58,27 @@ unsigned char exportHeightmapPNG(const T_RSPTERRAIN_HEIGHTMAP* heightmap, const return RSPLIB_ERROR_MEMORY; } + // Set compression level + png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); + // Set image attributes - png_set_IHDR(png_ptr, info_ptr, heightmap->width * RSPTERRAINLIB_TILE_SAMPLING, heightmap->height * RSPTERRAINLIB_TILE_SAMPLING, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); + png_set_IHDR(png_ptr, info_ptr, + heightmap->width * RSPTERRAINLIB_TILE_SAMPLING, + heightmap->height * RSPTERRAINLIB_TILE_SAMPLING, + 8, + PNG_COLOR_TYPE_GRAY, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT + ); // Store PNG datas in buffer row_ptrs = png_malloc(png_ptr, heightmap->height * RSPTERRAINLIB_TILE_SAMPLING * sizeof(png_byte *)); for ( z = 0; z < heightmap->height * RSPTERRAINLIB_TILE_SAMPLING; z++ ) { - png_byte *row = png_malloc(png_ptr, heightmap->width * RSPTERRAINLIB_TILE_SAMPLING * sizeof(unsigned char) * 3); + png_byte *row = png_malloc(png_ptr, heightmap->width * RSPTERRAINLIB_TILE_SAMPLING * sizeof(unsigned char)); row_ptrs[z] = row; for ( x = 0; x < heightmap->width * RSPTERRAINLIB_TILE_SAMPLING; x++ ) { *row++ = heightmap->heightmap[x][z]; - *row++ = heightmap->heightmap[x][z]; - *row++ = heightmap->heightmap[x][z]; } } diff --git a/RSPTerrainLib/src/RSPTerrain.c b/RSPTerrainLib/src/RSPTerrain.c index c9f6465..578f51a 100644 --- a/RSPTerrainLib/src/RSPTerrain.c +++ b/RSPTerrainLib/src/RSPTerrain.c @@ -22,7 +22,6 @@ char* RSPTerrain_getVersion( void ) { return PRG_VERSION; } - unsigned short RSPTerrain_processHMPFile( T_RSPTERRAIN_HMP* hmpStruct, const char* const filePath, const RSPTERRAIN_PARAMETERS params ) { diff --git a/conanfile.txt b/conanfile.txt index 1786eae..5c5c19e 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -8,7 +8,6 @@ cmake cmake_find_package [options] -zlib:shared=True libpng:shared=True glew:shared=True