v2-RC1 #9
@ -74,5 +74,5 @@ install(TARGETS ${RSE_TERRAIN_TARGETS_LIST}
|
|||||||
# Install library includes
|
# Install library includes
|
||||||
install(FILES ${RSP_PUBLIC_HRDS} DESTINATION ${INSTALL_INC_DIR})
|
install(FILES ${RSP_PUBLIC_HRDS} DESTINATION ${INSTALL_INC_DIR})
|
||||||
# Install dependancies
|
# 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})
|
DESTINATION ${INSTALL_BIN_DIR})
|
||||||
|
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -5,7 +5,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
CI_OUTPUT_NAME = "RSETerrain"
|
CI_OUTPUT_NAME = "RSETerrain"
|
||||||
CI_VERSION = "2.0.0"
|
CI_VERSION = "2.0.3"
|
||||||
CI_BUILD_NUMBER = "$BUILD_NUMBER"
|
CI_BUILD_NUMBER = "$BUILD_NUMBER"
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
|
21
LICENSE-zlib
21
LICENSE-zlib
@ -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
|
|
@ -43,12 +43,13 @@ Due to issue with copyrights, I can't provide samples... You need to extract HOB
|
|||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
|
- libpng (1.6.37)
|
||||||
- obj-lib: as obj file exporter. (https://git.jcsmith.fr/jackcartersmith/obj)
|
- obj-lib: as obj file exporter. (https://git.jcsmith.fr/jackcartersmith/obj)
|
||||||
|
|
||||||
### Compiling
|
### 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).
|
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:
|
To compile, just clone (**don't forget git submodules**) and launch cmake:
|
||||||
|
|
||||||
|
@ -13,8 +13,6 @@ include(CheckCSourceCompiles)
|
|||||||
add_definitions(-DCONF_NO_GL) # Used for obj-lib to not compile GL part
|
add_definitions(-DCONF_NO_GL) # Used for obj-lib to not compile GL part
|
||||||
|
|
||||||
# Import needed packages and references their include path
|
# 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)
|
find_package(PNG 1.6.37 REQUIRED)
|
||||||
include_directories(${PNG_INCLUDE_DIR})
|
include_directories(${PNG_INCLUDE_DIR})
|
||||||
#find_package(GLEW REQUIRED) # Enable when GL rendering is ready
|
#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)
|
if(MSVC)
|
||||||
# msvc does not append 'lib' - do it here to have consistent name
|
# msvc does not append 'lib' - do it here to have consistent name
|
||||||
set_target_properties(rse-terrain PROPERTIES IMPORT_PREFIX "lib")
|
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()
|
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()
|
endif()
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* @date 23/08/2022
|
* @date 23/08/2022
|
||||||
* @author JackCarterSmith
|
* @author JackCarterSmith
|
||||||
* @copyright GPL-v3.0
|
* @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.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <zlib.h>
|
||||||
|
#include <png.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include <RSPTerrain_datatypes.h>
|
#include <RSPTerrain_datatypes.h>
|
||||||
#include <RSPTerrain_errordefs.h>
|
#include <RSPTerrain_errordefs.h>
|
||||||
#include <zlib.h>
|
|
||||||
#include <png.h>
|
|
||||||
#include "obj/obj.h"
|
#include "obj/obj.h"
|
||||||
#include "terrain_export.h"
|
#include "terrain_export.h"
|
||||||
|
|
||||||
@ -58,18 +58,27 @@ unsigned char exportHeightmapPNG(const T_RSPTERRAIN_HEIGHTMAP* heightmap, const
|
|||||||
return RSPLIB_ERROR_MEMORY;
|
return RSPLIB_ERROR_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set compression level
|
||||||
|
png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);
|
||||||
|
|
||||||
// Set image attributes
|
// 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
|
// Store PNG datas in buffer
|
||||||
row_ptrs = png_malloc(png_ptr, heightmap->height * RSPTERRAINLIB_TILE_SAMPLING * sizeof(png_byte *));
|
row_ptrs = png_malloc(png_ptr, heightmap->height * RSPTERRAINLIB_TILE_SAMPLING * sizeof(png_byte *));
|
||||||
for ( z = 0; z < heightmap->height * RSPTERRAINLIB_TILE_SAMPLING; z++ ) {
|
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;
|
row_ptrs[z] = row;
|
||||||
for ( x = 0; x < heightmap->width * RSPTERRAINLIB_TILE_SAMPLING; x++ ) {
|
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];
|
|
||||||
*row++ = heightmap->heightmap[x][z];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ char* RSPTerrain_getVersion( void ) {
|
|||||||
return PRG_VERSION;
|
return PRG_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned short RSPTerrain_processHMPFile( T_RSPTERRAIN_HMP* hmpStruct, const char* const filePath,
|
unsigned short RSPTerrain_processHMPFile( T_RSPTERRAIN_HMP* hmpStruct, const char* const filePath,
|
||||||
const RSPTERRAIN_PARAMETERS params ) {
|
const RSPTERRAIN_PARAMETERS params ) {
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ cmake
|
|||||||
cmake_find_package
|
cmake_find_package
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
zlib:shared=True
|
|
||||||
libpng:shared=True
|
libpng:shared=True
|
||||||
glew:shared=True
|
glew:shared=True
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user