Final review of the library after test work #15

Merged
JackCarterSmith merged 3 commits from develop into master 2022-08-24 18:56:42 +02:00
16 changed files with 187 additions and 159 deletions

View File

@ -20,7 +20,7 @@ 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_MODEL_NAME $ENV{CI_OUTPUT_NAME})
else() # Standalone project mode, should not be used for release.
project(rse-model VERSION 2.0.0 DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C)
project(rse-model VERSION 2.1.0 DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C)
set(RSE_MODEL_NAME RSEModel)
endif()
set(RSP_MODEL_LIB_NAME RSPModel${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR})

157
Jenkinsfile vendored
View File

@ -1,80 +1,79 @@
pipeline {
agent any
options {
skipDefaultCheckout(true)
}
environment {
CI_OUTPUT_NAME = "RSEModel"
CI_VERSION = "2.0.0"
CI_BUILD_NUMBER = "$BUILD_NUMBER"
}
stages {
stage('Prepare') {
steps {
cleanWs()
rtConanClient(id: "conan", userHome: "/home/jackcartersmith")
}
}
stage('Build') {
steps {
parallel(
linux: {
dir("linux") {
checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Model'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Model.git']]])
sh 'git submodule update --init --recursive'
dir("build") {
rtConanRun(clientId: "conan", command: "install .. --build=missing")
}
cmakeBuild buildDir: 'build', installation: 'latest', steps: [[args: 'all']]
}
},
windows: {
dir("windows") {
checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Model'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Model.git']]])
sh 'git submodule update --init --recursive'
dir("build") {
rtConanRun(clientId: "conan", command: "install .. --profile=windows --build=missing")
}
cmakeBuild buildDir: 'build', cmakeArgs: '-DGNU_HOST=x86_64-w64-mingw32 -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw_cross_toolchain.cmake', installation: 'latest', steps: [[args: 'all']]
}
}
)
}
}
stage('Deploy') {
steps {
dir("zip_linux") {
sh 'cp -R ../linux/build/bin ../linux/build/lib ../linux/RSPModelLib/include .'
}
dir("zip_win") {
sh 'cp -R ../windows/build/bin ../windows/build/lib ../windows/RSPModelLib/include .'
}
zip archive: false, dir: 'zip_linux', exclude: '', glob: '', zipFile: 'linux_x64.zip'
sh 'mv linux_x64.zip ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_Linux_x86_64.zip'
zip archive: false, dir: 'zip_win', exclude: '', glob: '', zipFile: 'mingw64.zip'
sh 'mv mingw64.zip ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_mingw64.zip'
archiveArtifacts(artifacts: '*.zip')
fingerprint(targets: '*.zip')
}
}
stage('Sign') {
steps {
sh 'ls -l'
sh 'gpg --batch --detach-sign -o ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_Linux_x86_64.zip.gpg ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_Linux_x86_64.zip'
sh 'gpg --batch --detach-sign -o ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_mingw64.zip.gpg ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_mingw64.zip'
archiveArtifacts(artifacts: '*.gpg')
fingerprint(targets: '*.gpg')
}
}
}
/*
post {
always {
cleanWs(cleanWhenNotBuilt: false,
deleteDirs: true,
disableDeferredWipeout: true,
notFailBuild: true)
}
}
*/
}
agent any
options {
skipDefaultCheckout(true)
}
environment {
CI_OUTPUT_NAME = "RSEModel"
CI_VERSION = "2.1.0"
CI_BUILD_NUMBER = "$BUILD_NUMBER"
}
stages {
stage('Prepare') {
steps {
cleanWs()
rtConanClient(id: "conan", userHome: "/home/jackcartersmith")
}
}
stage('Build') {
steps {
parallel(
linux: {
dir("linux") {
checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Model'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Model.git']]])
sh 'git submodule update --init --recursive'
dir("build") {
rtConanRun(clientId: "conan", command: "install .. --build=missing")
}
cmakeBuild buildDir: 'build', installation: 'latest', steps: [[args: 'all']]
}
},
windows: {
dir("windows") {
checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Model'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Model.git']]])
sh 'git submodule update --init --recursive'
dir("build") {
rtConanRun(clientId: "conan", command: "install .. --profile=windows --build=missing")
}
cmakeBuild buildDir: 'build', cmakeArgs: '-DGNU_HOST=x86_64-w64-mingw32 -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw_cross_toolchain.cmake', installation: 'latest', steps: [[args: 'all']]
}
}
)
}
}
stage('Deploy') {
steps {
dir("zip_linux") {
sh 'cp -R ../linux/build/bin ../linux/build/lib ../linux/RSPModelLib/include .'
}
dir("zip_win") {
sh 'cp -R ../windows/build/bin ../windows/build/lib ../windows/RSPModelLib/include .'
}
zip archive: false, dir: 'zip_linux', exclude: '', glob: '', zipFile: 'linux_x64.zip'
sh 'mv linux_x64.zip ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_Linux_x86_64.zip'
zip archive: false, dir: 'zip_win', exclude: '', glob: '', zipFile: 'mingw64.zip'
sh 'mv mingw64.zip ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_mingw64.zip'
archiveArtifacts(artifacts: '*.zip')
fingerprint(targets: '*.zip')
}
}
stage('Sign') {
steps {
sh 'gpg --batch --detach-sign -o ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_Linux_x86_64.zip.gpg ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_Linux_x86_64.zip'
sh 'gpg --batch --detach-sign -o ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_mingw64.zip.gpg ${CI_OUTPUT_NAME}_${CI_VERSION}.${BUILD_NUMBER}_mingw64.zip'
archiveArtifacts(artifacts: '*.gpg')
fingerprint(targets: '*.gpg')
}
}
}
/*
post {
always {
cleanWs(cleanWhenNotBuilt: false,
deleteDirs: true,
disableDeferredWipeout: true,
notFailBuild: true)
}
}
*/
}

