Some checks failed
JCS-Prod/RSE-Model/pipeline/pr-master There was a failure building this commit
> 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
153 lines
4.6 KiB
C
153 lines
4.6 KiB
C
/**
|
|
* @file RSPModel.h
|
|
* @date 18/01/2023
|
|
* @author JackCarterSmith
|
|
* @copyright GPL-v3.0
|
|
* @brief Rogue Squadron Parser model library, used to decode decode datas
|
|
* from original game file and access them through public interface.
|
|
*
|
|
*/
|
|
|
|
#include "RSPModel_datatypes.h"
|
|
|
|
#ifndef RSPMODELLIB_H_
|
|
#define RSPMODELLIB_H_
|
|
|
|
|
|
#if defined(_MSC_VER)
|
|
# define RSPMODEL_ABI_EXPORT __declspec(dllexport)
|
|
# define RSPMODEL_ABI_IMPORT __declspec(dllimport)
|
|
#elif __GNUC__ >= 4
|
|
# define RSPMODEL_ABI_EXPORT __attribute__ ((visibility("default")))
|
|
# define RSPMODEL_ABI_IMPORT __attribute__ ((visibility("default")))
|
|
#else
|
|
# define RSPMODEL_ABI_EXPORT
|
|
# define RSPMODEL_ABI_IMPORT
|
|
#endif
|
|
|
|
#if defined(RSPMODEL_DLL)
|
|
# if defined(WIN32)
|
|
# if defined(RSPMODEL_DLLBUILD)
|
|
# define RSPMODEL_EXTERN extern RSPMODEL_ABI_EXPORT
|
|
# else
|
|
# define RSPMODEL_EXTERN extern RSPMODEL_ABI_IMPORT
|
|
# endif
|
|
# endif
|
|
#endif
|
|
|
|
#ifndef RSPMODEL_EXTERN
|
|
# define RSPMODEL_EXTERN extern
|
|
#endif
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// Library's functions declaration
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
/**
|
|
* @brief Get the current library version.
|
|
* @return Char array of the version, escape char included.
|
|
*/
|
|
RSPMODEL_EXTERN char* RSPModel_getVersion( void );
|
|
|
|
/**
|
|
* @brief Run model parser for the specified file in file system.
|
|
* @details Model library can process HOB file from file system. It's a easy
|
|
* approach using this library for debugging purpose.
|
|
*
|
|
* @param[out] hob HOB structure to be filled with parsed datas.
|
|
* @param[in] filePath Path to the HOB file in system.
|
|
* @param[in] params Parser options. See RSPMODEL_PARAMETERS.
|
|
*
|
|
* @return Error status, return RSPLIB_SUCCESS in nominal case.
|
|
*/
|
|
RSPMODEL_EXTERN unsigned short RSPModel_processHOBFile(
|
|
T_RSPMODEL_HOB* hob, const char* const filePath,
|
|
const RSPMODEL_PARAMETERS params
|
|
);
|
|
|
|
/**
|
|
* @brief Run model parser for the specified file in memory.
|
|
* @details Model library can process HOB file directly stored in RAM memory,
|
|
* you must load the file beforehand through a malloc/memcpy call.
|
|
* @warning No controls routines are implemented to verify file length!
|
|
*
|
|
* @param[out] hob HOB structure to be filled with parsed datas.
|
|
* @param[in] memFilePtr Pointer to the beginning of the file in memory.
|
|
* @param[in] memFileSize Size of the file in bytes.
|
|
* @param[in] params Parser options. See RSPMODEL_PARAMETERS.
|
|
*
|
|
* @return Error status, return RSPLIB_SUCCESS in nominal case.
|
|
*/
|
|
RSPMODEL_EXTERN unsigned short RSPModel_processHOBFileMemory(
|
|
T_RSPMODEL_HOB* hob, const void* const memFilePtr, const long memFileSize,
|
|
const RSPMODEL_PARAMETERS params
|
|
);
|
|
|
|
/**
|
|
* @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 );
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
/**
|
|
* @brief Get number of model objects inside specified memFilePtr without
|
|
* fully parsing it.
|
|
*
|
|
* @param[in] filePath Path to the HOB file in system.
|
|
*
|
|
* @return Number of model objects.
|
|
*/
|
|
RSPMODEL_EXTERN unsigned int RSPModel_getHOBFileObjCount( const char* const filePath );
|
|
|
|
/**
|
|
* @brief Get number of model objects inside specified memFilePtr without
|
|
* fully parsing it.
|
|
*
|
|
* @param[in] memFilePtr Pointer to the beginning of the file in memory.
|
|
*
|
|
* @return Number of model objects.
|
|
*/
|
|
RSPMODEL_EXTERN unsigned int RSPModel_getHOBFileMemObjCount( const void* const memFilePtr );
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
/**
|
|
* @brief Convert HOB's object datas to GL compatible format.
|
|
* @note Only available if GL module as specified at compilation.
|
|
*
|
|
* @param[in] objStruct Object datas from previously parsed HOB file.
|
|
* @param[out] glObj GL structure.
|
|
*
|
|
* @return Error status, return RSPLIB_SUCCESS in nominal case.
|
|
*/
|
|
RSPMODEL_EXTERN unsigned short RSPModel_objectToGL(
|
|
const T_RSPMODEL_OBJECT* objStruct, void* glObj
|
|
);
|
|
|
|
/**
|
|
* @brief Convert HOB's object datas to Direct3D compatible format.
|
|
* @note Only available if D3D module as specified at compilation.
|
|
*
|
|
* @param[in] objStruct Object datas from previously parsed HOB file.
|
|
* @param[out] D3DObj Direct3D structure.
|
|
*
|
|
* @return Error status, return RSPLIB_SUCCESS in nominal case.
|
|
*/
|
|
RSPMODEL_EXTERN unsigned short RSPModel_objectToD3D(
|
|
const T_RSPMODEL_OBJECT* objStruct, void* D3DObj
|
|
);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* RSPMODELLIB_H_ */
|