Minor feature update #24
@ -1,7 +1,7 @@
|
||||
# CMakeLists.txt
|
||||
|
||||
####################################################
|
||||
# Written by JackCarterSmith, 2022
|
||||
# Written by JackCarterSmith, 2023
|
||||
# This code is released under the RSE license.
|
||||
####################################################
|
||||
|
||||
@ -20,7 +20,7 @@ if(DEFINED ENV{CI}) # Jenkins CI integration mode
|
||||
project(rse-model VERSION $ENV{CI_VERSION}.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C)
|
||||
set(RSE_MODEL_NAME $ENV{CI_OUTPUT_NAME})
|
||||
else() # Standalone project mode, should not be used for release.
|
||||
project(rse-model VERSION 2.2.0 DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C)
|
||||
project(rse-model VERSION 2.3.0 DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C)
|
||||
set(RSE_MODEL_NAME RSEModel)
|
||||
endif()
|
||||
set(RSP_MODEL_LIB_NAME RSPModel${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR})
|
||||
@ -82,7 +82,7 @@ endif()
|
||||
|
||||
|
||||
# Install dependancies
|
||||
install(FILES ${PROJECT_BINARY_DIR}/bin/glew32.dll
|
||||
install(FILES ${PROJECT_BINARY_DIR}/bin/glew32.dll ${PROJECT_BINARY_DIR}/bin/vulkan-1.dll
|
||||
DESTINATION ${INSTALL_BIN_DIR})
|
||||
|
||||
# Install library includes
|
||||
|
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@ -5,7 +5,7 @@ pipeline {
|
||||
}
|
||||
environment {
|
||||
CI_OUTPUT_NAME = "RSEModel"
|
||||
CI_VERSION = "2.2.0"
|
||||
CI_VERSION = "2.3.0"
|
||||
CI_BUILD_NUMBER = "$BUILD_NUMBER"
|
||||
}
|
||||
stages {
|
||||
@ -23,7 +23,7 @@ pipeline {
|
||||
checkout([$class: 'GitSCM', branches: [[name: '**']], browser: [$class: 'GiteaBrowser', repoUrl: 'https://git.jcsmith.fr/JCS-Prod/RSE-Model'], extensions: [], userRemoteConfigs: [[credentialsId: 'jenkins-ssh', url: 'ssh://git@git.jcsmith.fr:2322/JCS-Prod/RSE-Model.git']]])
|
||||
sh 'git submodule update --init --recursive'
|
||||
dir("build") {
|
||||
rtConanRun(clientId: "conan", command: "install .. --build=missing")
|
||||
rtConanRun(clientId: "conan", command: "install .. -pr:b=default -pr:h=default --build=missing")
|
||||
}
|
||||
cmakeBuild buildDir: 'build', installation: 'latest', steps: [[args: 'all']]
|
||||
}
|
||||
|
207
LICENSE-vulkan
Normal file
207
LICENSE-vulkan
Normal file
@ -0,0 +1,207 @@
|
||||
The majority of files in this project use the Apache 2.0 License.
|
||||
There are a few exceptions and their license can be found in the source.
|
||||
Any license deviations from Apache 2.0 are "more permissive" licenses.
|
||||
|
||||
===========================================================================================
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@ -22,13 +22,14 @@ This module can do:
|
||||
|
||||
- Add textures to models.
|
||||
- Discover all unknowns fields, animations, bones mesh, etc.
|
||||
- Full Conan build pipeline
|
||||
|
||||
### Using
|
||||
|
||||
`RSEModel [options] <hob files...>` or you can simply drag&drop HOB files on it.
|
||||
|
||||
A futur main program can extract all HOB files directly from DAT file.
|
||||
Due to issue with copyrights, I can't provide samples... You need to extract HOB files yourself.
|
||||
Due to issues with copyrights, I can't provide samples and my DAT file parser is unfinished... You need to extract HOB files yourself.
|
||||
|
||||
<img src="https://repo.jcsmith.fr/pictures/rse-model.gif" width="620" height="400" />
|
||||
|
||||
@ -45,7 +46,7 @@ Due to issue with copyrights, I can't provide samples... You need to extract HOB
|
||||
|
||||
### Compiling
|
||||
|
||||
You can compile on both Windows (MinGW) or native Linux system thanks to CMake.
|
||||
You can compile on both Windows (MinGW/MSVC) or native Linux system thanks to CMake.
|
||||
|
||||
To compile, just clone (**don't forget git submodules**) and launch cmake:
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# CMakeLists.txt
|
||||
|
||||
####################################################
|
||||
# Written by JackCarterSmith, 2022
|
||||
# Written by JackCarterSmith, 2023
|
||||
# This code is released under the RSE license.
|
||||
####################################################
|
||||
|
||||
@ -14,6 +14,10 @@ if(BUILD_TOOLS)
|
||||
# Import needed packages and references their include path
|
||||
find_package(GLEW REQUIRED)
|
||||
include_directories(${GLEW_INCLUDE_DIR})
|
||||
#find_package(Vulkan REQUIRED)
|
||||
#include_directories(${Vulkan_INCLUDE_DIR})
|
||||
#find_package(vulkan-memory-allocator REQUIRED)
|
||||
#include_directories(${vulkan-memory-allocator_INCLUDE_DIR})
|
||||
|
||||
|
||||
# Define src/headers files
|
||||
@ -43,8 +47,10 @@ if(BUILD_TOOLS)
|
||||
|
||||
# Link externals libraries to the linker
|
||||
if(RSPMODEL_SHARED)
|
||||
#target_link_libraries(rse-model PRIVATE rsp-model-lib ${GLEW_LIBRARIES} ${Vulkan_LIBRARIES} ${AUX_LIBS})
|
||||
target_link_libraries(rse-model PRIVATE rsp-model-lib ${GLEW_LIBRARIES} ${AUX_LIBS})
|
||||
elseif(RSPMODEL_STATIC)
|
||||
#target_link_libraries(rse-model PRIVATE rsp-model-libstatic ${GLEW_LIBRARIES} ${Vulkan_LIBRARIES} ${AUX_LIBS})
|
||||
target_link_libraries(rse-model PRIVATE rsp-model-libstatic ${GLEW_LIBRARIES} ${AUX_LIBS})
|
||||
endif()
|
||||
endif()
|
||||
|
@ -132,7 +132,7 @@ static unsigned int mainProcess(int args_cnt, char* args_value[], T_PROG_OPTIONS
|
||||
}
|
||||
}
|
||||
|
||||
RSPTexture_freeHMT(hmtStruct);
|
||||
if (p_opts->texture_module) RSPTexture_freeHMT(hmtStruct);
|
||||
}
|
||||
|
||||
RSPModel_freeHOB(hobStruct);
|
||||
|
@ -1,7 +1,7 @@
|
||||
# CMakeLists.txt
|
||||
|
||||
####################################################
|
||||
# Written by JackCarterSmith, 2022
|
||||
# Written by JackCarterSmith, 2023
|
||||
# This code is released under the RSE license.
|
||||
####################################################
|
||||
|
||||
@ -31,8 +31,8 @@ endif()
|
||||
# Declare the shared library instance
|
||||
if(RSPMODEL_SHARED)
|
||||
add_library(rsp-model-lib SHARED ${RSP_MOD_SOURCES})
|
||||
set_property(TARGET rsp-model-lib PROPERTY C_STANDARD 90)
|
||||
set_target_properties(rsp-model-lib PROPERTIES VERSION 2.1.0)
|
||||
set_property(TARGET rsp-model-lib PROPERTY C_STANDARD 11)
|
||||
set_target_properties(rsp-model-lib PROPERTIES VERSION 2.3.0)
|
||||
|
||||
target_include_directories(rsp-model-lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
@ -53,7 +53,7 @@ endif()
|
||||
# Declare the static library instance
|
||||
if(RSPMODEL_STATIC)
|
||||
add_library(rsp-model-libstatic STATIC ${RSP_MOD_SOURCES})
|
||||
set_property(TARGET rsp-model-libstatic PROPERTY C_STANDARD 90)
|
||||
set_property(TARGET rsp-model-libstatic PROPERTY C_STANDARD 11)
|
||||
|
||||
target_include_directories(rsp-model-libstatic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file RSPModel.h
|
||||
* @date 11/08/2022
|
||||
* @date 18/01/2023
|
||||
* @author JackCarterSmith
|
||||
* @copyright GPL-v3.0
|
||||
* @brief Rogue Squadron Parser model library, used to decode decode datas
|
||||
@ -48,6 +48,7 @@ extern "C" {
|
||||
// Library's functions declaration
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/**
|
||||
* @brief Get the current library version.
|
||||
* @return Char array of the version, escape char included.
|
||||
@ -88,6 +89,36 @@ RSPMODEL_EXTERN unsigned short RSPModel_processHOBFileMemory(
|
||||
const RSPMODEL_PARAMETERS params
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Clean HOB object and it's childrens from memory.
|
||||
* @param[in] hobStruct Pointer to data to be cleaned up.
|
||||
*/
|
||||
RSPMODEL_EXTERN void RSPModel_freeHOB( T_RSPMODEL_HOB* hobStruct );
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/**
|
||||
* @brief Get number of model objects inside specified memFilePtr without
|
||||
* fully parsing it.
|
||||
*
|
||||
* @param[in] filePath Path to the HOB file in system.
|
||||
*
|
||||
* @return Number of model objects.
|
||||
*/
|
||||
RSPMODEL_EXTERN unsigned int RSPModel_getHOBFileObjCount( const char* const filePath );
|
||||
|
||||
/**
|
||||
* @brief Get number of model objects inside specified memFilePtr without
|
||||
* fully parsing it.
|
||||
*
|
||||
* @param[in] memFilePtr Pointer to the beginning of the file in memory.
|
||||
*
|
||||
* @return Number of model objects.
|
||||
*/
|
||||
RSPMODEL_EXTERN unsigned int RSPModel_getHOBFileMemObjCount( const void* const memFilePtr );
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/**
|
||||
* @brief Convert HOB's object datas to GL compatible format.
|
||||
* @note Only available if GL module as specified at compilation.
|
||||
@ -114,12 +145,6 @@ RSPMODEL_EXTERN unsigned short RSPModel_objectToD3D(
|
||||
const T_RSPMODEL_OBJECT* objStruct, void* D3DObj
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Clean HOB object and it's childrens from memory.
|
||||
* @param[in] hobStruct Pointer to data to be cleaned up.
|
||||
*/
|
||||
RSPMODEL_EXTERN void RSPModel_freeHOB( T_RSPMODEL_HOB* hobStruct );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file RSPModel.c
|
||||
* @date 11/08/2022
|
||||
* @date 18/01/2023
|
||||
* @author JackCarterSmith
|
||||
* @copyright GPL-v3.0
|
||||
* @brief HOB model parser and export to Waveform OBJ format.
|
||||
@ -27,38 +27,27 @@ inline char* RSPModel_getVersion( void ) {
|
||||
|
||||
unsigned short RSPModel_processHOBFile( T_RSPMODEL_HOB* hob, const char* const filePath,
|
||||
const RSPMODEL_PARAMETERS params ) {
|
||||
unsigned short result = RSPLIB_SUCCESS;
|
||||
MEMFILE pMemFile = NULL;
|
||||
|
||||
if ( hob == NULL || filePath == NULL ) return RSPLIB_ERROR_ARGS_NULL;
|
||||
|
||||
RSP_ModelLib_ParseHOBFile(filePath, hob, ¶ms);
|
||||
RSP_ModelLib_LoadHOBFile(&pMemFile, filePath, ¶ms);
|
||||
result = RSP_ModelLib_ProcessHOBMemFile(hob, pMemFile, ¶ms);
|
||||
RSP_ModelLib_FreeHOBFile(&pMemFile);
|
||||
|
||||
return RSPLIB_SUCCESS;
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned short RSPModel_processHOBFileMemory( T_RSPMODEL_HOB* hob, const void* const memFilePtr,
|
||||
const long memFileSize, const RSPMODEL_PARAMETERS params ) {
|
||||
unsigned short result = RSPLIB_SUCCESS;
|
||||
|
||||
if ( hob == NULL || memFilePtr == NULL ) return RSPLIB_ERROR_ARGS_NULL;
|
||||
|
||||
RSP_ModelLib_ParseHOBMemFile((MEMFILE)memFilePtr, hob, ¶ms);
|
||||
result = RSP_ModelLib_ProcessHOBMemFile(hob, (MEMFILE)memFilePtr, ¶ms);
|
||||
|
||||
return RSPLIB_SUCCESS;
|
||||
}
|
||||
|
||||
unsigned short RSPModel_objectToGL( const T_RSPMODEL_OBJECT* objStruct, void* glObj ) {
|
||||
#ifndef GL_SUPPORT
|
||||
return RSPLIB_ERROR_MOD_DISABLED;
|
||||
#endif
|
||||
|
||||
return RSPLIB_SUCCESS;
|
||||
}
|
||||
|
||||
unsigned short RSPModel_objectToD3D( const T_RSPMODEL_OBJECT* objStruct, void* D3DObj ) {
|
||||
#ifndef D3D_SUPPORT
|
||||
return RSPLIB_ERROR_MOD_DISABLED;
|
||||
#endif
|
||||
|
||||
return RSPLIB_SUCCESS;
|
||||
return result;
|
||||
}
|
||||
|
||||
void RSPModel_freeHOB( T_RSPMODEL_HOB* hobStruct ) {
|
||||
@ -85,3 +74,40 @@ void RSPModel_freeHOB( T_RSPMODEL_HOB* hobStruct ) {
|
||||
|
||||
free(hobStruct);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
unsigned int RSPModel_getHOBFileObjCount( const char* const filePath ) {
|
||||
unsigned int result = 0;
|
||||
MEMFILE pMemFile = NULL;
|
||||
|
||||
if (filePath != NULL) {
|
||||
RSP_ModelLib_LoadHOBFile(&pMemFile, filePath, 0);
|
||||
result = RSP_ModelLib_getObjectsCount(pMemFile);
|
||||
RSP_ModelLib_FreeHOBFile(&pMemFile);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned int RSPModel_getHOBFileMemObjCount( const void* const memFilePtr ) {
|
||||
return RSP_ModelLib_getObjectsCount((MEMFILE)memFilePtr);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
unsigned short RSPModel_objectToGL( const T_RSPMODEL_OBJECT* objStruct, void* glObj ) {
|
||||
#ifndef GL_SUPPORT
|
||||
return RSPLIB_ERROR_MOD_DISABLED;
|
||||
#endif
|
||||
|
||||
return RSPLIB_SUCCESS;
|
||||
}
|
||||
|
||||
unsigned short RSPModel_objectToD3D( const T_RSPMODEL_OBJECT* objStruct, void* D3DObj ) {
|
||||
#ifndef D3D_SUPPORT
|
||||
return RSPLIB_ERROR_MOD_DISABLED;
|
||||
#endif
|
||||
|
||||
return RSPLIB_SUCCESS;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file hob_parser.c
|
||||
* @date 18/08/2022
|
||||
* @date 18/01/2023
|
||||
* @author JackCarterSmith
|
||||
* @copyright GPL-v3.0
|
||||
* @brief Process HOB file structure and extract its datas.
|
||||
@ -31,7 +31,7 @@ static unsigned short ExtractObjpart_Face_UVMaps(T_RSPMODEL_FACE*, const char*);
|
||||
// Public functions definition
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
unsigned short RSP_ModelLib_ParseHOBMemFile(const MEMFILE pMemFile, T_RSPMODEL_HOB* hobStruct, const RSPMODEL_PARAMETERS* pParams) {
|
||||
unsigned short RSP_ModelLib_ProcessHOBMemFile(T_RSPMODEL_HOB* hobStruct, const MEMFILE pMemFile, const RSPMODEL_PARAMETERS* pParams) {
|
||||
unsigned char err = RSPLIB_SUCCESS;
|
||||
|
||||
if (hobStruct != NULL && pMemFile != NULL) {
|
||||
@ -42,13 +42,12 @@ unsigned short RSP_ModelLib_ParseHOBMemFile(const MEMFILE pMemFile, T_RSPMODEL_H
|
||||
return err;
|
||||
}
|
||||
|
||||
unsigned short RSP_ModelLib_ParseHOBFile(const char* fileName, T_RSPMODEL_HOB* hobStruct, const RSPMODEL_PARAMETERS* pParams) {
|
||||
unsigned short RSP_ModelLib_LoadHOBFile(MEMFILE* newMemFile, const char* fileName, const RSPMODEL_PARAMETERS* pParams) {
|
||||
unsigned char err = RSPLIB_SUCCESS;
|
||||
long fileSize;
|
||||
FILE* fStream = NULL;
|
||||
MEMFILE memFile = NULL;
|
||||
|
||||
if (hobStruct != NULL && fileName != NULL) {
|
||||
if (newMemFile != NULL && fileName != NULL) {
|
||||
// Open file
|
||||
fStream = fopen(fileName, "rb");
|
||||
|
||||
@ -59,17 +58,11 @@ unsigned short RSP_ModelLib_ParseHOBFile(const char* fileName, T_RSPMODEL_HOB* h
|
||||
fseek(fStream, 0, SEEK_SET);
|
||||
if (pParams->verbose_mode) printf("[DBG] > Input file size: %ld bytes\n", fileSize);
|
||||
|
||||
memFile = malloc(fileSize + 1);
|
||||
if (memFile != NULL) {
|
||||
*newMemFile = malloc(fileSize + 1);
|
||||
if (*newMemFile != NULL) {
|
||||
// Copy file in RAM
|
||||
fread(memFile, fileSize, 1, fStream);
|
||||
fread(*newMemFile, fileSize, 1, fStream);
|
||||
fclose(fStream);
|
||||
|
||||
// Do the magic!
|
||||
err = ExtractObjects(hobStruct, memFile, pParams);
|
||||
|
||||
free(memFile);
|
||||
|
||||
} else {
|
||||
fclose(fStream);
|
||||
err = RSPLIB_ERROR_MEMORY;
|
||||
@ -84,6 +77,16 @@ unsigned short RSP_ModelLib_ParseHOBFile(const char* fileName, T_RSPMODEL_HOB* h
|
||||
return err;
|
||||
}
|
||||
|
||||
unsigned short RSP_ModelLib_FreeHOBFile(const MEMFILE* memFile) {
|
||||
unsigned char err = RSPLIB_SUCCESS;
|
||||
|
||||
if (memFile != NULL && *memFile != NULL) {
|
||||
free(*memFile);
|
||||
} else err = RSPLIB_ERROR_ARGS_NULL;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Private functions definition
|
||||
@ -104,7 +107,7 @@ static unsigned short ExtractObjects(T_RSPMODEL_HOB* pHobStruct, const MEMFILE p
|
||||
if (pHobStruct == NULL || pMemfile == NULL) return RSPLIB_ERROR_ARGS_NULL;
|
||||
|
||||
// Retrieve object count from the header
|
||||
pHobStruct->obj_count = ((T_HOBFILE_HEADER *)pMemfile)->obj_count;
|
||||
pHobStruct->obj_count = RSP_ModelLib_getObjectsCount(pMemfile);
|
||||
printf("[INFO] - Object(s) quantity: %d\n", pHobStruct->obj_count);
|
||||
if (pHobStruct->obj_count <= 0) {
|
||||
printf("[INFO] Can't process empty file!\n");
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file hob_parser.h
|
||||
* @date 18/08/2022
|
||||
* @date 18/01/2023
|
||||
* @author JackCarterSmith
|
||||
* @copyright GPL-v3.0
|
||||
* @brief Process HOB file structure and extract its datas.
|
||||
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "RSPModel_datatypes.h"
|
||||
#include "hob_struct.h"
|
||||
|
||||
|
||||
#ifndef RSPMODELLIB_HOB_PARSER_H_
|
||||
@ -19,33 +20,45 @@
|
||||
* HOB file and store them in T_RSPMODEL_HOB structure.
|
||||
* @note Unmanaged mode
|
||||
*
|
||||
* @param[in] pMemFile Pointer to an in-memory HOB file location.
|
||||
* @param[out] hobStruct Allocated empty T_RSPMODEL_HOB structure instance to
|
||||
* be filled with HOB datas.
|
||||
* @param[in] pMemFile Pointer to an in-memory HOB file location.
|
||||
* @param[in] pParams Parser options. See RSPMODEL_PARAMETERS.
|
||||
*
|
||||
* @return Processing error code, RSPLIB_SUCCESS if no error.
|
||||
*/
|
||||
unsigned short RSP_ModelLib_ParseHOBMemFile(const MEMFILE pMemFile,
|
||||
T_RSPMODEL_HOB* hobStruct, const RSPMODEL_PARAMETERS* pParams);
|
||||
unsigned short RSP_ModelLib_ProcessHOBMemFile(T_RSPMODEL_HOB* hobStruct,
|
||||
const MEMFILE pMemFile, const RSPMODEL_PARAMETERS* pParams);
|
||||
|
||||
/**
|
||||
* @brief Process HOB file in file system.
|
||||
* @details HOB file is dumped in memory before parsing in order to enhance
|
||||
* performance during parser operation and in optic to protect data
|
||||
* stored in the original file (read-only).
|
||||
* Parser will extract objects count and information stored in HOB file
|
||||
* and store them in T_RSPMODEL_HOB structure.
|
||||
* @note Managed mode
|
||||
* @brief Load file in memory and store it access in pointer.
|
||||
*
|
||||
* @param[in] fileName String value of file name/path.
|
||||
* @param[out] hobStruct Allocated empty T_RSPMODEL_HOB structure instance to
|
||||
* be filled with HOB datas.
|
||||
* @param[out newMemFile Newly created HOB file pointer, NULL if failure.
|
||||
* @param[in] fileName File path in the filesystem.
|
||||
* @param[in] pParams Parser options. See RSPMODEL_PARAMETERS.
|
||||
*
|
||||
* @return Processing error code, RSPLIB_SUCCESS if no error.
|
||||
*/
|
||||
unsigned short RSP_ModelLib_ParseHOBFile(const char* fileName,
|
||||
T_RSPMODEL_HOB* hobStruct, const RSPMODEL_PARAMETERS* pParams);
|
||||
unsigned short RSP_ModelLib_LoadHOBFile(MEMFILE* newMemFile, const char* fileName, const RSPMODEL_PARAMETERS* pParams);
|
||||
|
||||
/**
|
||||
* @brief Clean memory of file created with RSP_ModelLib_LoadHOBFile().
|
||||
*
|
||||
* @param[in] memFile Pointer to an in-memory HOB file location.
|
||||
*
|
||||
* @return Processing error code, RSPLIB_SUCCESS if no error.
|
||||
*/
|
||||
unsigned short RSP_ModelLib_FreeHOBFile(const MEMFILE* memFile);
|
||||
|
||||
/**
|
||||
* @brief Return number of model objects inside specified pMemfile.
|
||||
*
|
||||
* @param[in] pMemfile Pointer to an in-memory HOB file location.
|
||||
*
|
||||
* @return Number of model objects
|
||||
*/
|
||||
static inline unsigned int RSP_ModelLib_getObjectsCount(const MEMFILE pMemfile) {
|
||||
return ((T_HOBFILE_HEADER*)pMemfile)->obj_count;
|
||||
}
|
||||
|
||||
#endif /* RSPMODELLIB_HOB_PARSER_H_ */
|
||||
|
@ -1,5 +1,10 @@
|
||||
[requires]
|
||||
#opengl/system
|
||||
#glu/system
|
||||
glew/2.2.0
|
||||
#vulkan-headers/1.3.236.0
|
||||
#vulkan-memory-allocator/3.0.1
|
||||
#vulkan-loader/1.3.236.0
|
||||
|
||||
[generators]
|
||||
cmake
|
||||
@ -7,6 +12,7 @@ cmake_find_package
|
||||
|
||||
[options]
|
||||
glew:shared=True
|
||||
vulkan-loader:shared=True
|
||||
|
||||
[imports]
|
||||
bin, *.dll -> ./bin
|
@ -38,7 +38,7 @@ PROJECT_NAME = RSE-Model
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 2.1.0
|
||||
PROJECT_NUMBER = 2.3.0
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
Loading…
x
Reference in New Issue
Block a user