View File

@ -19,8 +19,7 @@
#include "options.h"
#include <RSPModel.h>
#include <RSPModel_errordefs.h>
#include "obj_exporter.h"
#include "model_export.h"
/*
@ -29,8 +28,7 @@
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_RSPMODEL_HOB* hobStruct);
static unsigned short checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]);
static void dispHelp();
@ -42,7 +40,7 @@ int main(int argc, char *argv[]) {
unsigned char p;
// Hello world!
printf("\n*** RogueSquadron Extractor (RSE) - MODEL module - RSPModelLib v%s ***\n", RSPModel_getVersion());
printf("\n*~[ Rogue Squadron Extractor (RSE) - RSPModelLib v%s ]~*\n", RSPModel_getVersion());
// Check for arguments
if (argc < 2) {
@ -76,32 +74,37 @@ static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS
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]);
// Allocate T_RSPMODEL_HOB structure to store extracted datas.
hobStruct = calloc(1, sizeof(T_RSPMODEL_HOB));
// Parse data from HOB file and put in T_HOB structure.
if (RSPModel_processHOBFile(hobStruct, args_value[file_index], libParams) != RSPLIB_SUCCESS) {
printf("[ERR] Failed to parse datas from %s\n", args_value[file_index]);
free(hobStruct);
return RSPLIB_ERROR_PROCESS;
}
if (hobStruct) {
// Parse data from HOB file and put in T_RSPMODEL_HOB structure.
if (RSPModel_processHOBFile(hobStruct, args_value[file_index], libParams) != RSPLIB_SUCCESS) {
printf("[ERR] Failed to parse datas from %s\n", args_value[file_index]);
RSPModel_freeHOB(hobStruct);
return RSPLIB_ERROR_PROCESS;
}
} else return RSPLIB_ERROR_MEMORY;
if (hobStruct->obj_count > 0) {
// Create output folders structure.
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) != RSPLIB_SUCCESS)
printf("[ERR] Failed to export %s object in OBJ format!\n", hobStruct->objects[i].name);
else
if (exportOBJModel(&(hobStruct->objects[i]), args_value[file_index], p_opts) == RSPLIB_SUCCESS)
printf("[INFO] Successfully exported %s object in OBJ format.\n", hobStruct->objects[i].name);
else
printf("[ERR] Failed to export %s object in OBJ format!\n", hobStruct->objects[i].name);
}
}
}
cleanUpMemory(hobStruct);
RSPModel_freeHOB(hobStruct);
return RSPLIB_SUCCESS;
}
static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]) {
static unsigned short checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]) {
char test[256];
int i;
@ -159,23 +162,6 @@ static void createSubDir(char *dirName) {
#endif
}
static void cleanUpMemory(T_RSPMODEL_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");

View File

@ -1,5 +1,5 @@
/**
* @file obj_exporter.c
* @file model_export.c
* @date 27/07/2022
* @author JackCarterSmith
* @copyright GPL-v3.0
@ -14,11 +14,11 @@
#include <RSPModel_datatypes.h>
#include <RSPModel_errordefs.h>
#include "obj/obj.h"
#include "obj_exporter.h"
#include "model_export.h"
unsigned char exportOBJModel(T_RSPMODEL_OBJECT* hob_objects, const char *out_path, T_PROG_OPTIONS* p_opts) {
char exportPath[1024];
char export_path[1024];
char objExport_name[128];
char mtlExport_name[128];
obj* objConstruct = NULL;
@ -32,9 +32,9 @@ unsigned char exportOBJModel(T_RSPMODEL_OBJECT* hob_objects, const char *out_pat
return RSPLIB_ERROR_ARGS_NULL;
#ifdef _WIN32
snprintf(exportPath, 1024, "%s-out\\", out_path);
snprintf(export_path, 1024, "%s-out\\", out_path);
#else
snprintf(exportPath, 1024, "%s-out/", out_path);
snprintf(export_path, 1024, "%s-out/", out_path);
#endif
snprintf(objExport_name, 128, "%s.obj", hob_objects->name);
snprintf(mtlExport_name, 128, "%s.mtl", hob_objects->name);
@ -42,7 +42,7 @@ unsigned char exportOBJModel(T_RSPMODEL_OBJECT* hob_objects, const char *out_pat
objConstruct = obj_create(NULL);
// Build face/surface material group
for ( i = 0; i < hob_objects->face_group_count; i++) {
for ( i = 0; i < hob_objects->object_part_count; i++) {
surfID = obj_add_surf(objConstruct);
materialID = obj_add_mtrl(objConstruct);
@ -101,12 +101,12 @@ unsigned char exportOBJModel(T_RSPMODEL_OBJECT* hob_objects, const char *out_pat
if (p_opts->export_mtl) {
if (p_opts->output_dir)
obj_write(objConstruct, objExport_name, mtlExport_name, exportPath, 8);
obj_write(objConstruct, objExport_name, mtlExport_name, export_path, 8);
else
obj_write(objConstruct, objExport_name, mtlExport_name, NULL, 8);
} else {
if (p_opts->output_dir)
obj_write(objConstruct, objExport_name, NULL, exportPath, 8);
obj_write(objConstruct, objExport_name, NULL, export_path, 8);
else
obj_write(objConstruct, objExport_name, NULL, NULL, 8);
}

View File

@ -1,5 +1,5 @@
/**
* @file obj_exporter.h
* @file model_export.h
* @date 27/07/2022
* @author JackCarterSmith
* @copyright GPL-v3.0
@ -7,8 +7,8 @@
*
*/
#ifndef SRC_OBJ_EXPORTER_H_
#define SRC_OBJ_EXPORTER_H_
#ifndef MODEL_EXPORT_H_
#define MODEL_EXPORT_H_
typedef struct t_material {
@ -19,4 +19,4 @@ typedef struct t_material {
unsigned char exportOBJModel(T_RSPMODEL_OBJECT* hob_objects, const char *out_path, T_PROG_OPTIONS* p_opts);
#endif /* SRC_OBJ_EXPORTER_H_ */
#endif /* MODEL_EXPORT_H_ */

@ -1 +1 @@
Subproject commit 63f5977aaed661f6176daca101680bfcd80e80ec
Subproject commit 59191c204ab030aabc34cf758efefdaf2de65401

View File

@ -20,7 +20,7 @@ typedef union u_prog_options {
unsigned char output_dir:1; //!< Export extracted datas to a sub-directory.
unsigned char export_mtl:1; //!< Export materials datas with object.
unsigned short reserved0:11; //!< For future use.
unsigned short reserved0:11; //!< For future use.
unsigned short input_files_cnt; //!< Internal files counters.
};

View File

@ -22,7 +22,7 @@ file(GLOB RSP_PUBLIC_HRDS ./include/*.h)
set(RSP_PUBLIC_HRDS ${RSP_PUBLIC_HRDS} PARENT_SCOPE)
# Building instructions for RSE-Model
# Building instructions for RSP-Model library
if(DEFINED ENV{CI})
set(CMAKE_BUILD_TYPE RELEASE)
endif()

View File

@ -10,8 +10,8 @@
#include "RSPModel_datatypes.h"
#ifndef RSPMODEL_H_
#define RSPMODEL_H_
#ifndef RSPMODELLIB_H_
#define RSPMODELLIB_H_
#if defined(_MSC_VER)
@ -114,8 +114,14 @@ RSPMODEL_EXTERN unsigned short RSPModel_objectToD3D(
const T_RSPMODEL_OBJECT* objStruct, void* D3DObj
);
/**
* @brief Clean HOB object and it's childrens from memory.
* @param[in] hobStruct Pointer to data to be cleaned up.
*/
RSPMODEL_EXTERN void RSPModel_freeHOB( T_RSPMODEL_HOB* hobStruct );
#ifdef __cplusplus
}
#endif
#endif /* RSPMODEL_H_ */
#endif /* RSPMODELLIB_H_ */

View File

@ -7,8 +7,8 @@
*
*/
#ifndef RSPMODEL_DATATYPES_H_
#define RSPMODEL_DATATYPES_H_
#ifndef RSPMODELLIB_DATATYPES_H_
#define RSPMODELLIB_DATATYPES_H_
#ifdef __cplusplus
extern "C" {
@ -34,15 +34,25 @@ typedef union u_rspmodel_parameters {
// Lib's structure definitions
////////////////////////////////////////////////////////////////////////////////
#ifndef MEMFILE
typedef char* MEMFILE;
#endif
#ifndef T_RGBA
typedef unsigned int T_RGBA;
#endif
#ifndef T_VECTOR3
typedef struct vector3 { float x,y,z; } T_VECTOR3;
#endif
#ifndef T_VERTEX
typedef struct vertex { short x,y,z,w; } T_VERTEX;
#endif
#ifndef T_TEXCOORD
typedef struct tex_coord { unsigned short u,v; } T_TEXCOORD;
#endif
typedef struct face_flags {
unsigned int fUnknown0:1;
@ -119,4 +129,4 @@ typedef struct rspmodel_hob {
}
#endif
#endif /* RSPMODEL_DATATYPES_H_ */
#endif /* RSPMODELLIB_DATATYPES_H_ */

View File

@ -10,8 +10,8 @@
#include <stdlib.h>
#ifndef RSPMODELLIB_ERRORS_H_
#define RSPMODELLIB_ERRORS_H_
#ifndef RSPLIB_ERRORS_H_
#define RSPLIB_ERRORS_H_
#ifdef __cplusplus
extern "C" {
@ -42,4 +42,4 @@ extern "C" {
}
#endif
#endif /* RSPMODELLIB_ERRORS_H_ */
#endif /* RSPLIB_ERRORS_H_ */

View File

@ -7,11 +7,12 @@
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "RSPModel_errordefs.h"
#include "RSPModel_datatypes.h"
#include "hob_parser.h"
#include "RSPModel.h"
@ -55,3 +56,28 @@ unsigned short RSPModel_objectToD3D( const T_RSPMODEL_OBJECT* objStruct, void* D
return RSPLIB_SUCCESS;
}
void RSPModel_freeHOB( T_RSPMODEL_HOB* hobStruct ) {
int i,j;
if (hobStruct == NULL) return;
if (hobStruct->objects) {
for ( i=0; i<hobStruct->obj_count; i++ ) {
if (hobStruct->objects[i].object_parts) {
for ( j=0; j<hobStruct->objects[i].face_group_count; j++ ) {
if (hobStruct->objects[i].object_parts[j].faces)
free(hobStruct->objects[i].object_parts[j].faces);
if (hobStruct->objects[i].object_parts[j].vertices)
free(hobStruct->objects[i].object_parts[j].vertices);
}
free(hobStruct->objects[i].object_parts);
}
}
free(hobStruct->objects);
}
free(hobStruct);
}

View File

@ -20,18 +20,18 @@
// Private functions declarations
////////////////////////////////////////////////////////////////////////////////
static unsigned int ExtractObjects(T_RSPMODEL_HOB*, const MEMFILE, const RSPMODEL_PARAMETERS*);
static unsigned int ExtractObjParts(T_RSPMODEL_OBJECT*, const MEMFILE, const RSPMODEL_PARAMETERS*);
static unsigned int ExtractObjParts_faces(T_RSPMODEL_OBJ_PARTS*, const MEMFILE, const RSPMODEL_PARAMETERS*);
static inline unsigned int ExtractObjpart_Face_Colors(T_RSPMODEL_FACE*, const char*);
static inline unsigned int ExtractObjpart_Face_UVMaps(T_RSPMODEL_FACE*, const char*);
static unsigned short ExtractObjects(T_RSPMODEL_HOB*, const MEMFILE, const RSPMODEL_PARAMETERS*);
static unsigned short ExtractObjParts(T_RSPMODEL_OBJECT*, const MEMFILE, const RSPMODEL_PARAMETERS*);
static unsigned short ExtractObjParts_faces(T_RSPMODEL_OBJ_PARTS*, const MEMFILE, const RSPMODEL_PARAMETERS*);
static unsigned short ExtractObjpart_Face_Colors(T_RSPMODEL_FACE*, const char*);
static unsigned short ExtractObjpart_Face_UVMaps(T_RSPMODEL_FACE*, const char*);
////////////////////////////////////////////////////////////////////////////////
// Public functions definition
////////////////////////////////////////////////////////////////////////////////
unsigned char RSP_ModelLib_ParseHOBMemFile(const MEMFILE pMemFile, T_RSPMODEL_HOB* hobStruct, const RSPMODEL_PARAMETERS* pParams) {
unsigned short RSP_ModelLib_ParseHOBMemFile(const MEMFILE pMemFile, T_RSPMODEL_HOB* hobStruct, const RSPMODEL_PARAMETERS* pParams) {
unsigned char err = RSPLIB_SUCCESS;
if (hobStruct != NULL && pMemFile != NULL) {
@ -42,7 +42,7 @@ unsigned char RSP_ModelLib_ParseHOBMemFile(const MEMFILE pMemFile, T_RSPMODEL_HO
return err;
}
unsigned char RSP_ModelLib_ParseHOBFile(const char* fileName, T_RSPMODEL_HOB* hobStruct, const RSPMODEL_PARAMETERS* pParams) {
unsigned short RSP_ModelLib_ParseHOBFile(const char* fileName, T_RSPMODEL_HOB* hobStruct, const RSPMODEL_PARAMETERS* pParams) {
unsigned char err = RSPLIB_SUCCESS;
long fileSize;
FILE* fStream = NULL;
@ -94,11 +94,11 @@ unsigned char RSP_ModelLib_ParseHOBFile(const char* fileName, T_RSPMODEL_HOB* ho
*
* @param[in|out] pHobStruct Take root hob structure to get the T_RSPMODEL_OBJECT buffer and header datas.
* @param[in] pMemfile Pointer to an in-memory file location.
* @param[in] verbose
* @param[in] pParams Program option, used to tune parser features.
*
* @return Error code, RSPLIB_SUCCESS when no error.
*/
static unsigned int ExtractObjects(T_RSPMODEL_HOB* pHobStruct, const MEMFILE pMemfile, const RSPMODEL_PARAMETERS* pParams) {
static unsigned short ExtractObjects(T_RSPMODEL_HOB* pHobStruct, const MEMFILE pMemfile, const RSPMODEL_PARAMETERS* pParams) {
unsigned int i;
if (pHobStruct == NULL || pMemfile == NULL) return RSPLIB_ERROR_ARGS_NULL;
@ -151,6 +151,7 @@ static unsigned int ExtractObjects(T_RSPMODEL_HOB* pHobStruct, const MEMFILE pMe
pHobStruct->objects[i].face_group_count = ((T_HOBFILE_FACEGROUP_HEADER *)(pMemfile
+ pHobStruct->objects[i].object_part_header_offset))->facegroup_count;
if (pParams->verbose_mode) printf("[DBG] > Face groups count: %d\n", pHobStruct->objects[i].face_group_count);
//TODO: Caution with obj/facegrp count difference. What is facegroup count???
if (pHobStruct->objects[i].object_part_count != pHobStruct->objects[i].face_group_count && (pParams->verbose_mode))
printf("[DBG] > Object parts / facegroup count are different!\n");
@ -166,11 +167,11 @@ static unsigned int ExtractObjects(T_RSPMODEL_HOB* pHobStruct, const MEMFILE pMe
*
* @param[in|out] pObject Take object structure to get the T_RSPMODEL_OBJ_PARTS buffer and object datas.
* @param[in] pMemfile Pointer to an in-memory file location.
* @param[in] verbose
* @param[in] pParams Program option, used to tune parser features.
*
* @return Error code, RSPLIB_SUCCESS when no error.
*/
static unsigned int ExtractObjParts(T_RSPMODEL_OBJECT* pObject, const MEMFILE pMemfile, const RSPMODEL_PARAMETERS* pParams) {
static unsigned short ExtractObjParts(T_RSPMODEL_OBJECT* pObject, const MEMFILE pMemfile, const RSPMODEL_PARAMETERS* pParams) {
unsigned int i, subpart_offset = 0;
if (pObject == NULL || pMemfile == NULL) return RSPLIB_ERROR_ARGS_NULL;
@ -247,11 +248,11 @@ static unsigned int ExtractObjParts(T_RSPMODEL_OBJECT* pObject, const MEMFILE pM
*
* @param[in|out] pObjPart Take object sub-part structure to get the T_RSPMODEL_FACE buffer and object sub-part datas.
* @param[in] pMemfile Pointer to an in-memory file location.
* @param[in] verbose
* @param[in] pParams Program option, used to tune parser features.
*
* @return Error code, RSPLIB_SUCCESS when no error.
*/
static unsigned int ExtractObjParts_faces(T_RSPMODEL_OBJ_PARTS* pObjPart, const MEMFILE pMemfile, const RSPMODEL_PARAMETERS* pParams) {
static unsigned short ExtractObjParts_faces(T_RSPMODEL_OBJ_PARTS* pObjPart, const MEMFILE pMemfile, const RSPMODEL_PARAMETERS* pParams) {
unsigned int i, facesExtraOffset = 0;
if (pObjPart == NULL || pMemfile == NULL) return RSPLIB_ERROR_ARGS_NULL;
@ -389,7 +390,7 @@ static unsigned int ExtractObjParts_faces(T_RSPMODEL_OBJ_PARTS* pObjPart, const
*
* @return The size of processed data. Used to count new offset between each face in object sub-part.
*/
static inline unsigned int ExtractObjpart_Face_Colors(T_RSPMODEL_FACE* pFace, const char* pFaceMemFileOffset) {
static unsigned short ExtractObjpart_Face_Colors(T_RSPMODEL_FACE* pFace, const char* pFaceMemFileOffset) {
unsigned int dynOffset = 0;
if (pFace->flags_bits.fSeparateColorVertex) {
@ -422,7 +423,7 @@ static inline unsigned int ExtractObjpart_Face_Colors(T_RSPMODEL_FACE* pFace, co
*
* @return The size of processed data. Used to count new offset between each face in object sub-part.
*/
static inline unsigned int ExtractObjpart_Face_UVMaps(T_RSPMODEL_FACE* pFace, const char* pFaceMemFileOffset) {
static unsigned short ExtractObjpart_Face_UVMaps(T_RSPMODEL_FACE* pFace, const char* pFaceMemFileOffset) {
unsigned int dynOffset = 0;
pFace->tex_coords[0] = ((T_HOBFILE_FACES_VERTEX_TEXTURE *)(pFaceMemFileOffset))->v1_texcoord;

View File

@ -10,8 +10,8 @@
#include "RSPModel_datatypes.h"
#ifndef SRC_HOB_PARSER_H_
#define SRC_HOB_PARSER_H_
#ifndef RSPMODELLIB_HOB_PARSER_H_
#define RSPMODELLIB_HOB_PARSER_H_
/**
* @brief Process HOB file stored in memory.
@ -26,7 +26,7 @@
*
* @return Processing error code, RSPLIB_SUCCESS if no error.
*/
unsigned char RSP_ModelLib_ParseHOBMemFile(const MEMFILE pMemFile,
unsigned short RSP_ModelLib_ParseHOBMemFile(const MEMFILE pMemFile,
T_RSPMODEL_HOB* hobStruct, const RSPMODEL_PARAMETERS* pParams);
/**
@ -45,7 +45,7 @@ unsigned char RSP_ModelLib_ParseHOBMemFile(const MEMFILE pMemFile,
*
* @return Processing error code, RSPLIB_SUCCESS if no error.
*/
unsigned char RSP_ModelLib_ParseHOBFile(const char* fileName,
unsigned short RSP_ModelLib_ParseHOBFile(const char* fileName,
T_RSPMODEL_HOB* hobStruct, const RSPMODEL_PARAMETERS* pParams);
#endif /* SRC_HOB_PARSER_H_ */
#endif /* RSPMODELLIB_HOB_PARSER_H_ */

View File

@ -38,7 +38,7 @@ PROJECT_NAME = RSE-Model
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 1.0.0
PROJECT_NUMBER = 2.1.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a