DLL export patch
All checks were successful
JCS-Prod/RSE-Texture/pipeline/pr-master This commit looks good
JCS-Prod/RSE-Texture/pipeline/head This commit looks good

This commit is contained in:
JackCarterSmith 2022-09-14 19:59:20 +02:00
parent e2b5f4c841
commit 49fa1278ad
Signed by: JackCarterSmith
GPG Key ID: 832E52F4E23F8F24
2 changed files with 27 additions and 5 deletions

View File

@ -1,6 +1,6 @@
/** /**
* @file RSPTexture.h * @file RSPTexture.h
* @date 25/08/2022 * @date 14/09/2022
* @author JackCarterSmith * @author JackCarterSmith
* @copyright GPL-v3.0 * @copyright GPL-v3.0
* @brief Rogue Squadron Parser texture library, used to decode HMT datas * @brief Rogue Squadron Parser texture library, used to decode HMT datas
@ -54,6 +54,10 @@ extern "C" {
*/ */
RSPTEXTURE_EXTERN char* RSPTexture_getVersion( void ); RSPTEXTURE_EXTERN char* RSPTexture_getVersion( void );
/**
* @brief Constructor for T_RSPTEXTURE_HMT struct
* @return Pointer to a new T_RSPTEXTURE_HMT struct.
*/
RSPTEXTURE_EXTERN T_RSPTEXTURE_HMT* RSPTexture_createHMT( void ); RSPTEXTURE_EXTERN T_RSPTEXTURE_HMT* RSPTexture_createHMT( void );
/** /**
@ -104,10 +108,24 @@ RSPTEXTURE_EXTERN T_RSPTEXTURE_MATERIAL* RSPTexture_getMaterialFromID(
const T_RSPTEXTURE_HMT* pHmt, const unsigned short mat_id const T_RSPTEXTURE_HMT* pHmt, const unsigned short mat_id
); );
/**
* @brief Retrieve material name of a T_RSPTEXTURE_MATERIAL structure.
* @return '0' terminated name string (max: 16 chars).
*/
RSPTEXTURE_EXTERN char* RSPTexture_getMaterialName( const T_RSPTEXTURE_MATERIAL* mat ); RSPTEXTURE_EXTERN char* RSPTexture_getMaterialName( const T_RSPTEXTURE_MATERIAL* mat );
/**
* @brief Retrieve opacity value from T_RSPTEXTURE_MATERIAL structure.
* @return Float opacity value.
* @warning Experimental method.
*/
RSPTEXTURE_EXTERN float RSPTexture_getMaterialOpacity( const T_RSPTEXTURE_MATERIAL* mat ); RSPTEXTURE_EXTERN float RSPTexture_getMaterialOpacity( const T_RSPTEXTURE_MATERIAL* mat );
/**
* @brief Retrieve ambient light value from T_RSPTEXTURE_MATERIAL structure.
* @return Float ambient light value.
* @warning Experimental method.
*/
RSPTEXTURE_EXTERN float RSPTexture_getMaterialAmbient( const T_RSPTEXTURE_MATERIAL* mat ); RSPTEXTURE_EXTERN float RSPTexture_getMaterialAmbient( const T_RSPTEXTURE_MATERIAL* mat );
/** /**

View File

@ -1,12 +1,16 @@
/** /**
* @file RSPTexture.c * @file RSPTexture.c
* @date 31/08/2022 * @date 14/09/2022
* @author JackCarterSmith * @author JackCarterSmith
* @copyright GPL-v3.0 * @copyright GPL-v3.0
* @brief HMT textures datas parser and export to PNG format. * @brief HMT textures datas parser and export to PNG format.
* *
*/ */
#if defined(RSPTEXTURE_DLL)
# define RSPTEXTURE_DLLBUILD
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -57,19 +61,19 @@ T_RSPTEXTURE_MATERIAL* RSPTexture_getMaterialFromID( const T_RSPTEXTURE_HMT* pHm
return &(pHmt->materials[mat_id]); return &(pHmt->materials[mat_id]);
} }
char* RSPTexture_getMaterialName( const T_RSPTEXTURE_MATERIAL* mat ) { inline char* RSPTexture_getMaterialName( const T_RSPTEXTURE_MATERIAL* mat ) {
if ( mat == NULL ) return NULL; if ( mat == NULL ) return NULL;
return (char*)mat->name; return (char*)mat->name;
} }
float RSPTexture_getMaterialOpacity( const T_RSPTEXTURE_MATERIAL* mat ) { inline float RSPTexture_getMaterialOpacity( const T_RSPTEXTURE_MATERIAL* mat ) {
if ( mat == NULL ) return 1.0; if ( mat == NULL ) return 1.0;
return mat->opacity; return mat->opacity;
} }
float RSPTexture_getMaterialAmbient( const T_RSPTEXTURE_MATERIAL* mat ) { inline float RSPTexture_getMaterialAmbient( const T_RSPTEXTURE_MATERIAL* mat ) {
if ( mat == NULL ) return 1.0; if ( mat == NULL ) return 1.0;
return mat->ambient; return mat->ambient;