Reviewed material resolver
This commit is contained in:
parent
3ffc546e1e
commit
4e8da870d9
4
.gitignore
vendored
4
.gitignore
vendored
@ -15,8 +15,8 @@
|
|||||||
# Precompiled Headers
|
# Precompiled Headers
|
||||||
*.gch
|
*.gch
|
||||||
*.pch
|
*.pch
|
||||||
RSPTerrainLib/src/config.h
|
RSPTextureLib/src/config.h
|
||||||
RSETerrain/src/config.h
|
RSETexture/src/config.h
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
*.lib
|
*.lib
|
||||||
|
@ -20,7 +20,7 @@ if(DEFINED ENV{CI}) # Jenkins CI integration mode
|
|||||||
project(rse-texture VERSION $ENV{CI_VERSION}.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
|
project(rse-texture VERSION $ENV{CI_VERSION}.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
|
||||||
set(RSE_TEXTURE_NAME $ENV{CI_OUTPUT_NAME})
|
set(RSE_TEXTURE_NAME $ENV{CI_OUTPUT_NAME})
|
||||||
else() # Standalone project mode, should not be used for release.
|
else() # Standalone project mode, should not be used for release.
|
||||||
project(rse-texture VERSION 2.0.0 DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
|
project(rse-texture VERSION 2.1.0 DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
|
||||||
set(RSE_TEXTURE_NAME RSETexture)
|
set(RSE_TEXTURE_NAME RSETexture)
|
||||||
endif()
|
endif()
|
||||||
set(RSP_TEXTURE_LIB_NAME RSPTexture${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR})
|
set(RSP_TEXTURE_LIB_NAME RSPTexture${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR})
|
||||||
|
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -5,7 +5,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
CI_OUTPUT_NAME = "RSETexture"
|
CI_OUTPUT_NAME = "RSETexture"
|
||||||
CI_VERSION = "2.0.1"
|
CI_VERSION = "2.1.0"
|
||||||
CI_BUILD_NUMBER = "$BUILD_NUMBER"
|
CI_BUILD_NUMBER = "$BUILD_NUMBER"
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
|
@ -97,13 +97,11 @@ RSPTEXTURE_EXTERN unsigned short RSPTexture_processHMTFileMemory(
|
|||||||
*
|
*
|
||||||
* @param[in] pHmt HMT texture structure to be analyzed.
|
* @param[in] pHmt HMT texture structure to be analyzed.
|
||||||
* @param[in] mat_id ID of the material.
|
* @param[in] mat_id ID of the material.
|
||||||
* @param[in] mat_type Type of the material.
|
|
||||||
*
|
*
|
||||||
* @return Pointer to T_RSPTEXTURE_MATERIAL if found or NULL otherwise.
|
* @return Pointer to T_RSPTEXTURE_MATERIAL if found or NULL otherwise.
|
||||||
*/
|
*/
|
||||||
RSPTEXTURE_EXTERN T_RSPTEXTURE_MATERIAL* RSPTexture_getMaterialFromID(
|
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
|
||||||
const RSPTEX_MAT_TYPE mat_type
|
|
||||||
);
|
);
|
||||||
|
|
||||||
RSPTEXTURE_EXTERN char* RSPTexture_getMaterialName( const T_RSPTEXTURE_MATERIAL* mat );
|
RSPTEXTURE_EXTERN char* RSPTexture_getMaterialName( const T_RSPTEXTURE_MATERIAL* mat );
|
||||||
|
@ -50,29 +50,11 @@ unsigned short RSPTexture_processHMTFileMemory( T_RSPTEXTURE_HMT* hmtStruct, con
|
|||||||
/*
|
/*
|
||||||
* Material utilities
|
* Material utilities
|
||||||
*/
|
*/
|
||||||
T_RSPTEXTURE_MATERIAL* RSPTexture_getMaterialFromID( const T_RSPTEXTURE_HMT* pHmt,
|
T_RSPTEXTURE_MATERIAL* RSPTexture_getMaterialFromID( const T_RSPTEXTURE_HMT* pHmt, const unsigned short mat_id ) {
|
||||||
const unsigned short mat_id, const RSPTEX_MAT_TYPE mat_type ) {
|
|
||||||
unsigned int i;
|
|
||||||
char mat_template_str[17];
|
|
||||||
|
|
||||||
if ( pHmt == NULL ) return NULL;
|
if ( pHmt == NULL ) return NULL;
|
||||||
if ( pHmt->materials == NULL ) return NULL;
|
if ( pHmt->materials == NULL ) return NULL;
|
||||||
|
|
||||||
if (mat_type == RSPTEX_MAT_TYPE_SOLID) {
|
return &(pHmt->materials[mat_id]);
|
||||||
snprintf(mat_template_str, 16, "mat_%d", mat_id);
|
|
||||||
|
|
||||||
for ( i = 0; i < pHmt->materials_count; i++ ) {
|
|
||||||
if (strcmp((char *)pHmt->materials[i].name, mat_template_str) == 0)
|
|
||||||
return &(pHmt->materials[i]);
|
|
||||||
}
|
|
||||||
} else if (mat_type == RSPTEX_MAT_TYPE_TEXTURED) {
|
|
||||||
for ( i = 0; i < pHmt->materials_count; i++ ) {
|
|
||||||
if (pHmt->materials[i].id == mat_id && pHmt->materials[i].type == RSPTEX_MAT_TYPE_TEXTURED)
|
|
||||||
return &(pHmt->materials[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* RSPTexture_getMaterialName( const T_RSPTEXTURE_MATERIAL* mat ) {
|
char* RSPTexture_getMaterialName( const T_RSPTEXTURE_MATERIAL* mat ) {
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
#ifndef CONFIG_H_
|
|
||||||
#define CONFIG_H_
|
|
||||||
|
|
||||||
#define PRG_VERSION "2.0.0"
|
|
||||||
|
|
||||||
#endif /* CONFIG_H_ */
|
|
@ -170,7 +170,8 @@ static unsigned short ExtractMaterials(T_RSPTEXTURE_HMT* pHmt, const MEMFILE pMe
|
|||||||
if (pParams->verbose_mode) {
|
if (pParams->verbose_mode) {
|
||||||
printf("[INFO] > Material name: %s\n", pHmt->materials[i].name);
|
printf("[INFO] > Material name: %s\n", pHmt->materials[i].name);
|
||||||
printf("[INFO] > Material type: %d\n", pHmt->materials[i].type);
|
printf("[INFO] > Material type: %d\n", pHmt->materials[i].type);
|
||||||
printf("[INFO] > Material text. index: %d\n", pHmt->materials[i].id);
|
printf("[INFO] > Material id: %d\n", pHmt->materials[i].id);
|
||||||
|
printf("[INFO] > Material text. index: %d\n", i);
|
||||||
if (pHmt->materials[i].type == RSPTEX_MAT_TYPE_TEXTURED)
|
if (pHmt->materials[i].type == RSPTEX_MAT_TYPE_TEXTURED)
|
||||||
printf("[INFO] > Linked texture name: %s (should correspond to material name)\n", pHmt->materials[i].texture->name);
|
printf("[INFO] > Linked texture name: %s (should correspond to material name)\n", pHmt->materials[i].texture->name);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user