diff --git a/.gitmodules b/.gitmodules index cc9feb4..5b2ac1a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "src/rlk"] - path = src/rlk +[submodule "RSEModel/rlk"] + path = RSEModel/rlk url = https://github.com/rlk/obj.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 7be0b65..e5b8488 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,53 +14,26 @@ if(DEFINED ENV{MS_COMPATIBLE}) set(CMAKE_GNUtoMS ON) # Enable compatibility level to exported libraries endif() -include(CheckIncludeFile) -include(CheckCSourceCompiles) - -add_definitions(-DCONF_NO_GL) # Used for obj-lib to not compile GL part - # Project definition if(DEFINED ENV{CI}) # Jenkins CI integration mode project(rse-model VERSION $ENV{CI_VERSION}.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C) - set(RSE_MOD_NAME $ENV{CI_OUTPUT_NAME}-${PROJECT_VERSION}) + + set(RSE_MODEL_NAME $ENV{CI_OUTPUT_NAME}_${PROJECT_VERSION}) else() # Standalone project mode, should not be used for release. project(rse-model VERSION 1.0.0 DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C) - set(RSE_MOD_NAME RSE_Model-${PROJECT_VERSION}) + set(RSE_MODEL_NAME RSEModel_${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) +set(RSP_MODEL_LIB_NAME RSPModel${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR}) -# Import needed packages and references their include path -#find_package(GLEW REQUIRED) # Enable when GL rendering is ready -#include_directories(${GLEW_INCLUDE_DIR}) - - -# Define src/headers files -FILE(GLOB_RECURSE RSE_MOD_SOURCES src/*.c) -FILE(GLOB_RECURSE RSE_MOD_HEADERS src/*.h) -SOURCE_GROUP("Source Files" FILES ${RSE_MOD_SOURCES}) -SOURCE_GROUP("Header Files" FILES ${RSE_MOD_HEADERS}) - - -# Building instructions for RSE-Model -if(DEFINED ENV{RSE-WS}) - set(CMAKE_BUILD_TYPE DEBUG) -endif() -#include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_executable(rse-model ${RSE_MOD_SOURCES} ${RSE_MOD_HEADERS}) # Set the inputs for the compiler (srcs&hrds) -set_property(TARGET rse-model PROPERTY C_STANDARD 90) -set_target_properties(rse-model PROPERTIES OUTPUT_NAME ${RSE_MOD_NAME}) # Define the executable file name -# Link externals libraries to the linker -if(MSVC) - # msvc does not append 'lib' - do it here to have consistent name - #set_target_properties(rse-model PROPERTIES PREFIX "lib") - set_target_properties(rse-model PROPERTIES IMPORT_PREFIX "lib") - target_link_libraries(rse-model ${GLEW_LIBRARIES}) -else() - target_link_libraries(rse-model ${GLEW_LIBRARIES} m) -endif() +# The project is divided in two parts: +# - RSPModelLib is the parser library for model type data, it's take HOB file as input and output extracted datas. +# It is intended to be used by others apps like rendering engine or others. +# - RSEModel is the standalone application of the library, take HOB file in argument and output OBJ/MTL file. +# Artists or users can directly use this program to retrieve data in common datas format. +add_subdirectory(RSPModelLib) +add_subdirectory(RSEModel) # GPG signature custom command diff --git a/RSEModel/CMakeLists.txt b/RSEModel/CMakeLists.txt new file mode 100644 index 0000000..d3e599f --- /dev/null +++ b/RSEModel/CMakeLists.txt @@ -0,0 +1,43 @@ +# CMakeLists.txt + +#################################################### +# Written by JackCarterSmith, 2022 +# This code is released under the RSE license. +#################################################### + + +# General configuration +include(CheckIncludeFile) +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(GLEW REQUIRED) # Enable when GL rendering is ready +#include_directories(${GLEW_INCLUDE_DIR}) + +# Push compile infos to source +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h @ONLY) + + +# Define src/headers files +FILE(GLOB_RECURSE RSE_MOD_SOURCES ./*.c) +SOURCE_GROUP("Source Files" FILES ${RSE_MOD_SOURCES}) + + +# Building instructions for RSE-Model +if(DEFINED ENV{RSE-WS}) + set(CMAKE_BUILD_TYPE DEBUG) +endif() +add_executable(rse-model ${RSE_MOD_SOURCES}) +set_property(TARGET rse-model PROPERTY C_STANDARD 90) +target_include_directories(rse-model PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +set_target_properties(rse-model PROPERTIES OUTPUT_NAME ${RSE_MODEL_NAME}) +# Link externals libraries to the linker +if(MSVC) + # msvc does not append 'lib' - do it here to have consistent name + set_target_properties(rse-model PROPERTIES IMPORT_PREFIX "lib") + target_link_libraries(rse-model PRIVATE ${GLEW_LIBRARIES} rsp-model-lib) +else() + target_link_libraries(rse-model PRIVATE ${GLEW_LIBRARIES} m rsp-model-lib) +endif() diff --git a/src/Model-Extractor.c b/RSEModel/Model-Extractor.c similarity index 93% rename from src/Model-Extractor.c rename to RSEModel/Model-Extractor.c index 1ddf391..2d44f4d 100644 --- a/src/Model-Extractor.c +++ b/RSEModel/Model-Extractor.c @@ -1,186 +1,187 @@ -/** - * \file Model-Extractor.c - * \date 25/07/2022 - * \author JackCarterSmith - * \copyright GPL-v3.0 - * \brief HOB model parser and export to Waveform OBJ format. - */ - -#include -#include -#include -#if defined(_WIN32) - #include -#else - #include - #include -#endif -#include "errors_types.h" -#include "config.h" -#include "options.h" -#include "hob_struct.h" -#include "hob_parser.h" -#include "obj_exporter.h" - - -/* - * Internal functions declarations - */ - -static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS* opt_ptr); -static void createSubDir(char *dirName); -static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]); -static void cleanUpMemory(T_HOB* hobStruct); -static void dispHelp(); - - -/* - * - MAIN - - */ -int main(int argc, char *argv[]) { - T_PROG_OPTIONS _opts; - unsigned char p; - - // Hello world! - printf("\n*** RogueSquadron Extractor (RSE) - MODEL module - v%s ***\n", VERSION); - - // Check for arguments - if (argc < 2) { - printf("\n[ERR] No input file/commands specified!\n"); - dispHelp(); - return ERROR_ARGS_NULL; - } - - // Create options for programs according to user's arguments. - p = checkInputArgs(&_opts, argc, argv); - if ( p == ERROR_GENERIC ) return NO_ERROR; - else if ( p != NO_ERROR ) return p; - - return mainProcess(argc, argv, &_opts); -} - - -/* - * Private functions definition - */ - -static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS* p_opts) { - unsigned short file_index; - T_HOB* hobStruct = NULL; - int i; - - // Manage multiple inputs files - for ( file_index = p_opts->input_files_cnt; file_index < args_cnt; file_index++) - { - printf("\n=============================================\n[INFO] - Parsing file: %s ...\n", args_value[file_index]); - hobStruct = calloc(1, sizeof(T_HOB)); - // Parse data from HOB file and put in T_HOB structure. - if (parseHOBFile(args_value[file_index], hobStruct, p_opts) != NO_ERROR) { - printf("[ERR] Failed to parse datas from %s\n", args_value[file_index]); - free(hobStruct); - return ERROR_PROCESS; - } - - if (hobStruct->obj_count > 0) { - if (p_opts->output_dir) createSubDir(args_value[file_index]); - - for ( i = 0; i < hobStruct->obj_count; i++ ) { - if (exportOBJModel(&(hobStruct->objects[i]), args_value[file_index], p_opts) != NO_ERROR) - printf("[ERR] Failed to export %s object in OBJ format!\n", hobStruct->objects[i].name); - else - printf("[INFO] Successfully exported %s object in OBJ format.\n", hobStruct->objects[i].name); - } - } - } - - cleanUpMemory(hobStruct); - - return NO_ERROR; -} - -static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]) { - char test[256]; - int i; - - // Set default options - opt_ptr->raw = 0; - opt_ptr->output_dir = 1; - opt_ptr->export_mtl = 1; - - if (p_arg_nbr > 1) { - for ( i = 1; i < p_arg_nbr; i++) { - strcpy(test, p_args[i]); - if (p_args[i][0] != '-') break; - if (strcmp(p_args[i], "-h") == 0) { - dispHelp(); - return ERROR_GENERIC; - } else if (strcmp(p_args[i], "-v") == 0) { - opt_ptr->verbose_mode = 1; - printf("[OPTN] Verbose enabled.\n"); - } else if (strcmp(p_args[i], "-vv") == 0) { - opt_ptr->verbose_mode = 1; - opt_ptr->debug_mode = 1; - printf("[OPTN] Debug enabled.\n"); - } else if (strcmp(p_args[i], "-vvv") == 0) { - opt_ptr->verbose_mode = 1; - opt_ptr->debug_mode = 1; - opt_ptr->god_mode = 1; - printf("[OPTN] God damn it!\n"); - } else if (strcmp(p_args[i], "-no-subdir") == 0) { - opt_ptr->output_dir = 0; - printf("[OPTN] Export to current directory.\n"); - } else if (strcmp(p_args[i], "-mtl") == 0) { - opt_ptr->export_mtl = 0; - printf("[OPTN] No materials datas.\n"); - } else { - printf("[ERR] Unknown option: %s\n", p_args[i]); - } - } - - opt_ptr->input_files_cnt = i; - return NO_ERROR; - } - - return ERROR_ARGS_NULL; -} - -static void createSubDir(char *dirName) { - if (dirName == NULL) return; - char _dir[260]; //TODO: Change directory management - strcpy(_dir, dirName); - strcat(_dir, "-out"); - - #ifdef _WIN32 - CreateDirectory(_dir, NULL); - #else - mkdir(_dir, 0755); - #endif -} - -static void cleanUpMemory(T_HOB* hobStruct) { - int i,j; - - for ( i=0; iobj_count; i++ ) { - for ( j=0; jobjects[i].face_group_count; j++ ) { - - free(hobStruct->objects[i].object_parts[j].faces); - free(hobStruct->objects[i].object_parts[j].vertices); - } - - free(hobStruct->objects[i].object_parts); - } - - free(hobStruct->objects); - free(hobStruct); -} - -static void dispHelp() { - printf("\n"); - printf("Options:\n -h Print this message\n"); - printf(" -v -vv Activate verbose console output\n"); - printf(" -no-subdir Export models inside current folder\n"); - printf(" -no-mtl Disable materials datas export with model\n"); - printf("\n"); - printf("Usage: RSE-Model_%s [options] \n", VERSION); - printf("\n"); -} +/** + * \file Model-Extractor.c + * \date 25/07/2022 + * \author JackCarterSmith + * \copyright GPL-v3.0 + * \brief HOB model parser and export to Waveform OBJ format. + */ + +#include +#include +#include +#if defined(_WIN32) + #include +#else + #include + #include +#endif +#include +#include +#include +#include "config.h" +#include "options.h" +#include "obj_exporter.h" + + + +/* + * Internal functions declarations + */ + +static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS* opt_ptr); +static void createSubDir(char *dirName); +static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]); +static void cleanUpMemory(T_HOB* hobStruct); +static void dispHelp(); + + +/* + * - MAIN - + */ +int main(int argc, char *argv[]) { + T_PROG_OPTIONS _opts; + unsigned char p; + + // Hello world! + printf("\n*** RogueSquadron Extractor (RSE) - MODEL module - v%s ***\n", VERSION); + + // Check for arguments + if (argc < 2) { + printf("\n[ERR] No input file/commands specified!\n"); + dispHelp(); + return ERROR_ARGS_NULL; + } + + // Create options for programs according to user's arguments. + p = checkInputArgs(&_opts, argc, argv); + if ( p == ERROR_GENERIC ) return NO_ERROR; + else if ( p != NO_ERROR ) return p; + + return mainProcess(argc, argv, &_opts); +} + + +/* + * Private functions definition + */ + +static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS* p_opts) { + unsigned short file_index; + T_HOB* hobStruct = NULL; + int i; + + // Manage multiple inputs files + for ( file_index = p_opts->input_files_cnt; file_index < args_cnt; file_index++) + { + printf("\n=============================================\n[INFO] - Parsing file: %s ...\n", args_value[file_index]); + hobStruct = calloc(1, sizeof(T_HOB)); + // Parse data from HOB file and put in T_HOB structure. + if (RSP_ModelLib_ParseHOBFile(args_value[file_index], hobStruct, p_opts) != NO_ERROR) { + printf("[ERR] Failed to parse datas from %s\n", args_value[file_index]); + free(hobStruct); + return ERROR_PROCESS; + } + + if (hobStruct->obj_count > 0) { + if (p_opts->output_dir) createSubDir(args_value[file_index]); + + for ( i = 0; i < hobStruct->obj_count; i++ ) { + if (exportOBJModel(&(hobStruct->objects[i]), args_value[file_index], p_opts) != NO_ERROR) + printf("[ERR] Failed to export %s object in OBJ format!\n", hobStruct->objects[i].name); + else + printf("[INFO] Successfully exported %s object in OBJ format.\n", hobStruct->objects[i].name); + } + } + } + + cleanUpMemory(hobStruct); + + return NO_ERROR; +} + +static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]) { + char test[256]; + int i; + + // Set default options + opt_ptr->raw = 0; + opt_ptr->output_dir = 1; + opt_ptr->export_mtl = 1; + + if (p_arg_nbr > 1) { + for ( i = 1; i < p_arg_nbr; i++) { + strcpy(test, p_args[i]); + if (p_args[i][0] != '-') break; + if (strcmp(p_args[i], "-h") == 0) { + dispHelp(); + return ERROR_GENERIC; + } else if (strcmp(p_args[i], "-v") == 0) { + opt_ptr->verbose_mode = 1; + printf("[OPTN] Verbose enabled.\n"); + } else if (strcmp(p_args[i], "-vv") == 0) { + opt_ptr->verbose_mode = 1; + opt_ptr->debug_mode = 1; + printf("[OPTN] Debug enabled.\n"); + } else if (strcmp(p_args[i], "-vvv") == 0) { + opt_ptr->verbose_mode = 1; + opt_ptr->debug_mode = 1; + opt_ptr->god_mode = 1; + printf("[OPTN] God damn it!\n"); + } else if (strcmp(p_args[i], "-no-subdir") == 0) { + opt_ptr->output_dir = 0; + printf("[OPTN] Export to current directory.\n"); + } else if (strcmp(p_args[i], "-mtl") == 0) { + opt_ptr->export_mtl = 0; + printf("[OPTN] No materials datas.\n"); + } else { + printf("[ERR] Unknown option: %s\n", p_args[i]); + } + } + + opt_ptr->input_files_cnt = i; + return NO_ERROR; + } + + return ERROR_ARGS_NULL; +} + +static void createSubDir(char *dirName) { + if (dirName == NULL) return; + char _dir[260]; //TODO: Change directory management + strcpy(_dir, dirName); + strcat(_dir, "-out"); + + #ifdef _WIN32 + CreateDirectory(_dir, NULL); + #else + mkdir(_dir, 0755); + #endif +} + +static void cleanUpMemory(T_HOB* hobStruct) { + int i,j; + + for ( i=0; iobj_count; i++ ) { + for ( j=0; jobjects[i].face_group_count; j++ ) { + + free(hobStruct->objects[i].object_parts[j].faces); + free(hobStruct->objects[i].object_parts[j].vertices); + } + + free(hobStruct->objects[i].object_parts); + } + + free(hobStruct->objects); + free(hobStruct); +} + +static void dispHelp() { + printf("\n"); + printf("Options:\n -h Print this message\n"); + printf(" -v -vv Activate verbose console output\n"); + printf(" -no-subdir Export models inside current folder\n"); + printf(" -no-mtl Disable materials datas export with model\n"); + printf("\n"); + printf("Usage: RSE-Model_%s [options] \n", VERSION); + printf("\n"); +} diff --git a/RSEModel/config.h b/RSEModel/config.h new file mode 100644 index 0000000..bc0d1b1 --- /dev/null +++ b/RSEModel/config.h @@ -0,0 +1 @@ +#define VERSION "1.0.0" diff --git a/src/config.h.in b/RSEModel/config.h.in similarity index 97% rename from src/config.h.in rename to RSEModel/config.h.in index d35c5f2..32f49cf 100644 --- a/src/config.h.in +++ b/RSEModel/config.h.in @@ -1 +1 @@ -#define VERSION "@PROJECT_VERSION@" +#define VERSION "@PROJECT_VERSION@" diff --git a/src/obj_exporter.c b/RSEModel/obj_exporter.c similarity index 99% rename from src/obj_exporter.c rename to RSEModel/obj_exporter.c index bc3500d..0ac63c8 100644 --- a/src/obj_exporter.c +++ b/RSEModel/obj_exporter.c @@ -9,9 +9,9 @@ #include #include #include -#include "errors_types.h" +#include +#include #include "options.h" -#include "hob_struct.h" #include "rlk/obj.h" #include "obj_exporter.h" diff --git a/src/obj_exporter.h b/RSEModel/obj_exporter.h similarity index 100% rename from src/obj_exporter.h rename to RSEModel/obj_exporter.h diff --git a/src/options.h b/RSEModel/options.h similarity index 96% rename from src/options.h rename to RSEModel/options.h index 80bb82a..ec369ab 100644 --- a/src/options.h +++ b/RSEModel/options.h @@ -1,32 +1,32 @@ -/** - * \file options.h - * \date 29/07/2022 - * \author JackCarterSmith - * \copyright GPL-v3.0 - * \brief Shared options structure definition and declaration. - */ - -#ifndef OPTIONS_H_ -#define OPTIONS_H_ - -/// Options structure -typedef union u_prog_options { - struct { - unsigned char verbose_mode:1; //!< Output simple details about ID and other "light" things. - - unsigned char output_dir:1; //!< Export extracted datas to a sub-directory. - unsigned char export_mtl:1; //!< Export materials datas with object. - - unsigned char reserved0:5; //!< For future use. - - unsigned char debug_mode:1; //!< Output all values of faces, indices and vertices and others "heavy" things. - unsigned char god_mode:1; //!< Dev only. Output experimental values. - - unsigned char reserved1:6; //!< For future use. - - unsigned short input_files_cnt; //!< Internal files counters. - }; - unsigned int raw; //!< Raw options access for bit-masking or memory copy/compare. -} T_PROG_OPTIONS ; - -#endif /* OPTIONS_H_ */ +/** + * \file options.h + * \date 29/07/2022 + * \author JackCarterSmith + * \copyright GPL-v3.0 + * \brief Shared options structure definition and declaration. + */ + +#ifndef OPTIONS_H_ +#define OPTIONS_H_ + +/// Options structure +typedef union u_prog_options { + struct { + unsigned char verbose_mode:1; //!< Output simple details about ID and other "light" things. + + unsigned char output_dir:1; //!< Export extracted datas to a sub-directory. + unsigned char export_mtl:1; //!< Export materials datas with object. + + unsigned char reserved0:5; //!< For future use. + + unsigned char debug_mode:1; //!< Output all values of faces, indices and vertices and others "heavy" things. + unsigned char god_mode:1; //!< Dev only. Output experimental values. + + unsigned char reserved1:6; //!< For future use. + + unsigned short input_files_cnt; //!< Internal files counters. + }; + unsigned int raw; //!< Raw options access for bit-masking or memory copy/compare. +} T_PROG_OPTIONS ; + +#endif /* OPTIONS_H_ */ diff --git a/src/rlk b/RSEModel/rlk similarity index 100% rename from src/rlk rename to RSEModel/rlk diff --git a/RSPModelLib/CMakeLists.txt b/RSPModelLib/CMakeLists.txt new file mode 100644 index 0000000..59d017a --- /dev/null +++ b/RSPModelLib/CMakeLists.txt @@ -0,0 +1,38 @@ +# CMakeLists.txt + +#################################################### +# Written by JackCarterSmith, 2022 +# This code is released under the RSE license. +#################################################### + + +# General library configuration +if(DEFINED ENV{MS_COMPATIBLE}) + set(CMAKE_GNUtoMS ON) # Enable compatibility level to exported libraries +endif() + +include(CheckIncludeFile) +include(CheckCSourceCompiles) + +# Push compile infos to source +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h @ONLY) + + +# Define src/headers files +FILE(GLOB_RECURSE RSP_MOD_SOURCES ./*.c) +SOURCE_GROUP("Source Files" FILES ${RSP_MOD_SOURCES}) + + +# Building instructions for RSE-Model +if(DEFINED ENV{RSE-WS}) + set(CMAKE_BUILD_TYPE DEBUG) +endif() +add_library(rsp-model-lib ${RSP_MOD_SOURCES}) +set_property(TARGET rsp-model-lib PROPERTY C_STANDARD 90) +target_include_directories(rsp-model-lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +set_target_properties(rsp-model-lib PROPERTIES OUTPUT_NAME ${RSP_MODEL_LIB_NAME}) +# Link externals libraries to the linker +if(MSVC) + # msvc does not append 'lib' - do it here to have consistent name + set_target_properties(rsp-model-lib PROPERTIES PREFIX "lib") +endif() diff --git a/RSPModelLib/config.h b/RSPModelLib/config.h new file mode 100644 index 0000000..bc0d1b1 --- /dev/null +++ b/RSPModelLib/config.h @@ -0,0 +1 @@ +#define VERSION "1.0.0" diff --git a/RSPModelLib/config.h.in b/RSPModelLib/config.h.in new file mode 100644 index 0000000..32f49cf --- /dev/null +++ b/RSPModelLib/config.h.in @@ -0,0 +1 @@ +#define VERSION "@PROJECT_VERSION@" diff --git a/src/errors_types.h b/RSPModelLib/errors_types.h similarity index 100% rename from src/errors_types.h rename to RSPModelLib/errors_types.h diff --git a/src/hob_parser.c b/RSPModelLib/hob_parser.c similarity index 99% rename from src/hob_parser.c rename to RSPModelLib/hob_parser.c index 427de3f..3ca2d46 100644 --- a/src/hob_parser.c +++ b/RSPModelLib/hob_parser.c @@ -15,7 +15,7 @@ #include "hob_parser.h" -unsigned char parseHOBFile(const char* fileName, T_HOB* hob_struct, T_PROG_OPTIONS* p_opts) { +unsigned char RSP_ModelLib_ParseHOBFile(const char* fileName, T_HOB* hob_struct, T_PROG_OPTIONS* p_opts) { unsigned char err = NO_ERROR; long fileSize; FILE* fStream = NULL; diff --git a/src/hob_parser.h b/RSPModelLib/hob_parser.h similarity index 59% rename from src/hob_parser.h rename to RSPModelLib/hob_parser.h index 7219839..6739711 100644 --- a/src/hob_parser.h +++ b/RSPModelLib/hob_parser.h @@ -6,10 +6,13 @@ * \brief Decode HOB file structure. */ +#include "options.h" +#include "hob_struct.h" + #ifndef SRC_HOB_PARSER_H_ #define SRC_HOB_PARSER_H_ -unsigned char parseHOBFile(const char* fileName, T_HOB* hob_struct, T_PROG_OPTIONS* p_opts); +unsigned char RSP_ModelLib_ParseHOBFile(const char* fileName, T_HOB* hob_struct, T_PROG_OPTIONS* p_opts); #endif /* SRC_HOB_PARSER_H_ */ diff --git a/src/hob_struct.h b/RSPModelLib/hob_struct.h similarity index 100% rename from src/hob_struct.h rename to RSPModelLib/hob_struct.h diff --git a/RSPModelLib/options.h b/RSPModelLib/options.h new file mode 100644 index 0000000..ec369ab --- /dev/null +++ b/RSPModelLib/options.h @@ -0,0 +1,32 @@ +/** + * \file options.h + * \date 29/07/2022 + * \author JackCarterSmith + * \copyright GPL-v3.0 + * \brief Shared options structure definition and declaration. + */ + +#ifndef OPTIONS_H_ +#define OPTIONS_H_ + +/// Options structure +typedef union u_prog_options { + struct { + unsigned char verbose_mode:1; //!< Output simple details about ID and other "light" things. + + unsigned char output_dir:1; //!< Export extracted datas to a sub-directory. + unsigned char export_mtl:1; //!< Export materials datas with object. + + unsigned char reserved0:5; //!< For future use. + + unsigned char debug_mode:1; //!< Output all values of faces, indices and vertices and others "heavy" things. + unsigned char god_mode:1; //!< Dev only. Output experimental values. + + unsigned char reserved1:6; //!< For future use. + + unsigned short input_files_cnt; //!< Internal files counters. + }; + unsigned int raw; //!< Raw options access for bit-masking or memory copy/compare. +} T_PROG_OPTIONS ; + +#endif /* OPTIONS_H_ */ diff --git a/mingw_cross_toolchain.cmake b/cmake/mingw_cross_toolchain.cmake similarity index 100% rename from mingw_cross_toolchain.cmake rename to cmake/mingw_cross_toolchain.cmake