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"]
|
||||
path = src/rlk
|
||||
[submodule "RSEModel/rlk"]
|
||||
path = RSEModel/rlk
|
||||
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
|
||||
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
|
||||
|
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
|
||||
* \date 25/07/2022
|
||||
* \author JackCarterSmith
|
||||
* \copyright GPL-v3.0
|
||||
* \brief HOB model parser and export to Waveform OBJ format.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#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; 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);
|
||||
}
|
||||
|
||||
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] <hob files...>\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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#include <errors_types.h>
|
||||
#include <hob_struct.h>
|
||||
#include <hob_parser.h>
|
||||
#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; 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);
|
||||
}
|
||||
|
||||
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] <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 <stdio.h>
|
||||
#include <string.h>
|
||||
#include "errors_types.h"
|
||||
#include <errors_types.h>
|
||||
#include <hob_struct.h>
|
||||
#include "options.h"
|
||||
#include "hob_struct.h"
|
||||
#include "rlk/obj.h"
|
||||
#include "obj_exporter.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_ */
|
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"
|
||||
|
||||
|
||||
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;
|
@ -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_ */
|
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