Updated README and CMakeList
This commit is contained in:
parent
1b3e5e5a0a
commit
18514e6ad3
@ -1,72 +1,85 @@
|
|||||||
# CMakeLists.txt
|
# CMakeLists.txt
|
||||||
|
|
||||||
# Written by JackCarterSmith, 2021
|
####################################################
|
||||||
|
# Written by JackCarterSmith, 2022
|
||||||
# This code is released under the RSE license.
|
# This code is released under the RSE license.
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
|
||||||
|
# CMake requirement and general configuration
|
||||||
cmake_minimum_required(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.12)
|
||||||
cmake_policy(VERSION 3.12)
|
cmake_policy(VERSION 3.12)
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
|
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
|
||||||
|
if(DEFINED ENV{MS_COMPATIBLE})
|
||||||
# define project
|
set(CMAKE_GNUtoMS ON) # Enable compatibility level to exported libraries
|
||||||
add_definitions(-DCONF_NO_GL)
|
|
||||||
#add_definitions(-DNO_PNG_SUPPORT)
|
|
||||||
if(DEFINED ENV{CI})
|
|
||||||
project(rse-map VERSION $ENV{CI_VERSION}.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Map" LANGUAGES C)
|
|
||||||
set(RSE_MAP_NAME $ENV{CI_OUTPUT_NAME}-${PROJECT_VERSION})
|
|
||||||
else()
|
|
||||||
project(rse-map VERSION 1.0.0 DESCRIPTION "RogueSquadron Extractor - Map" LANGUAGES C)
|
|
||||||
set(RSE_MAP_NAME RSE_Map-${PROJECT_VERSION})
|
|
||||||
endif()
|
endif()
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h @ONLY)
|
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
# needed packages
|
add_definitions(-DCONF_NO_GL) # Used for obj-lib to not compile GL part
|
||||||
|
#add_definitions(-DNO_PNG_SUPPORT) # Can be used to disable code support for PNG exporting
|
||||||
|
|
||||||
|
|
||||||
|
# Project definition
|
||||||
|
if(DEFINED ENV{CI}) # Jenkins CI integration mode
|
||||||
|
project(rse-terrain VERSION $ENV{CI_VERSION}.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Terrain" LANGUAGES C)
|
||||||
|
set(RSE_TER_NAME $ENV{CI_OUTPUT_NAME}-${PROJECT_VERSION})
|
||||||
|
else() # Standalone project mode, should not be used for release.
|
||||||
|
project(rse-terrain VERSION 1.0.0 DESCRIPTION "RogueSquadron Extractor - Terrain" LANGUAGES C)
|
||||||
|
set(RSE_TER_NAME RSE_Terrain-${PROJECT_VERSION})
|
||||||
|
endif()
|
||||||
|
# Push compile infos to source
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h @ONLY)
|
||||||
|
|
||||||
|
|
||||||
|
# Import needed packages and references their include path
|
||||||
find_package(ZLIB 1.2.11 EXACT REQUIRED)
|
find_package(ZLIB 1.2.11 EXACT REQUIRED)
|
||||||
include_directories(${ZLIB_INCLUDE_DIR})
|
include_directories(${ZLIB_INCLUDE_DIR})
|
||||||
find_package(PNG 1.6.37 EXACT REQUIRED)
|
find_package(PNG 1.6.37 EXACT REQUIRED)
|
||||||
include_directories(${PNG_INCLUDE_DIR})
|
include_directories(${PNG_INCLUDE_DIR})
|
||||||
find_package(GLEW REQUIRED)
|
#find_package(GLEW REQUIRED) # Enable when GL rendering is ready
|
||||||
include_directories(${GLEW_INCLUDE_DIR})
|
#include_directories(${GLEW_INCLUDE_DIR})
|
||||||
|
|
||||||
# define src/headers files
|
|
||||||
|
|
||||||
FILE(GLOB_RECURSE RSE_MAP_SRCS src/*.c)
|
# Define src/headers files
|
||||||
FILE(GLOB_RECURSE RSE_MAP_HRDS src/*.h)
|
FILE(GLOB_RECURSE RSE_TER_SOURCES src/*.c)
|
||||||
SOURCE_GROUP("Source Files" FILES ${RSE_MAP_SRCS})
|
FILE(GLOB_RECURSE RSE_TER_HEADERS src/*.h)
|
||||||
SOURCE_GROUP("Header Files" FILES ${RSE_MAP_HRDS})
|
SOURCE_GROUP("Source Files" FILES ${RSE_TER_SOURCES})
|
||||||
|
SOURCE_GROUP("Header Files" FILES ${RSE_TER_HEADERS})
|
||||||
|
|
||||||
# begin building RSE-Map
|
|
||||||
|
|
||||||
#set(CMAKE_BUILD_TYPE Debug)
|
# Building instructions for RSE-Terrain
|
||||||
|
if(DEFINED ENV{RSE-WS})
|
||||||
|
set(CMAKE_BUILD_TYPE DEBUG)
|
||||||
|
endif()
|
||||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
#include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
add_executable(rse-map ${RSE_MAP_SRCS} ${RSE_MAP_HRDS})
|
add_executable(rse-terrain ${RSE_TER_SOURCES} ${RSE_TER_HEADERS}) # Set the inputs for the compiler (srcs&hrds)
|
||||||
#set_property(TARGET rse-map PROPERTY C_STANDARD 99)
|
set_property(TARGET rse-terrain PROPERTY C_STANDARD 90)
|
||||||
set_target_properties(rse-map PROPERTIES OUTPUT_NAME ${RSE_MAP_NAME})
|
set_target_properties(rse-terrain PROPERTIES OUTPUT_NAME ${RSE_TER_NAME}) # Define the executable file name
|
||||||
|
# Link externals libraries to the linker
|
||||||
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-map PROPERTIES PREFIX "lib")
|
#set_target_properties(rse-terrain PROPERTIES PREFIX "lib")
|
||||||
set_target_properties(rse-map PROPERTIES IMPORT_PREFIX "lib")
|
set_target_properties(rse-terrain PROPERTIES IMPORT_PREFIX "lib")
|
||||||
endif()
|
target_link_libraries(rse-terrain ${ZLIB_LIBRARIES} ${PNG_LIBRARIES} ${GLEW_LIBRARIES})
|
||||||
if(MSVC)
|
|
||||||
target_link_libraries(rse-map ${ZLIB_LIBRARIES} ${PNG_LIBRARIES})
|
|
||||||
else()
|
else()
|
||||||
target_link_libraries(rse-map ${ZLIB_LIBRARIES} ${PNG_LIBRARIES} m)
|
target_link_libraries(rse-terrain ${ZLIB_LIBRARIES} ${PNG_LIBRARIES} ${GLEW_LIBRARIES} m)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# add GPG signature command
|
|
||||||
|
# GPG signature custom command
|
||||||
#add_custom_command(
|
#add_custom_command(
|
||||||
# OUTPUT ""
|
# OUTPUT ""
|
||||||
# COMMAND gpg --batch --detach-sign
|
# COMMAND gpg --batch --detach-sign
|
||||||
# -o ${RSE_MAP_NAME}_${CI_SYS_TARGET}.gpg
|
# -o ${RSE_TER_NAME}_${CI_SYS_TARGET}.gpg
|
||||||
# ${RSE_MAP_NAME}
|
# ${RSE_TER_NAME}
|
||||||
# DEPENDS ${RSE_MAP_NAME}
|
# DEPENDS ${RSE_TER_NAME}
|
||||||
# VERBATIM
|
# VERBATIM
|
||||||
#)
|
#)
|
||||||
|
|
||||||
# install executable
|
|
||||||
install(TARGETS rse-map
|
# Install project executable
|
||||||
|
install(TARGETS rse-terrain
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
)
|
)
|
67
README.md
67
README.md
@ -1,14 +1,71 @@
|
|||||||
# RogueSquadron Extractor - MAP module
|
# RogueSquadron Extractor - TERRAIN module
|
||||||
|
|
||||||
Inspired by the work of **dpethes** (https://github.com/dpethes/rerogue) :clap:
|
Inspired by the work of **dpethes** (https://github.com/dpethes/rerogue) :clap:
|
||||||
|
|
||||||
This set of git repos are a compilation of tools coded in C to make RS modding far more than a dream!
|
This set of git repos are a compilation of tools coded in C to make RS modding far more than a dream!
|
||||||
The collection consist of few independants modules, each of them deals with specific data like sound, textures, heightmaps, etc...
|
The collection consist of few independants modules, each of them deals with specific data like sound, textures, heightmaps, etc...
|
||||||
|
|
||||||
All modules are independants. This is the **'MAP'** module.
|
All modules are independants. This is the **'TERRAIN'** module.
|
||||||
|
|
||||||
:exclamation: **Master branch is ugly for now and should not be used, please take only released versions.** :exclamation:
|
[](https://ci.jcsmith.fr/job/JCS-Prod/job/RSE-Terrain/job/master/)
|
||||||
|
|
||||||
## MAP MODULE
|
## TERRAIN MODULE
|
||||||
|
|
||||||
It's extract texture datas from Rogue Squadron 3D (PC) game map files.
|
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 an heightmap-like PNG,
|
||||||
|
- Multiple inputs files.
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
- Add textures to terrain.
|
||||||
|
- Adding LOD method to optimize datas manipulation and rendering.
|
||||||
|
- Rewrite OBJ lib...
|
||||||
|
- Discover all last unknowns fields, etc.
|
||||||
|
|
||||||
|
### Using
|
||||||
|
|
||||||
|
`RSE-Terrain_"version" [options] <hob files...>` or you can simply drag&drop HOB 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.
|
||||||
|
|
||||||
|
<img src="https://repo.jcsmith.fr/pictures/rse-terrain.gif" width="620" height="400" />
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
- -h Print this message
|
||||||
|
- -v,-vv Activate verbose/debug output mode respectively
|
||||||
|
- -subdir Export outputs to a sub-directory
|
||||||
|
- -neg Negative heightmap output
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- obj-lib: as obj file exporter. (https://github.com/rlk/obj)
|
||||||
|
|
||||||
|
### Compiling
|
||||||
|
|
||||||
|
:mega: **MSVC compatibility is in progress. Not working for now but you can try to fix error by yourself.**
|
||||||
|
|
||||||
|
You can compile on both Windows (MinGW) or native Linux system thanks to CMake.
|
||||||
|
|
||||||
|
To compile, just clone (**don't forget git submodules**) and launch cmake:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cmake .
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
```
|
||||||
|
|
||||||
|
We can also use cross-compilation (after installing `mingw64` and `cmake` packages on your distrib):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mkdir build && cd build
|
||||||
|
cmake -DGNU_HOST=x86_64-w64-mingw32 \
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=../mingw_cross_toolchain.cmake \
|
||||||
|
..
|
||||||
|
cmake --build .
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user