New library structure prototype
This commit is contained in:
parent
5794e55e59
commit
8da3b4bd43
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,3 +1,3 @@
|
|||||||
[submodule "src/rlk"]
|
[submodule "RSEModel/rlk"]
|
||||||
path = src/rlk
|
path = RSEModel/rlk
|
||||||
url = https://github.com/rlk/obj.git
|
url = https://github.com/rlk/obj.git
|
||||||
|
@ -14,53 +14,26 @@ if(DEFINED ENV{MS_COMPATIBLE})
|
|||||||
set(CMAKE_GNUtoMS ON) # Enable compatibility level to exported libraries
|
set(CMAKE_GNUtoMS ON) # Enable compatibility level to exported libraries
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
|
||||||
include(CheckCSourceCompiles)
|
|
||||||
|
|
||||||
add_definitions(-DCONF_NO_GL) # Used for obj-lib to not compile GL part
|
|
||||||
|
|
||||||
|
|
||||||
# Project definition
|
# Project definition
|
||||||
if(DEFINED ENV{CI}) # Jenkins CI integration mode
|
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)
|
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.
|
else() # Standalone project mode, should not be used for release.
|
||||||
project(rse-model VERSION 1.0.0 DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C)
|
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()
|
endif()
|
||||||
# Push compile infos to source
|
set(RSP_MODEL_LIB_NAME RSPModel${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR})
|
||||||
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
|
# The project is divided in two parts:
|
||||||
#find_package(GLEW REQUIRED) # Enable when GL rendering is ready
|
# - RSPModelLib is the parser library for model type data, it's take HOB file as input and output extracted datas.
|
||||||
#include_directories(${GLEW_INCLUDE_DIR})
|
# 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.
|
||||||
# Define src/headers files
|
add_subdirectory(RSPModelLib)
|
||||||
FILE(GLOB_RECURSE RSE_MOD_SOURCES src/*.c)
|
add_subdirectory(RSEModel)
|
||||||
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()
|
|
||||||
|
|
||||||
|
|
||||||
# GPG signature custom command
|
# GPG signature custom command
|
||||||
|
43
RSEModel/CMakeLists.txt
Normal file
43
RSEModel/CMakeLists.txt
Normal file
@ -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()
|
@ -1,186 +1,187 @@
|
|||||||
/**
|
/**
|
||||||
* \file Model-Extractor.c
|
* \file Model-Extractor.c
|
||||||
* \date 25/07/2022
|
* \date 25/07/2022
|
||||||
* \author JackCarterSmith
|
* \author JackCarterSmith
|
||||||
* \copyright GPL-v3.0
|
* \copyright GPL-v3.0
|
||||||
* \brief HOB model parser and export to Waveform OBJ format.
|
* \brief HOB model parser and export to Waveform OBJ format.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
#include "errors_types.h"
|
#include <errors_types.h>
|
||||||
#include "config.h"
|
#include <hob_struct.h>
|
||||||
#include "options.h"
|
#include <hob_parser.h>
|
||||||
#include "hob_struct.h"
|
#include "config.h"
|
||||||
#include "hob_parser.h"
|
#include "options.h"
|
||||||
#include "obj_exporter.h"
|
#include "obj_exporter.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Internal functions declarations
|
/*
|
||||||
*/
|
* 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 int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS* opt_ptr);
|
||||||
static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]);
|
static void createSubDir(char *dirName);
|
||||||
static void cleanUpMemory(T_HOB* hobStruct);
|
static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]);
|
||||||
static void dispHelp();
|
static void cleanUpMemory(T_HOB* hobStruct);
|
||||||
|
static void dispHelp();
|
||||||
|
|
||||||
/*
|
|
||||||
* - MAIN -
|
/*
|
||||||
*/
|
* - MAIN -
|
||||||
int main(int argc, char *argv[]) {
|
*/
|
||||||
T_PROG_OPTIONS _opts;
|
int main(int argc, char *argv[]) {
|
||||||
unsigned char p;
|
T_PROG_OPTIONS _opts;
|
||||||
|
unsigned char p;
|
||||||
// Hello world!
|
|
||||||
printf("\n*** RogueSquadron Extractor (RSE) - MODEL module - v%s ***\n", VERSION);
|
// Hello world!
|
||||||
|
printf("\n*** RogueSquadron Extractor (RSE) - MODEL module - v%s ***\n", VERSION);
|
||||||
// Check for arguments
|
|
||||||
if (argc < 2) {
|
// Check for arguments
|
||||||
printf("\n[ERR] No input file/commands specified!\n");
|
if (argc < 2) {
|
||||||
dispHelp();
|
printf("\n[ERR] No input file/commands specified!\n");
|
||||||
return ERROR_ARGS_NULL;
|
dispHelp();
|
||||||
}
|
return ERROR_ARGS_NULL;
|
||||||
|
}
|
||||||
// Create options for programs according to user's arguments.
|
|
||||||
p = checkInputArgs(&_opts, argc, argv);
|
// Create options for programs according to user's arguments.
|
||||||
if ( p == ERROR_GENERIC ) return NO_ERROR;
|
p = checkInputArgs(&_opts, argc, argv);
|
||||||
else if ( p != NO_ERROR ) return p;
|
if ( p == ERROR_GENERIC ) return NO_ERROR;
|
||||||
|
else if ( p != NO_ERROR ) return p;
|
||||||
return mainProcess(argc, argv, &_opts);
|
|
||||||
}
|
return mainProcess(argc, argv, &_opts);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Private functions definition
|
/*
|
||||||
*/
|
* Private functions definition
|
||||||
|
*/
|
||||||
static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS* p_opts) {
|
|
||||||
unsigned short file_index;
|
static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS* p_opts) {
|
||||||
T_HOB* hobStruct = NULL;
|
unsigned short file_index;
|
||||||
int i;
|
T_HOB* hobStruct = NULL;
|
||||||
|
int i;
|
||||||
// Manage multiple inputs files
|
|
||||||
for ( file_index = p_opts->input_files_cnt; file_index < args_cnt; file_index++)
|
// 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));
|
printf("\n=============================================\n[INFO] - Parsing file: %s ...\n", args_value[file_index]);
|
||||||
// Parse data from HOB file and put in T_HOB structure.
|
hobStruct = calloc(1, sizeof(T_HOB));
|
||||||
if (parseHOBFile(args_value[file_index], hobStruct, p_opts) != NO_ERROR) {
|
// Parse data from HOB file and put in T_HOB structure.
|
||||||
printf("[ERR] Failed to parse datas from %s\n", args_value[file_index]);
|
if (RSP_ModelLib_ParseHOBFile(args_value[file_index], hobStruct, p_opts) != NO_ERROR) {
|
||||||
free(hobStruct);
|
printf("[ERR] Failed to parse datas from %s\n", args_value[file_index]);
|
||||||
return ERROR_PROCESS;
|
free(hobStruct);
|
||||||
}
|
return ERROR_PROCESS;
|
||||||
|
}
|
||||||
if (hobStruct->obj_count > 0) {
|
|
||||||
if (p_opts->output_dir) createSubDir(args_value[file_index]);
|
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)
|
for ( i = 0; i < hobStruct->obj_count; i++ ) {
|
||||||
printf("[ERR] Failed to export %s object in OBJ format!\n", hobStruct->objects[i].name);
|
if (exportOBJModel(&(hobStruct->objects[i]), args_value[file_index], p_opts) != NO_ERROR)
|
||||||
else
|
printf("[ERR] Failed to export %s object in OBJ format!\n", hobStruct->objects[i].name);
|
||||||
printf("[INFO] Successfully exported %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);
|
|
||||||
|
cleanUpMemory(hobStruct);
|
||||||
return NO_ERROR;
|
|
||||||
}
|
return NO_ERROR;
|
||||||
|
}
|
||||||
static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]) {
|
|
||||||
char test[256];
|
static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]) {
|
||||||
int i;
|
char test[256];
|
||||||
|
int i;
|
||||||
// Set default options
|
|
||||||
opt_ptr->raw = 0;
|
// Set default options
|
||||||
opt_ptr->output_dir = 1;
|
opt_ptr->raw = 0;
|
||||||
opt_ptr->export_mtl = 1;
|
opt_ptr->output_dir = 1;
|
||||||
|
opt_ptr->export_mtl = 1;
|
||||||
if (p_arg_nbr > 1) {
|
|
||||||
for ( i = 1; i < p_arg_nbr; i++) {
|
if (p_arg_nbr > 1) {
|
||||||
strcpy(test, p_args[i]);
|
for ( i = 1; i < p_arg_nbr; i++) {
|
||||||
if (p_args[i][0] != '-') break;
|
strcpy(test, p_args[i]);
|
||||||
if (strcmp(p_args[i], "-h") == 0) {
|
if (p_args[i][0] != '-') break;
|
||||||
dispHelp();
|
if (strcmp(p_args[i], "-h") == 0) {
|
||||||
return ERROR_GENERIC;
|
dispHelp();
|
||||||
} else if (strcmp(p_args[i], "-v") == 0) {
|
return ERROR_GENERIC;
|
||||||
opt_ptr->verbose_mode = 1;
|
} else if (strcmp(p_args[i], "-v") == 0) {
|
||||||
printf("[OPTN] Verbose enabled.\n");
|
opt_ptr->verbose_mode = 1;
|
||||||
} else if (strcmp(p_args[i], "-vv") == 0) {
|
printf("[OPTN] Verbose enabled.\n");
|
||||||
opt_ptr->verbose_mode = 1;
|
} else if (strcmp(p_args[i], "-vv") == 0) {
|
||||||
opt_ptr->debug_mode = 1;
|
opt_ptr->verbose_mode = 1;
|
||||||
printf("[OPTN] Debug enabled.\n");
|
opt_ptr->debug_mode = 1;
|
||||||
} else if (strcmp(p_args[i], "-vvv") == 0) {
|
printf("[OPTN] Debug enabled.\n");
|
||||||
opt_ptr->verbose_mode = 1;
|
} else if (strcmp(p_args[i], "-vvv") == 0) {
|
||||||
opt_ptr->debug_mode = 1;
|
opt_ptr->verbose_mode = 1;
|
||||||
opt_ptr->god_mode = 1;
|
opt_ptr->debug_mode = 1;
|
||||||
printf("[OPTN] God damn it!\n");
|
opt_ptr->god_mode = 1;
|
||||||
} else if (strcmp(p_args[i], "-no-subdir") == 0) {
|
printf("[OPTN] God damn it!\n");
|
||||||
opt_ptr->output_dir = 0;
|
} else if (strcmp(p_args[i], "-no-subdir") == 0) {
|
||||||
printf("[OPTN] Export to current directory.\n");
|
opt_ptr->output_dir = 0;
|
||||||
} else if (strcmp(p_args[i], "-mtl") == 0) {
|
printf("[OPTN] Export to current directory.\n");
|
||||||
opt_ptr->export_mtl = 0;
|
} else if (strcmp(p_args[i], "-mtl") == 0) {
|
||||||
printf("[OPTN] No materials datas.\n");
|
opt_ptr->export_mtl = 0;
|
||||||
} else {
|
printf("[OPTN] No materials datas.\n");
|
||||||
printf("[ERR] Unknown option: %s\n", p_args[i]);
|
} else {
|
||||||
}
|
printf("[ERR] Unknown option: %s\n", p_args[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
opt_ptr->input_files_cnt = i;
|
|
||||||
return NO_ERROR;
|
opt_ptr->input_files_cnt = i;
|
||||||
}
|
return NO_ERROR;
|
||||||
|
}
|
||||||
return ERROR_ARGS_NULL;
|
|
||||||
}
|
return ERROR_ARGS_NULL;
|
||||||
|
}
|
||||||
static void createSubDir(char *dirName) {
|
|
||||||
if (dirName == NULL) return;
|
static void createSubDir(char *dirName) {
|
||||||
char _dir[260]; //TODO: Change directory management
|
if (dirName == NULL) return;
|
||||||
strcpy(_dir, dirName);
|
char _dir[260]; //TODO: Change directory management
|
||||||
strcat(_dir, "-out");
|
strcpy(_dir, dirName);
|
||||||
|
strcat(_dir, "-out");
|
||||||
#ifdef _WIN32
|
|
||||||
CreateDirectory(_dir, NULL);
|
#ifdef _WIN32
|
||||||
#else
|
CreateDirectory(_dir, NULL);
|
||||||
mkdir(_dir, 0755);
|
#else
|
||||||
#endif
|
mkdir(_dir, 0755);
|
||||||
}
|
#endif
|
||||||
|
}
|
||||||
static void cleanUpMemory(T_HOB* hobStruct) {
|
|
||||||
int i,j;
|
static void cleanUpMemory(T_HOB* hobStruct) {
|
||||||
|
int i,j;
|
||||||
for ( i=0; i<hobStruct->obj_count; i++ ) {
|
|
||||||
for ( j=0; j<hobStruct->objects[i].face_group_count; j++ ) {
|
for ( i=0; i<hobStruct->obj_count; i++ ) {
|
||||||
|
for ( j=0; j<hobStruct->objects[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[j].faces);
|
||||||
}
|
free(hobStruct->objects[i].object_parts[j].vertices);
|
||||||
|
}
|
||||||
free(hobStruct->objects[i].object_parts);
|
|
||||||
}
|
free(hobStruct->objects[i].object_parts);
|
||||||
|
}
|
||||||
free(hobStruct->objects);
|
|
||||||
free(hobStruct);
|
free(hobStruct->objects);
|
||||||
}
|
free(hobStruct);
|
||||||
|
}
|
||||||
static void dispHelp() {
|
|
||||||
printf("\n");
|
static void dispHelp() {
|
||||||
printf("Options:\n -h Print this message\n");
|
printf("\n");
|
||||||
printf(" -v -vv Activate verbose console output\n");
|
printf("Options:\n -h Print this message\n");
|
||||||
printf(" -no-subdir Export models inside current folder\n");
|
printf(" -v -vv Activate verbose console output\n");
|
||||||
printf(" -no-mtl Disable materials datas export with model\n");
|
printf(" -no-subdir Export models inside current folder\n");
|
||||||
printf("\n");
|
printf(" -no-mtl Disable materials datas export with model\n");
|
||||||
printf("Usage: RSE-Model_%s [options] <hob files...>\n", VERSION);
|
printf("\n");
|
||||||
printf("\n");
|
printf("Usage: RSE-Model_%s [options] <hob files...>\n", VERSION);
|
||||||
}
|
printf("\n");
|
||||||
|
}
|
1
RSEModel/config.h
Normal file
1
RSEModel/config.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#define VERSION "1.0.0"
|
@ -1 +1 @@
|
|||||||
#define VERSION "@PROJECT_VERSION@"
|
#define VERSION "@PROJECT_VERSION@"
|
@ -9,9 +9,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "errors_types.h"
|
#include <errors_types.h>
|
||||||
|
#include <hob_struct.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "hob_struct.h"
|
|
||||||
#include "rlk/obj.h"
|
#include "rlk/obj.h"
|
||||||
#include "obj_exporter.h"
|
#include "obj_exporter.h"
|
||||||
|
|
@ -1,32 +1,32 @@
|
|||||||
/**
|
/**
|
||||||
* \file options.h
|
* \file options.h
|
||||||
* \date 29/07/2022
|
* \date 29/07/2022
|
||||||
* \author JackCarterSmith
|
* \author JackCarterSmith
|
||||||
* \copyright GPL-v3.0
|
* \copyright GPL-v3.0
|
||||||
* \brief Shared options structure definition and declaration.
|
* \brief Shared options structure definition and declaration.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OPTIONS_H_
|
#ifndef OPTIONS_H_
|
||||||
#define OPTIONS_H_
|
#define OPTIONS_H_
|
||||||
|
|
||||||
/// Options structure
|
/// Options structure
|
||||||
typedef union u_prog_options {
|
typedef union u_prog_options {
|
||||||
struct {
|
struct {
|
||||||
unsigned char verbose_mode:1; //!< Output simple details about ID and other "light" things.
|
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 output_dir:1; //!< Export extracted datas to a sub-directory.
|
||||||
unsigned char export_mtl:1; //!< Export materials datas with object.
|
unsigned char export_mtl:1; //!< Export materials datas with object.
|
||||||
|
|
||||||
unsigned char reserved0:5; //!< For future use.
|
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 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 god_mode:1; //!< Dev only. Output experimental values.
|
||||||
|
|
||||||
unsigned char reserved1:6; //!< For future use.
|
unsigned char reserved1:6; //!< For future use.
|
||||||
|
|
||||||
unsigned short input_files_cnt; //!< Internal files counters.
|
unsigned short input_files_cnt; //!< Internal files counters.
|
||||||
};
|
};
|
||||||
unsigned int raw; //!< Raw options access for bit-masking or memory copy/compare.
|
unsigned int raw; //!< Raw options access for bit-masking or memory copy/compare.
|
||||||
} T_PROG_OPTIONS ;
|
} T_PROG_OPTIONS ;
|
||||||
|
|
||||||
#endif /* OPTIONS_H_ */
|
#endif /* OPTIONS_H_ */
|
38
RSPModelLib/CMakeLists.txt
Normal file
38
RSPModelLib/CMakeLists.txt
Normal file
@ -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()
|
1
RSPModelLib/config.h
Normal file
1
RSPModelLib/config.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#define VERSION "1.0.0"
|
1
RSPModelLib/config.h.in
Normal file
1
RSPModelLib/config.h.in
Normal file
@ -0,0 +1 @@
|
|||||||
|
#define VERSION "@PROJECT_VERSION@"
|
@ -15,7 +15,7 @@
|
|||||||
#include "hob_parser.h"
|
#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;
|
unsigned char err = NO_ERROR;
|
||||||
long fileSize;
|
long fileSize;
|
||||||
FILE* fStream = NULL;
|
FILE* fStream = NULL;
|
@ -6,10 +6,13 @@
|
|||||||
* \brief Decode HOB file structure.
|
* \brief Decode HOB file structure.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "options.h"
|
||||||
|
#include "hob_struct.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef SRC_HOB_PARSER_H_
|
#ifndef SRC_HOB_PARSER_H_
|
||||||
#define 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_ */
|
#endif /* SRC_HOB_PARSER_H_ */
|
32
RSPModelLib/options.h
Normal file
32
RSPModelLib/options.h
Normal file
@ -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_ */
|
Loading…
x
Reference in New Issue
Block a user