/** * @file RSPTerrain.h * @date 22/08/2022 * @author JackCarterSmith * @copyright GPL-v3.0 * @brief Rogue Squadron Parser terrain library, used to decode decode datas * from original game file and access them through public interface. * */ #include "RSPTerrain_datatypes.h" #ifndef RSPTERRAINLIB_H_ #define RSPTERRAINLIB_H_ #if defined(_MSC_VER) # define RSPTERRAIN_ABI_EXPORT __declspec(dllexport) # define RSPTERRAIN_ABI_IMPORT __declspec(dllimport) #elif __GNUC__ >= 4 # define RSPTERRAIN_ABI_EXPORT __attribute__ ((visibility("default"))) # define RSPTERRAIN_ABI_IMPORT __attribute__ ((visibility("default"))) #else # define RSPTERRAIN_ABI_EXPORT # define RSPTERRAIN_ABI_IMPORT #endif #if defined(RSPTERRAIN_DLL) # if defined(WIN32) # if defined(RSPTERRAIN_DLLBUILD) # define RSPTERRAIN_EXTERN extern RSPTERRAIN_ABI_EXPORT # else # define RSPTERRAIN_EXTERN extern RSPTERRAIN_ABI_IMPORT # endif # endif #endif #ifndef RSPTERRAIN_EXTERN # define RSPTERRAIN_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. */ RSPTERRAIN_EXTERN char* RSPTerrain_getVersion( void ); /** * @brief Run terrain parser for the specified file in file system. * @details Model library can process HMP file from file system. It's a easy * approach using this library for debugging purpose. * * @param[out] terrainObj Terrain structure to be filled with parsed datas. * @param[in] filePath Path to the HMP file in system. * @param[in] params Parser options. See RSPMODEL_PARAMETERS. * * @return Error status, return RSPLIB_SUCCESS in nominal case. */ RSPTERRAIN_EXTERN unsigned short RSPTerrain_processHMPFile( T_RSPTERRAIN_TERRAIN_OBJ* terrainObj, const char* const filePath, const RSPTERRAIN_PARAMETERS params ); /** * @brief Run terrain parser for the specified file in memory. * @details Model library can process HMP 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] terrainObj Terrain 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. */ RSPTERRAIN_EXTERN unsigned short RSPTerrain_processHMPFileMemory( T_RSPTERRAIN_TERRAIN_OBJ* terrainObj, const void* const memFilePtr, const long memFileSize, const RSPTERRAIN_PARAMETERS params ); /** * @brief Convert terrain object to GL compatible format. * @note Only available if GL module as specified at compilation. * * @param[in] terrainObj Terrain datas from previously parsed HMP file. * @param[out] glTerrainObj GL structure. * * @return Error status, return RSPLIB_SUCCESS in nominal case. */ RSPTERRAIN_EXTERN unsigned short RSPTerrain_terrainToGL( const T_RSPTERRAIN_TERRAIN_OBJ* terrainObj, void* glTerrainObj ); /** * @brief Convert terrain object to Direct3D compatible format. * @note Only available if D3D module as specified at compilation. * * @param[in] terrainObj Terrain datas from previously parsed HMP file. * @param[out] D3DTerrainObj Direct3D structure. * * @return Error status, return RSPLIB_SUCCESS in nominal case. */ RSPTERRAIN_EXTERN unsigned short RSPTerrain_terrainToD3D( const T_RSPTERRAIN_TERRAIN_OBJ* terrainObj, void* D3DTerrainObj ); #ifdef __cplusplus } #endif #endif /* RSPTERRAINLIB_H_ */