122 lines
3.6 KiB
C

/**
* @file RSPModel.h
* @date 11/08/2022
* @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 RSPMODEL_H_
#define RSPMODEL_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 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 /* RSPMODEL_H_ */