RSE-Model/RSPModelLib/src/hob_parser.h
JackCarterSmith d40a9f921c
Some checks failed
JCS-Prod/RSE-Model/pipeline/pr-master There was a failure building this commit
Minor feature update
> New Load/Free mecanism for file memory management
> Added prototype of simple header parser for fast infos access
> Fix seg. fault when forcing mtl export without RSPTextureLib dll
> Added dependencies to Vulkan driver
2023-01-18 19:07:09 +01:00

65 lines
2.0 KiB
C

/**
* @file hob_parser.h
* @date 18/01/2023
* @author JackCarterSmith
* @copyright GPL-v3.0
* @brief Process HOB file structure and extract its datas.
*
*/
#include "RSPModel_datatypes.h"
#include "hob_struct.h"
#ifndef RSPMODELLIB_HOB_PARSER_H_
#define RSPMODELLIB_HOB_PARSER_H_
/**
* @brief Process HOB file stored in memory.
* @details Parser will directly extract objects count and information stored in
* HOB file and store them in T_RSPMODEL_HOB structure.
* @note Unmanaged mode
*
* @param[out] hobStruct Allocated empty T_RSPMODEL_HOB structure instance to
* be filled with HOB datas.
* @param[in] pMemFile Pointer to an in-memory HOB file location.
* @param[in] pParams Parser options. See RSPMODEL_PARAMETERS.
*
* @return Processing error code, RSPLIB_SUCCESS if no error.
*/
unsigned short RSP_ModelLib_ProcessHOBMemFile(T_RSPMODEL_HOB* hobStruct,
const MEMFILE pMemFile, const RSPMODEL_PARAMETERS* pParams);
/**
* @brief Load file in memory and store it access in pointer.
*
* @param[out newMemFile Newly created HOB file pointer, NULL if failure.
* @param[in] fileName File path in the filesystem.
* @param[in] pParams Parser options. See RSPMODEL_PARAMETERS.
*
* @return Processing error code, RSPLIB_SUCCESS if no error.
*/
unsigned short RSP_ModelLib_LoadHOBFile(MEMFILE* newMemFile, const char* fileName, const RSPMODEL_PARAMETERS* pParams);
/**
* @brief Clean memory of file created with RSP_ModelLib_LoadHOBFile().
*
* @param[in] memFile Pointer to an in-memory HOB file location.
*
* @return Processing error code, RSPLIB_SUCCESS if no error.
*/
unsigned short RSP_ModelLib_FreeHOBFile(const MEMFILE* memFile);
/**
* @brief Return number of model objects inside specified pMemfile.
*
* @param[in] pMemfile Pointer to an in-memory HOB file location.
*
* @return Number of model objects
*/
static inline unsigned int RSP_ModelLib_getObjectsCount(const MEMFILE pMemfile) {
return ((T_HOBFILE_HEADER*)pMemfile)->obj_count;
}
#endif /* RSPMODELLIB_HOB_PARSER_H_ */