Final review
All checks were successful
JCS-Prod/RSE-Terrain/pipeline/pr-master This commit looks good
JCS-Prod/RSE-Terrain/pipeline/head This commit looks good

This commit is contained in:
JackCarterSmith 2022-08-24 18:44:11 +02:00
parent 25159b2fa9
commit 3b82ac3e61
Signed by: JackCarterSmith
GPG Key ID: 832E52F4E23F8F24
9 changed files with 190 additions and 54 deletions

73
LICENSE-glew Normal file
View File

@ -0,0 +1,73 @@
The OpenGL Extension Wrangler Library
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
Copyright (C) 2002, Lev Povalahev
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name of the author may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
Mesa 3-D graphics library
Version: 7.0
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2007 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

View File

@ -28,8 +28,7 @@
static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS* opt_ptr); static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS* opt_ptr);
static void createSubDir(char *dirName); static void createSubDir(char *dirName);
static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]); static unsigned short checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]);
//static void cleanUpMemory(T_RSPMODEL_HOB* hobStruct);
static void dispHelp(); static void dispHelp();
@ -41,7 +40,7 @@ int main(int argc, char *argv[]) {
unsigned char p; unsigned char p;
// Hello world! // Hello world!
printf("\n*** RogueSquadron Extractor (RSE) - TERRAIN module - RSPTerrainLib v%s ***\n", RSPTerrain_getVersion()); printf("\n*~[ Rogue Squadron Extractor (RSE) - RSPTerrainLib v%s ]~*\n", RSPTerrain_getVersion());
// Check for arguments // Check for arguments
if (argc < 2) { if (argc < 2) {
@ -71,60 +70,80 @@ static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS
T_RSPTERRAIN_MESH* terrainMesh = NULL; T_RSPTERRAIN_MESH* terrainMesh = NULL;
libParams.raw = p_opts->raw & 0x7; libParams.raw = p_opts->raw & 0x7;
libParams.negative = !p_opts->negative_HM; // Invert it by default to correspond to in-game rendering libParams.negative = p_opts->negative_HM; // Invert it by default to correspond to in-game rendering
libParams.invertZ = !p_opts->inverted_Z; // Invert it by default to correspond to in-game rendering libParams.invertZ = !p_opts->inverted_Z; // Invert it by default to correspond to in-game rendering
// Manage multiple inputs files // Manage multiple inputs files
for ( file_index = p_opts->input_files_cnt; file_index < args_cnt; file_index++ ) for ( file_index = p_opts->input_files_cnt; file_index < args_cnt; file_index++ )
{ {
printf("\n=============================================\n[INFO] - Parsing file: %s ...\n", args_value[file_index]); printf("\n=============================================\n[INFO] - Parsing file: %s ...\n", args_value[file_index]);
hmpStruct = calloc(1, sizeof(T_RSPTERRAIN_HMP));
// Allocate T_RSPTERRAIN_HMP structure to store extracted datas.
hmpStruct = calloc(1, sizeof(T_RSPTERRAIN_HMP));
if (hmpStruct) {
// Parse data from HMP file and put in T_RSPTERRAIN_HMP structure. // Parse data from HMP file and put in T_RSPTERRAIN_HMP structure.
if (RSPTerrain_processHMPFile(hmpStruct, args_value[file_index], libParams) != RSPLIB_SUCCESS) { if (RSPTerrain_processHMPFile(hmpStruct, args_value[file_index], libParams) != RSPLIB_SUCCESS) {
printf("[ERR] Failed to parse datas from %s\n", args_value[file_index]); printf("[ERR] Failed to parse datas from %s\n", args_value[file_index]);
free(hmpStruct); RSPTerrain_freeHMP(hmpStruct);
return RSPLIB_ERROR_PROCESS; return RSPLIB_ERROR_PROCESS;
} }
} else return RSPLIB_ERROR_MEMORY;
// Create output folders structure // Create output folders structure.
if (p_opts->output_dir) createSubDir(args_value[file_index]); if (p_opts->output_dir) createSubDir(args_value[file_index]);
// Allocate terrain full heighmap format
terrainHM = calloc(1, sizeof(T_RSPTERRAIN_HEIGHTMAP)); terrainHM = calloc(1, sizeof(T_RSPTERRAIN_HEIGHTMAP));
if (terrainHM) {
if (RSPTerrain_terrainToHeightmap(terrainHM, hmpStruct) == RSPLIB_SUCCESS) { if (RSPTerrain_terrainToHeightmap(terrainHM, hmpStruct) == RSPLIB_SUCCESS) {
// Export terrain as a PNG greyscale heightmap // Export terrain as a PNG greyscale heightmap
if (exportHeightmapPNG(terrainHM, args_value[file_index], p_opts) != RSPLIB_SUCCESS) if (exportHeightmapPNG(terrainHM, args_value[file_index], p_opts) == RSPLIB_SUCCESS)
printf("[ERR] Failed to export heightmap to PNG format!\n");
else
printf("[INFO] Successfully exported heightmap to PNG format.\n"); printf("[INFO] Successfully exported heightmap to PNG format.\n");
else
printf("[ERR] Failed to export heightmap to PNG format!\n");
} else {
printf("[ERR] Failed to process tilesmap to heightmap!\n");
}
RSPTerrain_freeHeightmap(terrainHM);
} else {
RSPTerrain_freeHMP(hmpStruct);
return RSPLIB_ERROR_MEMORY;
} }
free(terrainHM); //TODO: not correct clean up
//ifndef TEXTURE_MODULE // Allocate mesh object for 3D terrain generation
//#ifndef TEXTURE_MODULE TODO: Next version: detect presence of external library to manage texture handling...
terrainMesh = calloc(1, sizeof(T_RSPTERRAIN_MESH)); terrainMesh = calloc(1, sizeof(T_RSPTERRAIN_MESH));
if (terrainMesh) {
if (RSPTerrain_terrainToMesh(terrainMesh, hmpStruct, TERRAIN_MESH_SCALE) == RSPLIB_SUCCESS) { if (RSPTerrain_terrainToMesh(terrainMesh, hmpStruct, TERRAIN_MESH_SCALE) == RSPLIB_SUCCESS) {
// Export terrain as a blank OBJ terrain // Export terrain as a blank OBJ terrain
if (exportHeightmapOBJ(terrainMesh, args_value[file_index], p_opts) != RSPLIB_SUCCESS) if (exportHeightmapOBJ(terrainMesh, args_value[file_index], p_opts) == RSPLIB_SUCCESS)
printf("[ERR] Failed to export terrain in OBJ format!\n");
else
printf("[INFO] Successfully exported terrain in OBJ format.\n"); printf("[INFO] Successfully exported terrain in OBJ format.\n");
else
printf("[ERR] Failed to export terrain in OBJ format!\n");
} else {
printf("[ERR] Failed to process tilesmap to mesh!\n");
}
RSPTerrain_freeMesh(terrainMesh);
} else {
RSPTerrain_freeHMP(hmpStruct);
return RSPLIB_ERROR_MEMORY;
} }
free(terrainMesh); //TODO: not correct clean up
//#endif //#endif
//cleanUpResources(hmpStruct); RSPTerrain_freeHMP(hmpStruct);
} }
return RSPLIB_SUCCESS; return RSPLIB_SUCCESS;
} }
static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]) { static unsigned short checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char* p_args[]) {
char test[256]; char test[256];
int i; int i;
// Set default options // Set default options
opt_ptr->raw = 0; opt_ptr->raw = 0;
opt_ptr->output_dir = 1; opt_ptr->output_dir = 1;
opt_ptr->export_mtl = 1;
if (p_arg_nbr > 1) { if (p_arg_nbr > 1) {
for ( i = 1; i < p_arg_nbr; i++) { for ( i = 1; i < p_arg_nbr; i++) {
@ -148,6 +167,9 @@ static unsigned char checkInputArgs(T_PROG_OPTIONS* opt_ptr, int p_arg_nbr, char
} else if (strcmp(p_args[i], "-no-subdir") == 0) { } else if (strcmp(p_args[i], "-no-subdir") == 0) {
opt_ptr->output_dir = 0; opt_ptr->output_dir = 0;
printf("[OPTN] Export to current directory.\n"); printf("[OPTN] Export to current directory.\n");
} else if (strcmp(p_args[i], "-no-mtl") == 0) {
opt_ptr->export_mtl = 0;
printf("[OPTN] Export to current directory.\n");
} else if (strcmp(p_args[i], "-invZ") == 0) { } else if (strcmp(p_args[i], "-invZ") == 0) {
opt_ptr->inverted_Z = 1; opt_ptr->inverted_Z = 1;
printf("[OPTN] Invert Z axis.\n"); printf("[OPTN] Invert Z axis.\n");

View File

@ -10,10 +10,7 @@
#ifndef OPTIONS_H_ #ifndef OPTIONS_H_
#define OPTIONS_H_ #define OPTIONS_H_
// Number of height values to take for computing terrain (default: 4) // Scale value for vertex grid constructor (default: 0.1) TODO: user input as argument?
#define TERRAIN_TILE_SAMPLING 4
// Scale value for vertex grid constructor (default: 0.1)
#define TERRAIN_MESH_SCALE 0.1 #define TERRAIN_MESH_SCALE 0.1
/// Options structure /// Options structure

View File

@ -59,14 +59,14 @@ unsigned char exportHeightmapPNG(const T_RSPTERRAIN_HEIGHTMAP* heightmap, const
} }
// Set image attributes // Set image attributes
png_set_IHDR(png_ptr, info_ptr, heightmap->width * TERRAIN_TILE_SAMPLING, heightmap->height * TERRAIN_TILE_SAMPLING, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); png_set_IHDR(png_ptr, info_ptr, heightmap->width * RSPTERRAINLIB_TILE_SAMPLING, heightmap->height * RSPTERRAINLIB_TILE_SAMPLING, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
// Store PNG datas in buffer // Store PNG datas in buffer
row_ptrs = png_malloc(png_ptr, heightmap->height * TERRAIN_TILE_SAMPLING * sizeof(png_byte *)); row_ptrs = png_malloc(png_ptr, heightmap->height * RSPTERRAINLIB_TILE_SAMPLING * sizeof(png_byte *));
for ( z = 0; z < heightmap->height * TERRAIN_TILE_SAMPLING; z++ ) { for ( z = 0; z < heightmap->height * RSPTERRAINLIB_TILE_SAMPLING; z++ ) {
png_byte *row = png_malloc(png_ptr, heightmap->width * TERRAIN_TILE_SAMPLING * sizeof(unsigned char) * 3); png_byte *row = png_malloc(png_ptr, heightmap->width * RSPTERRAINLIB_TILE_SAMPLING * sizeof(unsigned char) * 3);
row_ptrs[z] = row; row_ptrs[z] = row;
for ( x = 0; x < heightmap->width * TERRAIN_TILE_SAMPLING; x++ ) { for ( x = 0; x < heightmap->width * RSPTERRAINLIB_TILE_SAMPLING; x++ ) {
*row++ = heightmap->heightmap[x][z]; *row++ = heightmap->heightmap[x][z];
*row++ = heightmap->heightmap[x][z]; *row++ = heightmap->heightmap[x][z];
*row++ = heightmap->heightmap[x][z]; *row++ = heightmap->heightmap[x][z];
@ -79,7 +79,7 @@ unsigned char exportHeightmapPNG(const T_RSPTERRAIN_HEIGHTMAP* heightmap, const
png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
// Clean up // Clean up
for ( z = 0; z < heightmap->height * TERRAIN_TILE_SAMPLING; z++ ) { for ( z = 0; z < heightmap->height * RSPTERRAINLIB_TILE_SAMPLING; z++ ) {
png_free(png_ptr, row_ptrs[z]); png_free(png_ptr, row_ptrs[z]);
} }
png_free(png_ptr, row_ptrs); png_free(png_ptr, row_ptrs);
@ -144,7 +144,6 @@ unsigned char exportHeightmapOBJ(const T_RSPTERRAIN_MESH* terrain_mesh, const ch
// 3 3-4 // 3 3-4
for ( j = 0; j < terrain_mesh->height - 1; j++ ) { for ( j = 0; j < terrain_mesh->height - 1; j++ ) {
for ( i = 0; i < terrain_mesh->width - 1; i++ ) { for ( i = 0; i < terrain_mesh->width - 1; i++ ) {
//indicesBuff[0] = j * terrain_mesh->width + i + 1 - 1; //TODO: -1 needed to compensate the obj constructor. Really need to rewrite my own...
indicesBuff[0] = j * terrain_mesh->width + i; indicesBuff[0] = j * terrain_mesh->width + i;
indicesBuff[1] = indicesBuff[0] + 1; indicesBuff[1] = indicesBuff[0] + 1;
indicesBuff[2] = indicesBuff[0] + terrain_mesh->width; indicesBuff[2] = indicesBuff[0] + terrain_mesh->width;

View File

@ -61,7 +61,7 @@ RSPTERRAIN_EXTERN char* RSPTerrain_getVersion( void );
* *
* @param[out] hmpStruct HMP terrain structure to be filled with parsed datas. * @param[out] hmpStruct HMP terrain structure to be filled with parsed datas.
* @param[in] filePath Path to the HMP file in system. * @param[in] filePath Path to the HMP file in system.
* @param[in] params Parser options. See RSPMODEL_PARAMETERS. * @param[in] params Parser options. See RSPTERRAIN_PARAMETERS.
* *
* @return Error status, return RSPLIB_SUCCESS in nominal case. * @return Error status, return RSPLIB_SUCCESS in nominal case.
*/ */
@ -79,7 +79,7 @@ RSPTERRAIN_EXTERN unsigned short RSPTerrain_processHMPFile(
* @param[out] hmpStruct HMP terrain structure to be filled with parsed datas. * @param[out] hmpStruct HMP terrain structure to be filled with parsed datas.
* @param[in] memFilePtr Pointer to the beginning of the file in memory. * @param[in] memFilePtr Pointer to the beginning of the file in memory.
* @param[in] memFileSize Size of the file in bytes. * @param[in] memFileSize Size of the file in bytes.
* @param[in] params Parser options. See RSPMODEL_PARAMETERS. * @param[in] params Parser options. See RSPTERRAIN_PARAMETERS.
* *
* @return Error status, return RSPLIB_SUCCESS in nominal case. * @return Error status, return RSPLIB_SUCCESS in nominal case.
*/ */
@ -89,7 +89,8 @@ RSPTERRAIN_EXTERN unsigned short RSPTerrain_processHMPFileMemory(
); );
/** /**
* @brief Convert terrain to GL compatible format. * @brief Convert terrain tilesmap into fullframe heightmap.
* @details Height values are placed in a two dim array for easy access.
* *
* @param[out] heightmap 2D array type heightmap structure. * @param[out] heightmap 2D array type heightmap structure.
* @param[in] hmpStruct HMP terrain datas from previously parsed HMP file. * @param[in] hmpStruct HMP terrain datas from previously parsed HMP file.
@ -101,7 +102,8 @@ RSPTERRAIN_EXTERN unsigned short RSPTerrain_terrainToHeightmap(
); );
/** /**
* @brief Convert terrain to GL compatible format. * @brief Convert terrain tilesmap into vertices mesh for 3D purpose.
* @details Vertex have a X,Y,Z format. Vertices are placed in a row.
* *
* @param[out] mesh Mesh of vertices heightmap type. * @param[out] mesh Mesh of vertices heightmap type.
* @param[in] hmpStruct HMP terrain datas from previously parsed HMP file. * @param[in] hmpStruct HMP terrain datas from previously parsed HMP file.
@ -143,7 +145,19 @@ RSPTERRAIN_EXTERN unsigned short RSPTerrain_terrainToD3D(
* @brief Clean HMP object and it's childrens from memory. * @brief Clean HMP object and it's childrens from memory.
* @param[in] hmpStruct Pointer to data to be cleaned up. * @param[in] hmpStruct Pointer to data to be cleaned up.
*/ */
RSPTERRAIN_EXTERN void RSPTerrain_free(T_RSPTERRAIN_HMP* hmpStruct); RSPTERRAIN_EXTERN void RSPTerrain_freeHMP( T_RSPTERRAIN_HMP* hmpStruct );
/**
* @brief Clean heightmap object and it's childrens from memory.
* @param[in] heightmap Pointer to data to be cleaned up.
*/
RSPTERRAIN_EXTERN void RSPTerrain_freeHeightmap( T_RSPTERRAIN_HEIGHTMAP* heightmap );
/**
* @brief Clean mesh object and it's childrens from memory.
* @param[in] mesh Pointer to data to be cleaned up.
*/
RSPTERRAIN_EXTERN void RSPTerrain_freeMesh( T_RSPTERRAIN_MESH* mesh );
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -17,8 +17,9 @@ extern "C" {
// Number of height values to take for computing terrain (default: 4) // Number of height values to take for computing terrain (default: 4)
#define RSPTERRAINLIB_TILE_SAMPLING 4 #define RSPTERRAINLIB_TILE_SAMPLING 4
// Scale value for vertex grid constructor (default: 0.1) #if (RSPTERRAINLIB_TILE_SAMPLING > 5 || RSPTERRAINLIB_TILE_SAMPLING < 1)
#define RSPTERRAINLIB_MESH_SCALE 0.1 #error "RSPTERRAINLIB_TILE_SAMPLING must be within the range of 1-5."
#endif
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Configuration structure // Configuration structure

View File

@ -67,9 +67,29 @@ unsigned short RSPTerrain_terrainToD3D( void* D3DTerrainObj, const T_RSPTERRAIN_
return RSPLIB_SUCCESS; return RSPLIB_SUCCESS;
} }
void RSPTerrain_free(T_RSPTERRAIN_HMP* hmpStruct) { void RSPTerrain_freeHMP(T_RSPTERRAIN_HMP* hmpStruct) {
if (hmpStruct == NULL) return; if (hmpStruct == NULL) return;
free(hmpStruct->tilesmap); if (hmpStruct->tilesmap) free(hmpStruct->tilesmap);
free(hmpStruct); free(hmpStruct);
} }
void RSPTerrain_freeHeightmap(T_RSPTERRAIN_HEIGHTMAP* heightmap) {
unsigned int i;
if (heightmap == NULL) return;
for ( i = 0; i < heightmap->width * RSPTERRAINLIB_TILE_SAMPLING; i++ )
if (heightmap->heightmap[i]) free(heightmap->heightmap[i]);
free(heightmap);
}
void RSPTerrain_freeMesh(T_RSPTERRAIN_MESH* mesh) {
if (mesh == NULL) return;
if (mesh->verticesmap) free(mesh->verticesmap);
free(mesh);
}

View File

@ -90,9 +90,9 @@ unsigned short RSP_TerrainLib_ParseHMPFile(const char* fileName, T_RSPTERRAIN_HM
/** /**
* @brief Extract datas from terrain HMP in memory. * @brief Extract datas from terrain HMP in memory.
* *
* @param[in|out] pHmpStruct Take root hob structure to get the T_RSPTERRAIN_HMP buffer and header datas. * @param[out] pHmpStruct Take T_RSPTERRAIN_HMP structure to fill with parsed datas.
* @param[in] pMemfile Pointer to an in-memory file location. * @param[in] pMemfile Pointer to an in-memory file location.
* @param[in] pParams * @param[in] pParams Program option, used to tune parser features.
* *
* @return Error code, RSPLIB_SUCCESS when no error. * @return Error code, RSPLIB_SUCCESS when no error.
*/ */
@ -147,6 +147,16 @@ static unsigned short extractTerrainHMP(T_RSPTERRAIN_HMP* pHmpStruct, const MEMF
return errorCode; return errorCode;
} }
/**
* @brief Recreate original tilesmap using index and tiles in memory.
*
* @param[in|out] pHmpStruct Take T_RSPTERRAIN_HMP structure to fill with parsed datas.
* @param[in] tiles_indices Tiles indices list.
* @param[in] tiles Tiles datas list.
* @param[in] pParams Program option, used to tune parser features.
*
* @return Error code, RSPLIB_SUCCESS when no error.
*/
static unsigned short resolveTilesMap(T_RSPTERRAIN_HMP* pHmpStruct, const T_TILE_INDICES* tiles_indices, static unsigned short resolveTilesMap(T_RSPTERRAIN_HMP* pHmpStruct, const T_TILE_INDICES* tiles_indices,
const T_HMPFILE_TILE* tiles, const RSPTERRAIN_PARAMETERS* pParams) { const T_HMPFILE_TILE* tiles, const RSPTERRAIN_PARAMETERS* pParams) {

View File

@ -16,7 +16,7 @@
/** /**
* @brief Process HMP file stored in memory. * @brief Process HMP file stored in memory.
* @details Parser will directly extract tiles count and information stored in * @details Parser will directly extract tiles count and information stored in
* HMP file and store them in T_RSPTERRAIN_TERRAIN_OBJ structure. * HMP file and store them in T_RSPTERRAIN_HMP structure.
* @note Unmanaged mode * @note Unmanaged mode
* *
* @param[in] pMemFile Pointer to an in-memory HOB file location. * @param[in] pMemFile Pointer to an in-memory HOB file location.
@ -35,7 +35,7 @@ unsigned short RSP_TerrainLib_ParseHMPMemFile(const MEMFILE pMemFile,
* performance during parser operation and in optic to protect data * performance during parser operation and in optic to protect data
* stored in the original file (read-only). * stored in the original file (read-only).
* Parser will extract tiles count and information stored in HMP file * Parser will extract tiles count and information stored in HMP file
* and store them in T_RSPTERRAIN_TERRAIN_OBJ structure. * and store them in T_RSPTERRAIN_HMP structure.
* @note Managed mode * @note Managed mode
* *
* @param[in] fileName String value of file name/path. * @param[in] fileName String value of file name/path.