From f19a2306d105ccee3e147484a2f71ca18c1cd991 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Wed, 24 Aug 2022 19:05:45 +0200 Subject: [PATCH 1/4] Incremented version updated readme --- Jenkinsfile | 2 +- README.md | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 28b1eab..f1e162c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { } environment { CI_OUTPUT_NAME = "RSETerrain" - CI_VERSION = "2.0.0" + CI_VERSION = "2.0.1" CI_BUILD_NUMBER = "$BUILD_NUMBER" } stages { diff --git a/README.md b/README.md index 8d8edcc..8567cc1 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ It's extract terrain datas from Rogue Squadron 3D (PC) game map files (hmp). This module can do: - Interpolate 3D model mesh of the terrain, -- Export it as OBJ model file (pretty heavy (~15MB), not to be use direcly for display), +- Export it as OBJ model file (pretty heavy (~15MB), not to be use directly for display), - Export an heightmap-like PNG, - Multiple inputs files. @@ -27,10 +27,10 @@ This module can do: ### Using -`RSETerrain [options] ` or you can simply drag&drop HOB files on it. +`RSETerrain [options] ` or you can simply drag&drop HMP files on it. -A futur main program can extract all HOB files directly from DAT file. -Due to issue with copyrights, I can't provide samples... You need to extract HOB files yourself. +A futur main program can extract all HMP files directly from DAT file. +Due to issue with copyrights, I can't provide samples... You need to extract HMP files yourself. @@ -38,7 +38,9 @@ Due to issue with copyrights, I can't provide samples... You need to extract HOB - -h Print this message - -v,-vv Activate verbose/debug output mode respectively -- -subdir Export outputs to a sub-directory +- -no-subdir Export models inside current folder +- -no-mtl Disable texture exporting +- -invZ Invert Z axis when parsing - -neg Negative heightmap output ### Dependencies -- 2.39.5 From 85c86c4a27aacf72a531d1db48495ba9fab987cd Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Thu, 25 Aug 2022 23:13:37 +0200 Subject: [PATCH 2/4] Removed zlib dep --- CMakeLists.txt | 2 +- Jenkinsfile | 2 +- LICENSE-zlib | 21 --------------------- README.md | 15 +++++++-------- RSETerrain/CMakeLists.txt | 6 ++---- RSETerrain/src/terrain_export.c | 1 - conanfile.txt | 2 -- 7 files changed, 11 insertions(+), 38 deletions(-) delete mode 100644 LICENSE-zlib 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 f1e162c..fa42698 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { } environment { CI_OUTPUT_NAME = "RSETerrain" - CI_VERSION = "2.0.1" + CI_VERSION = "2.0.2" 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 8567cc1..3da2195 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ It's extract terrain datas from Rogue Squadron 3D (PC) game map files (hmp). This module can do: - Interpolate 3D model mesh of the terrain, -- Export it as OBJ model file (pretty heavy (~15MB), not to be use directly for display), +- Export it as OBJ model file (pretty heavy (~15MB), not to be use direcly for display), - Export an heightmap-like PNG, - Multiple inputs files. @@ -27,10 +27,10 @@ This module can do: ### Using -`RSETerrain [options] ` or you can simply drag&drop HMP files on it. +`RSETerrain [options] ` or you can simply drag&drop HOB files on it. -A futur main program can extract all HMP files directly from DAT file. -Due to issue with copyrights, I can't provide samples... You need to extract HMP files yourself. +A futur main program can extract all HOB files directly from DAT file. +Due to issue with copyrights, I can't provide samples... You need to extract HOB files yourself. @@ -38,19 +38,18 @@ Due to issue with copyrights, I can't provide samples... You need to extract HMP - -h Print this message - -v,-vv Activate verbose/debug output mode respectively -- -no-subdir Export models inside current folder -- -no-mtl Disable texture exporting -- -invZ Invert Z axis when parsing +- -subdir Export outputs to a sub-directory - -neg Negative heightmap output ### 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/terrain_export.c b/RSETerrain/src/terrain_export.c index cb3734b..c2f5b5d 100644 --- a/RSETerrain/src/terrain_export.c +++ b/RSETerrain/src/terrain_export.c @@ -13,7 +13,6 @@ #include "options.h" #include #include -#include #include #include "obj/obj.h" #include "terrain_export.h" diff --git a/conanfile.txt b/conanfile.txt index 1786eae..32c589b 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,5 +1,4 @@ [requires] -zlib/1.2.12 libpng/1.6.37 glew/2.2.0 @@ -8,7 +7,6 @@ cmake cmake_find_package [options] -zlib:shared=True libpng:shared=True glew:shared=True -- 2.39.5 From 49f5e8809b6ba48bfa9123870eb05f1419162d10 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Mon, 29 Aug 2022 18:22:00 +0200 Subject: [PATCH 3/4] Optimize PNG export --- Jenkinsfile | 2 +- RSETerrain/src/RSETerrain.c | 2 +- RSETerrain/src/terrain_export.c | 20 +++++++++++++++----- RSPTerrainLib/src/RSPTerrain.c | 1 - 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fa42698..3060123 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { } environment { CI_OUTPUT_NAME = "RSETerrain" - CI_VERSION = "2.0.2" + CI_VERSION = "2.0.3" CI_BUILD_NUMBER = "$BUILD_NUMBER" } stages { 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 c2f5b5d..5e766e3 100644 --- a/RSETerrain/src/terrain_export.c +++ b/RSETerrain/src/terrain_export.c @@ -10,10 +10,11 @@ #include #include #include +#include +#include #include "options.h" #include #include -#include #include "obj/obj.h" #include "terrain_export.h" @@ -57,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 ) { -- 2.39.5 From 34e21814146a8f124a1a9e80ed951488539947d1 Mon Sep 17 00:00:00 2001 From: JackCarterSmith Date: Mon, 29 Aug 2022 22:46:39 +0200 Subject: [PATCH 4/4] Crosscompile patch --- conanfile.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/conanfile.txt b/conanfile.txt index 32c589b..5c5c19e 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,4 +1,5 @@ [requires] +zlib/1.2.12 libpng/1.6.37 glew/2.2.0 -- 2.39.5